@modernpoacher/deps 2.2.16 → 2.2.17
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/package.json +1 -1
- package/src/common/index.mjs +37 -9
package/package.json
CHANGED
package/src/common/index.mjs
CHANGED
|
@@ -305,21 +305,42 @@ export const isPreRelease = (v) => /-/.test(v)
|
|
|
305
305
|
*/
|
|
306
306
|
export const isExact = (v) => /^\d/.test(v)
|
|
307
307
|
|
|
308
|
-
|
|
308
|
+
/**
|
|
309
|
+
* @param {[name: string, version: string]} entry
|
|
310
|
+
* @returns {boolean}
|
|
311
|
+
*/
|
|
312
|
+
function includeVersionIsExact ([name, version]) {
|
|
309
313
|
return isExact(version)
|
|
310
314
|
}
|
|
311
315
|
|
|
312
|
-
|
|
316
|
+
/**
|
|
317
|
+
* @param {[name: string, version: string]} entry
|
|
318
|
+
* @returns {boolean}
|
|
319
|
+
*/
|
|
320
|
+
function excludeVersionIsExact ([name, version]) {
|
|
313
321
|
return !isExact(version)
|
|
314
322
|
}
|
|
315
323
|
|
|
316
|
-
|
|
324
|
+
/**
|
|
325
|
+
* @param {Record<string, string>} configurationDependencies
|
|
326
|
+
* @returns {(entry: [name: string, version: string]) => {
|
|
327
|
+
* name: string,
|
|
328
|
+
* version: string
|
|
329
|
+
* }}
|
|
330
|
+
*/
|
|
331
|
+
function getMapToDepsExactVersionFromConfiguration (configurationDependencies) {
|
|
317
332
|
/**
|
|
318
333
|
* We are producing an array of objects from the entries of the `packageDependencies`
|
|
319
334
|
*
|
|
320
335
|
* Each object in the array represents an entry (key and value) from `packageDependencies`
|
|
336
|
+
*
|
|
337
|
+
* @param {[name: string, version: string]} entry
|
|
338
|
+
* @returns {{
|
|
339
|
+
* name: string,
|
|
340
|
+
* version: string
|
|
341
|
+
* }}
|
|
321
342
|
*/
|
|
322
|
-
return function
|
|
343
|
+
return function mapToDepsExactVersionFromConfiguration (entry) {
|
|
323
344
|
const [
|
|
324
345
|
name,
|
|
325
346
|
version
|
|
@@ -336,7 +357,14 @@ function getMapConfigurationDependencies (configurationDependencies) {
|
|
|
336
357
|
}
|
|
337
358
|
}
|
|
338
359
|
|
|
339
|
-
|
|
360
|
+
/**
|
|
361
|
+
* @param {[name: string, version: string]} entry
|
|
362
|
+
* @returns {{
|
|
363
|
+
* name: string,
|
|
364
|
+
* version: string
|
|
365
|
+
* }}
|
|
366
|
+
*/
|
|
367
|
+
function mapToDepsVersion (entry) {
|
|
340
368
|
const [
|
|
341
369
|
name,
|
|
342
370
|
version
|
|
@@ -369,8 +397,8 @@ export function getDepsExact (packageDependencies, configurationDependencies) {
|
|
|
369
397
|
|
|
370
398
|
return (
|
|
371
399
|
Object.entries(packageDependencies)
|
|
372
|
-
.filter(
|
|
373
|
-
.map(
|
|
400
|
+
.filter(includeVersionIsExact)
|
|
401
|
+
.map(getMapToDepsExactVersionFromConfiguration(configurationDependencies))
|
|
374
402
|
)
|
|
375
403
|
}
|
|
376
404
|
|
|
@@ -387,8 +415,8 @@ export function getDeps (packageDependencies) {
|
|
|
387
415
|
|
|
388
416
|
return (
|
|
389
417
|
Object.entries(packageDependencies)
|
|
390
|
-
.filter(
|
|
391
|
-
.map(
|
|
418
|
+
.filter(excludeVersionIsExact)
|
|
419
|
+
.map(mapToDepsVersion)
|
|
392
420
|
)
|
|
393
421
|
}
|
|
394
422
|
|