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

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,586 @@
1
1
  # @verdaccio/server
2
2
 
3
+ ## 7.0.0-next-7.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [74cd588]
8
+ - @verdaccio/api@7.0.0-next-7.8
9
+ - @verdaccio/web@7.0.0-next-7.8
10
+ - @verdaccio/core@7.0.0-next-7.8
11
+ - @verdaccio/config@7.0.0-next-7.8
12
+ - @verdaccio/auth@7.0.0-next-7.8
13
+ - @verdaccio/loaders@7.0.0-next-7.8
14
+ - @verdaccio/middleware@7.0.0-next-7.8
15
+ - verdaccio-audit@12.0.0-next-7.8
16
+ - @verdaccio/store@7.0.0-next-7.8
17
+ - @verdaccio/utils@7.0.0-next-7.8
18
+ - @verdaccio/logger@7.0.0-next-7.8
19
+
20
+ ## 7.0.0-next-7.7
21
+
22
+ ### Patch Changes
23
+
24
+ - @verdaccio/core@7.0.0-next-7.7
25
+ - @verdaccio/config@7.0.0-next-7.7
26
+ - @verdaccio/api@7.0.0-next-7.7
27
+ - @verdaccio/auth@7.0.0-next-7.7
28
+ - @verdaccio/loaders@7.0.0-next-7.7
29
+ - @verdaccio/middleware@7.0.0-next-7.7
30
+ - verdaccio-audit@12.0.0-next-7.7
31
+ - @verdaccio/store@7.0.0-next-7.7
32
+ - @verdaccio/utils@7.0.0-next-7.7
33
+ - @verdaccio/web@7.0.0-next-7.7
34
+ - @verdaccio/logger@7.0.0-next-7.7
35
+
36
+ ## 7.0.0-next.6
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies [e14b064]
41
+ - Updated dependencies [4d96324]
42
+ - @verdaccio/store@7.0.0-next.6
43
+ - @verdaccio/config@7.0.0-next.6
44
+ - @verdaccio/api@7.0.0-next.6
45
+ - @verdaccio/web@7.0.0-next.6
46
+ - @verdaccio/auth@7.0.0-next.6
47
+ - @verdaccio/loaders@7.0.0-next.6
48
+ - @verdaccio/middleware@7.0.0-next.6
49
+ - verdaccio-audit@12.0.0-next.6
50
+ - @verdaccio/core@7.0.0-next.6
51
+ - @verdaccio/utils@7.0.0-next.6
52
+ - @verdaccio/logger@7.0.0-next.6
53
+
54
+ ## 7.0.0-next.5
55
+
56
+ ### Minor Changes
57
+
58
+ - f047cc8: refactor: auth with legacy sign support
59
+
60
+ ### Patch Changes
61
+
62
+ - Updated dependencies [f047cc8]
63
+ - @verdaccio/middleware@7.0.0-next.5
64
+ - @verdaccio/core@7.0.0-next.5
65
+ - @verdaccio/config@7.0.0-next.5
66
+ - @verdaccio/auth@7.0.0-next.5
67
+ - @verdaccio/api@7.0.0-next.5
68
+ - @verdaccio/store@7.0.0-next.5
69
+ - @verdaccio/web@7.0.0-next.5
70
+ - @verdaccio/loaders@7.0.0-next.5
71
+ - @verdaccio/logger@7.0.0-next.5
72
+ - verdaccio-audit@12.0.0-next.5
73
+ - @verdaccio/utils@7.0.0-next.5
74
+
75
+ ## 7.0.0-next.4
76
+
77
+ ### Patch Changes
78
+
79
+ - @verdaccio/auth@7.0.0-next.4
80
+ - @verdaccio/api@7.0.0-next.4
81
+ - verdaccio-audit@12.0.0-next.4
82
+ - @verdaccio/web@7.0.0-next.4
83
+ - @verdaccio/core@7.0.0-next.4
84
+ - @verdaccio/config@7.0.0-next.4
85
+ - @verdaccio/loaders@7.0.0-next.4
86
+ - @verdaccio/middleware@7.0.0-next.4
87
+ - @verdaccio/store@7.0.0-next.4
88
+ - @verdaccio/utils@7.0.0-next.4
89
+ - @verdaccio/logger@7.0.0-next.4
90
+
91
+ ## 7.0.0-next.3
92
+
93
+ ### Major Changes
94
+
95
+ - e7ebccb61: update major dependencies, remove old nodejs support
96
+
97
+ ### Patch Changes
98
+
99
+ - 3ca405618: fix: Avoid 404 error when getting favicon from root
100
+ - Updated dependencies [daceb6d87]
101
+ - Updated dependencies [e7ebccb61]
102
+ - @verdaccio/config@7.0.0-next.3
103
+ - @verdaccio/core@7.0.0-next.3
104
+ - @verdaccio/middleware@7.0.0-next.3
105
+ - verdaccio-audit@12.0.0-next.3
106
+ - @verdaccio/utils@7.0.0-next.3
107
+ - @verdaccio/api@7.0.0-next.3
108
+ - @verdaccio/auth@7.0.0-next.3
109
+ - @verdaccio/loaders@7.0.0-next.3
110
+ - @verdaccio/logger@7.0.0-next.3
111
+ - @verdaccio/store@7.0.0-next.3
112
+ - @verdaccio/web@7.0.0-next.3
113
+
114
+ ## 7.0.0-next.2
115
+
116
+ ### Patch Changes
117
+
118
+ - @verdaccio/core@7.0.0-next.2
119
+ - @verdaccio/config@7.0.0-next.2
120
+ - @verdaccio/api@7.0.0-next.2
121
+ - @verdaccio/auth@7.0.0-next.2
122
+ - @verdaccio/loaders@7.0.0-next.2
123
+ - @verdaccio/middleware@7.0.0-next.2
124
+ - verdaccio-audit@12.0.0-next.2
125
+ - @verdaccio/store@7.0.0-next.2
126
+ - @verdaccio/utils@7.0.0-next.2
127
+ - @verdaccio/web@7.0.0-next.2
128
+ - @verdaccio/logger@7.0.0-next.2
129
+
130
+ ## 7.0.0-next.1
131
+
132
+ ### Patch Changes
133
+
134
+ - @verdaccio/core@7.0.0-next.1
135
+ - @verdaccio/config@7.0.0-next.1
136
+ - @verdaccio/api@7.0.0-next.1
137
+ - @verdaccio/auth@7.0.0-next.1
138
+ - @verdaccio/loaders@7.0.0-next.1
139
+ - @verdaccio/middleware@7.0.0-next.1
140
+ - verdaccio-audit@12.0.0-next.1
141
+ - @verdaccio/store@7.0.0-next.1
142
+ - @verdaccio/utils@7.0.0-next.1
143
+ - @verdaccio/web@7.0.0-next.1
144
+ - @verdaccio/logger@7.0.0-next.1
145
+
146
+ ## 7.0.0-next.0
147
+
148
+ ### Major Changes
149
+
150
+ - feat!: bump to v7
151
+
152
+ ### Patch Changes
153
+
154
+ - Updated dependencies
155
+ - @verdaccio/api@7.0.0-next.0
156
+ - @verdaccio/auth@7.0.0-next.0
157
+ - @verdaccio/config@7.0.0-next.0
158
+ - @verdaccio/core@7.0.0-next.0
159
+ - @verdaccio/loaders@7.0.0-next.0
160
+ - @verdaccio/logger@7.0.0-next.0
161
+ - @verdaccio/middleware@7.0.0-next.0
162
+ - verdaccio-audit@12.0.0-next.0
163
+ - @verdaccio/store@7.0.0-next.0
164
+ - @verdaccio/utils@7.0.0-next.0
165
+ - @verdaccio/web@7.0.0-next.0
166
+
167
+ ## 6.0.0
168
+
169
+ ### Major Changes
170
+
171
+ - 292c0a37f: feat!: replace deprecated request dependency by got
172
+
173
+ 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.
174
+
175
+ ## Notes
176
+
177
+ - Remove deprecated `request` by other `got`, retry improved, custom Agent ( got does not include it built-in)
178
+ - Remove `async` dependency from storage (used by core) it was linked with proxy somehow safe to remove now
179
+ - Refactor with promises instead callback wherever is possible
180
+ - ~Document the API~
181
+ - Improve testing, integration tests
182
+ - Bugfix
183
+ - Clean up old validations
184
+ - Improve performance
185
+
186
+ ## 💥 Breaking changes
187
+
188
+ - Plugin API methods were callbacks based are returning promises, this will break current storage plugins, check documentation for upgrade.
189
+ - 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));`
190
+ - `@verdaccio/streams` stream abort support is legacy is being deprecated removed
191
+ - Remove AWS and Google Cloud packages for future refactoring [#2574](https://github.com/verdaccio/verdaccio/pull/2574).
192
+
193
+ - a828271d6: refactor: download manifest endpoint and integrate fastify
194
+
195
+ Much simpler API for fetching a package
196
+
197
+ ```
198
+ const manifest = await storage.getPackageNext({
199
+ name,
200
+ uplinksLook: true,
201
+ req,
202
+ version: queryVersion,
203
+ requestOptions,
204
+ });
205
+ ```
206
+
207
+ > 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.
208
+
209
+ ### Details
210
+
211
+ - `async/await` sugar for getPackage()
212
+ - Improve and reuse code between current implementation and new fastify endpoint (add scaffolding for request manifest)
213
+ - Improve performance
214
+ - Add new tests
215
+
216
+ ### Breaking changes
217
+
218
+ 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
219
+
220
+ - 459b6fa72: refactor: search v1 endpoint and local-database
221
+
222
+ - refactor search `api v1` endpoint, improve performance
223
+ - remove usage of `async` dependency https://github.com/verdaccio/verdaccio/issues/1225
224
+ - refactor method storage class
225
+ - create new module `core` to reduce the ammount of modules with utilities
226
+ - use `undici` instead `node-fetch`
227
+ - use `fastify` instead `express` for functional test
228
+
229
+ ### Breaking changes
230
+
231
+ - plugin storage API changes
232
+ - remove old search endpoint (return 404)
233
+ - filter local private packages at plugin level
234
+
235
+ 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.
236
+
237
+ ```ts
238
+ export interface IPluginStorage<T> extends IPlugin {
239
+ add(name: string): Promise<void>;
240
+ remove(name: string): Promise<void>;
241
+ get(): Promise<any>;
242
+ init(): Promise<void>;
243
+ getSecret(): Promise<string>;
244
+ setSecret(secret: string): Promise<any>;
245
+ getPackageStorage(packageInfo: string): IPackageStorage;
246
+ search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;
247
+ saveToken(token: Token): Promise<any>;
248
+ deleteToken(user: string, tokenKey: string): Promise<any>;
249
+ readTokens(filter: TokenFilter): Promise<Token[]>;
250
+ }
251
+ ```
252
+
253
+ - 9fc2e7961: feat(plugins): improve plugin loader
254
+
255
+ ### Changes
256
+
257
+ - Add scope plugin support to 6.x https://github.com/verdaccio/verdaccio/pull/3227
258
+ - Avoid config collisions https://github.com/verdaccio/verdaccio/issues/928
259
+ - https://github.com/verdaccio/verdaccio/issues/1394
260
+ - `config.plugins` plugin path validations
261
+ - Updated algorithm for plugin loader.
262
+ - improved documentation (included dev)
263
+
264
+ ## Features
265
+
266
+ - Add scope plugin support to 6.x https://github.com/verdaccio/verdaccio/pull/3227
267
+ - Custom prefix:
268
+
269
+ ```
270
+ // config.yaml
271
+ server:
272
+ pluginPrefix: mycompany
273
+ middleware:
274
+ audit:
275
+ foo: 1
276
+ ```
277
+
278
+ This configuration will look up for `mycompany-audit` instead `Verdaccio-audit`.
279
+
280
+ ## Breaking Changes
281
+
282
+ ### sinopia plugins
283
+
284
+ - `sinopia` fallback support is removed, but can be restored using `pluginPrefix`
285
+
286
+ ### plugin filter
287
+
288
+ - method rename `filter_metadata`->`filterMetadata`
289
+
290
+ ### Plugin constructor does not merge configs anymore https://github.com/verdaccio/verdaccio/issues/928
291
+
292
+ The plugin receives as first argument `config`, which represents the config of the plugin. Example:
293
+
294
+ ```
295
+ // config.yaml
296
+ auth:
297
+ plugin:
298
+ foo: 1
299
+ bar: 2
300
+
301
+ export class Plugin<T> {
302
+ public constructor(config: T, options: PluginOptions) {
303
+ console.log(config);
304
+ // {foo:1, bar: 2}
305
+ }
306
+ }
307
+ ```
308
+
309
+ - 794af76c5: Remove Node 12 support
310
+
311
+ - We need move to the new `undici` and does not support Node.js 12
312
+
313
+ - 10aeb4f13: feat!: experiments config renamed to flags
314
+
315
+ - The `experiments` configuration is renamed to `flags`. The functionality is exactly the same.
316
+
317
+ ```js
318
+ flags: token: false;
319
+ search: false;
320
+ ```
321
+
322
+ - The `self_path` property from the config file is being removed in favor of `config_file` full path.
323
+ - Refactor `config` module, better types and utilities
324
+
325
+ - e367c3f1e: - Replace signature handler for legacy tokens by removing deprecated crypto.createDecipher by createCipheriv
326
+
327
+ - Introduce environment variables for legacy tokens
328
+
329
+ ### Code Improvements
330
+
331
+ - Add debug library for improve developer experience
332
+
333
+ ### Breaking change
334
+
335
+ - The new signature invalidates all previous tokens generated by Verdaccio 4 or previous versions.
336
+ - The secret key must have 32 characters long.
337
+
338
+ ### New environment variables
339
+
340
+ - `VERDACCIO_LEGACY_ALGORITHM`: Allows to define the specific algorithm for the token signature which by default is `aes-256-ctr`
341
+ - `VERDACCIO_LEGACY_ENCRYPTION_KEY`: By default, the token stores in the database, but using this variable allows to get it from memory
342
+
343
+ - 061bfcc8d: feat: standalone registry with no dependencies
344
+
345
+ ## Usage
346
+
347
+ To install a server with no dependencies
348
+
349
+ ```bash
350
+ npm install -g @verdaccio/standalone
351
+ ```
352
+
353
+ with no internet required
354
+
355
+ ```bash
356
+ npm install -g ./tarball.tar.gz
357
+ ```
358
+
359
+ Bundles htpasswd and audit plugins.
360
+
361
+ ### Breaking Change
362
+
363
+ It does not allow anymore the `auth` and `middleware` property at config file empty,
364
+ it will fallback to those plugins by default.
365
+
366
+ - 82cb0f2bf: feat!: config.logs throw an error, logging config not longer accept array or logs property
367
+
368
+ ### 💥 Breaking change
369
+
370
+ This is valid
371
+
372
+ ```yaml
373
+ log: { type: stdout, format: pretty, level: http }
374
+ ```
375
+
376
+ This is invalid
377
+
378
+ ```yaml
379
+ logs: { type: stdout, format: pretty, level: http }
380
+ ```
381
+
382
+ or
383
+
384
+ ```yaml
385
+ logs:
386
+ - [{ type: stdout, format: pretty, level: http }]
387
+ ```
388
+
389
+ ### Minor Changes
390
+
391
+ - ae93e039d: fix: expose middleware methods
392
+ - 631abe1ac: feat: refactor logger
393
+ - 00d1d2a17: chore: env variable for launch fastify
394
+
395
+ - Update fastify to major release `v4.3.0`
396
+ - Update CLI launcher
397
+
398
+ via CLI
399
+
400
+ ```
401
+ VERDACCIO_SERVER=fastify verdaccio
402
+ ```
403
+
404
+ with docker
405
+
406
+ ```
407
+ docker run -it --rm --name verdaccio \
408
+ -e "VERDACCIO_SERVER=8080" -p 8080:8080 \
409
+ -e "VERDACCIO_SERVER=fastify" \
410
+ verdaccio/verdaccio
411
+ ```
412
+
413
+ - 048ac95e8: feat: align with v5 ui endpoints and ui small bugfix
414
+ - b61f762d6: feat: add server rate limit protection to all request
415
+
416
+ To modify custom values, use the server settings property.
417
+
418
+ ```markdown
419
+ server:
420
+
421
+ ## https://www.npmjs.com/package/express-rate-limit#configuration-options
422
+
423
+ rateLimit:
424
+ windowMs: 1000
425
+ max: 10000
426
+ ```
427
+
428
+ The values are intended to be high, if you want to improve security of your server consider
429
+ using different values.
430
+
431
+ - 154b2ecd3: refactor: remove @verdaccio/commons-api in favor @verdaccio/core and remove duplications
432
+ - aa763baec: feat: add typescript project references settings
433
+
434
+ 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.
435
+
436
+ It allows to navigate (IDE) trough the packages without need compile the packages.
437
+
438
+ 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).
439
+
440
+ - 16e38df8a: feat: trustProxy property
441
+ - 5167bb528: feat: ui search support for remote, local and private packages
442
+
443
+ The command `npm search` search globally and return all matches, with this improvement the user interface
444
+ is powered with the same capabilities.
445
+
446
+ The UI also tag where is the origin the package with a tag, also provide the latest version and description of the package.
447
+
448
+ - 45c03819e: refactor: render html middleware
449
+
450
+ ### Patch Changes
451
+
452
+ - 9943e2b18: fix: extract logger from middleware
453
+ - 351aeeaa8: fix(deps): @verdaccio/utils should be a prod dep of local-storage
454
+ - 7ef599cc4: fix: missing version on footer
455
+ - 19d272d10: fix: restore logger on init
456
+
457
+ Enable logger after parse configuration and log the very first step on startup phase.
458
+
459
+ ```bash
460
+ warn --- experiments are enabled, it is recommended do not use experiments in production comment out this section to disable it
461
+ info --- support for experiment [token] is disabled
462
+ info --- support for experiment [search] is disabled
463
+ (node:50831) Warning: config.logs is deprecated, rename configuration to "config.log"
464
+ (Use `node --trace-warnings ...` to show where the warning was created)
465
+ info --- http address http://localhost:4873/
466
+ info --- version: 6.0.0-6-next.11
467
+ info --- server started
468
+ ```
469
+
470
+ - a610ef26b: chore: add release step to private regisry on merge changeset pr
471
+ - 648575aa4: Bug Fixes
472
+
473
+ - fix escaped slash in namespaced packages
474
+
475
+ #### Related tickets
476
+
477
+ https://github.com/verdaccio/verdaccio/pull/2193
478
+
479
+ - 34f0f1101: Enable prerelease mode with **changesets**
480
+ - 68ea21214: ESLint Warnings Fixed
481
+
482
+ Related to issue #1461
483
+
484
+ - max-len: most of the sensible max-len errors are fixed
485
+ - no-unused-vars: most of these types of errors are fixed by deleting not needed declarations
486
+ - @typescript-eslint/no-unused-vars: same as above
487
+
488
+ - Updated dependencies [0da7031e7]
489
+ - Updated dependencies [292c0a37f]
490
+ - Updated dependencies [dc05edfe6]
491
+ - Updated dependencies [a1986e098]
492
+ - Updated dependencies [974cd8c19]
493
+ - Updated dependencies [a828271d6]
494
+ - Updated dependencies [ef88da3b4]
495
+ - Updated dependencies [43f32687c]
496
+ - Updated dependencies [679c19c1b]
497
+ - Updated dependencies [a3a209b5e]
498
+ - Updated dependencies [459b6fa72]
499
+ - Updated dependencies [9fc2e7961]
500
+ - Updated dependencies [9943e2b18]
501
+ - Updated dependencies [ae93e039d]
502
+ - Updated dependencies [702d5c497]
503
+ - Updated dependencies [24b9be020]
504
+ - Updated dependencies [794af76c5]
505
+ - Updated dependencies [e75c0a3b9]
506
+ - Updated dependencies [351aeeaa8]
507
+ - Updated dependencies [10aeb4f13]
508
+ - Updated dependencies [1d1112805]
509
+ - Updated dependencies [631abe1ac]
510
+ - Updated dependencies [9718e0330]
511
+ - Updated dependencies [7ef599cc4]
512
+ - Updated dependencies [b702ea363]
513
+ - Updated dependencies [1b217fd34]
514
+ - Updated dependencies [e367c3f1e]
515
+ - Updated dependencies [a1da11308]
516
+ - Updated dependencies [d167f92e1]
517
+ - Updated dependencies [d2c65da9c]
518
+ - Updated dependencies [00d1d2a17]
519
+ - Updated dependencies [a828a5f6c]
520
+ - Updated dependencies [1810ed0d8]
521
+ - Updated dependencies [a610ef26b]
522
+ - Updated dependencies [ddb6a2239]
523
+ - Updated dependencies [e54ec4b5d]
524
+ - Updated dependencies [a23628be9]
525
+ - Updated dependencies [048ac95e8]
526
+ - Updated dependencies [f96b147ea]
527
+ - Updated dependencies [31d661c7b]
528
+ - Updated dependencies [648575aa4]
529
+ - Updated dependencies [b61f762d6]
530
+ - Updated dependencies [4fc21146a]
531
+ - Updated dependencies [d43894e8f]
532
+ - Updated dependencies [154b2ecd3]
533
+ - Updated dependencies [061bfcc8d]
534
+ - Updated dependencies [aa763baec]
535
+ - Updated dependencies [378e907d5]
536
+ - Updated dependencies [16e38df8a]
537
+ - Updated dependencies [34f0f1101]
538
+ - Updated dependencies [82cb0f2bf]
539
+ - Updated dependencies [dc571aabd]
540
+ - Updated dependencies [5ddfa5264]
541
+ - Updated dependencies [b78f35257]
542
+ - Updated dependencies [ce013d2fc]
543
+ - Updated dependencies [f859d2b1a]
544
+ - Updated dependencies [000d43746]
545
+ - Updated dependencies [2c594910d]
546
+ - Updated dependencies [6c1eb021b]
547
+ - Updated dependencies [168833d85]
548
+ - Updated dependencies [62c24b632]
549
+ - Updated dependencies [0a6412ca9]
550
+ - Updated dependencies [0a6412ca9]
551
+ - Updated dependencies [d08fe29d9]
552
+ - Updated dependencies [b4cc80017]
553
+ - Updated dependencies [558d78f32]
554
+ - Updated dependencies [5167bb528]
555
+ - Updated dependencies [f86c31ed0]
556
+ - Updated dependencies [65f88b826]
557
+ - Updated dependencies [781ac9ac2]
558
+ - Updated dependencies [aeff267d9]
559
+ - Updated dependencies [20c9e43ed]
560
+ - Updated dependencies [b3e8438f6]
561
+ - Updated dependencies [c9d1af0e5]
562
+ - Updated dependencies [730b5d8cc]
563
+ - Updated dependencies [4b29d715b]
564
+ - Updated dependencies [b13a3fefd]
565
+ - Updated dependencies [68ea21214]
566
+ - Updated dependencies [37274e4c8]
567
+ - Updated dependencies [fa274ee44]
568
+ - Updated dependencies [8f43bf17d]
569
+ - Updated dependencies [45c03819e]
570
+ - Updated dependencies [aecbd226d]
571
+ - Updated dependencies [b849128de]
572
+ - @verdaccio/web@6.0.0
573
+ - @verdaccio/api@6.0.0
574
+ - @verdaccio/auth@6.0.0
575
+ - @verdaccio/config@6.0.0
576
+ - @verdaccio/core@6.0.0
577
+ - @verdaccio/loaders@6.0.0
578
+ - @verdaccio/logger@6.0.0
579
+ - @verdaccio/middleware@6.0.0
580
+ - verdaccio-audit@11.0.0
581
+ - @verdaccio/store@6.0.0
582
+ - @verdaccio/utils@6.0.0
583
+
3
584
  ## 6.0.0-6-next.65
4
585
 
5
586
  ### 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"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,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,G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,CAAA9D,OAAA,GAA1B,eAAe6D,WAAWA,CAACE,UAAsB,EAAgB;EAC/E9D,KAAK,CAAC,cAAc,CAAC;EACrB,MAAMI,MAAe,GAAG,IAAI2D,cAAS,CAAC;IAAE,GAAGD;EAAW,CAAQ,CAAC;EAC/D;EACA9D,KAAK,CAAC,sBAAsB,CAAC;EAC7B;EACA,MAAMK,OAAgB,GAAG,IAAI2D,cAAO,CAAC5D,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,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.8",
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.8",
33
+ "@verdaccio/auth": "7.0.0-next-7.8",
34
+ "@verdaccio/core": "7.0.0-next-7.8",
35
+ "@verdaccio/config": "7.0.0-next-7.8",
36
+ "@verdaccio/loaders": "7.0.0-next-7.8",
37
+ "@verdaccio/logger": "7.0.0-next-7.8",
38
+ "@verdaccio/middleware": "7.0.0-next-7.8",
39
+ "@verdaccio/store": "7.0.0-next-7.8",
40
+ "@verdaccio/utils": "7.0.0-next-7.8",
41
+ "@verdaccio/web": "7.0.0-next-7.8",
42
+ "verdaccio-audit": "12.0.0-next-7.8",
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.8",
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);