fetch-mock
Advanced tools
Comparing version 10.0.8 to 10.1.0
# Changelog | ||
## [10.1.0](https://github.com/wheresrhys/fetch-mock/compare/fetch-mock-v10.0.8...fetch-mock-v10.1.0) (2024-07-18) | ||
### Features | ||
* **wip:** replace dequal, glob-to-regexp and bump path-to-regexp ([d8d8b25](https://github.com/wheresrhys/fetch-mock/commit/d8d8b259fffbd01a03d5c5bf2768ee48797b68bb)) | ||
### Bug Fixes | ||
* failing tests ([65ef567](https://github.com/wheresrhys/fetch-mock/commit/65ef5678ba23c53d27f3b165fe25020d96c498db)) | ||
* replace path-to-regexp with regexparam ([4bf3e32](https://github.com/wheresrhys/fetch-mock/commit/4bf3e32f852ffc169ca354288eff86737e131480)) | ||
* wildcard import ([ff9fee6](https://github.com/wheresrhys/fetch-mock/commit/ff9fee634db8b019f1384e44d13b4121bc2d62bb)) | ||
## [10.0.8](https://github.com/wheresrhys/fetch-mock/compare/fetch-mock-v10.0.8-alpha.1...fetch-mock-v10.0.8) (2024-07-15) | ||
@@ -4,0 +18,0 @@ |
{ | ||
"name": "fetch-mock", | ||
"version": "10.0.8", | ||
"version": "10.1.0", | ||
"description": "Mock http requests made using fetch (or isomorphic-fetch)", | ||
@@ -36,6 +36,6 @@ "main": "./dist/commonjs.js", | ||
"debug": "^4.1.1", | ||
"glob-to-regexp": "^0.4.0", | ||
"dequal": "^2.0.3", | ||
"globrex": "^0.1.2", | ||
"is-subset": "^0.1.1", | ||
"lodash.isequal": "^4.5.0", | ||
"path-to-regexp": "^2.2.1" | ||
"regexparam": "^3.0.0" | ||
}, | ||
@@ -48,4 +48,4 @@ "peerDependenciesMeta": { | ||
"engines": { | ||
"node": ">=4.0.0" | ||
"node": ">=8.0.0" | ||
} | ||
} |
@@ -1,5 +0,5 @@ | ||
import glob from 'glob-to-regexp'; | ||
import pathToRegexp from 'path-to-regexp'; | ||
import glob from 'globrex'; | ||
import * as regexparam from 'regexparam'; | ||
import isSubset from 'is-subset'; | ||
import isEqual from 'lodash.isequal'; | ||
import { dequal as isEqual } from 'dequal'; | ||
import { | ||
@@ -27,7 +27,7 @@ headers as headerUtils, | ||
const urlRX = glob(targetString); | ||
return debuggableUrlFunc((url) => urlRX.test(url)); | ||
return debuggableUrlFunc((url) => urlRX.regex.test(url)); | ||
}, | ||
express: (targetString) => { | ||
const urlRX = pathToRegexp(targetString); | ||
return debuggableUrlFunc((url) => urlRX.test(getPath(url))); | ||
const urlRX = regexparam.parse(targetString); | ||
return debuggableUrlFunc((url) => urlRX.pattern.test(getPath(url))); | ||
}, | ||
@@ -146,11 +146,10 @@ path: (targetString) => | ||
const expectedKeys = Object.keys(expectedParams); | ||
const keys = []; | ||
const re = pathToRegexp(matcherUrl.replace(/^express:/, ''), keys); | ||
const re = regexparam.parse(matcherUrl.replace(/^express:/, '')); | ||
return (url) => { | ||
debug('Attempting to match path parameters'); | ||
const vals = re.exec(getPath(url)) || []; | ||
const vals = re.pattern.exec(getPath(url)) || []; | ||
vals.shift(); | ||
const params = keys.reduce( | ||
(map, { name }, i) => | ||
vals[i] ? Object.assign(map, { [name]: vals[i] }) : map, | ||
const params = re.keys.reduce( | ||
(map, paramName, i) => | ||
vals[i] ? Object.assign(map, { [paramName]: vals[i] }) : map, | ||
{}, | ||
@@ -157,0 +156,0 @@ ); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
0
171213
21
5066
7
+ Addeddequal@^2.0.3
+ Addedglobrex@^0.1.2
+ Addedregexparam@^3.0.0
+ Addeddequal@2.0.3(transitive)
+ Addedglobrex@0.1.2(transitive)
+ Addedregexparam@3.0.0(transitive)
- Removedglob-to-regexp@^0.4.0
- Removedlodash.isequal@^4.5.0
- Removedpath-to-regexp@^2.2.1
- Removedglob-to-regexp@0.4.1(transitive)
- Removedlodash.isequal@4.5.0(transitive)
- Removedpath-to-regexp@2.4.0(transitive)