Build(deps): bump path-to-regexp from 3.1.0 to 5.0.0 (#4330)
* Build(deps): bump path-to-regexp from 3.1.0 to 5.0.0 Bumps [path-to-regexp](https://github.com/pillarjs/path-to-regexp) from 3.1.0 to 5.0.0. - [Release notes](https://github.com/pillarjs/path-to-regexp/releases) - [Changelog](https://github.com/pillarjs/path-to-regexp/blob/master/History.md) - [Commits](https://github.com/pillarjs/path-to-regexp/compare/v3.1.0...v5.0.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * chore: apply path-to-regexp v5.x changes
This commit is contained in:
committed by
Caleb Cartwright
parent
bd3a133d56
commit
6d5a23b889
@@ -2,7 +2,7 @@
|
||||
|
||||
const { URL } = require('url')
|
||||
const queryString = require('query-string')
|
||||
const pathToRegexp = require('path-to-regexp')
|
||||
const { compile } = require('path-to-regexp')
|
||||
|
||||
function badgeUrlFromPath({
|
||||
baseUrl = '',
|
||||
@@ -33,9 +33,10 @@ function badgeUrlFromPattern({
|
||||
format = '',
|
||||
longCache = false,
|
||||
}) {
|
||||
const toPath = pathToRegexp.compile(pattern, {
|
||||
const toPath = compile(pattern, {
|
||||
strict: true,
|
||||
sensitive: true,
|
||||
encode: encodeURIComponent,
|
||||
})
|
||||
|
||||
const path = toPath(namedParams)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const Joi = require('@hapi/joi')
|
||||
const pathToRegexp = require('path-to-regexp')
|
||||
const { pathToRegexp, compile } = require('path-to-regexp')
|
||||
const categories = require('../../services/categories')
|
||||
const coalesceBadge = require('./coalesce-badge')
|
||||
const { makeFullUrl } = require('./route')
|
||||
@@ -59,7 +59,9 @@ function validateExample(example, index, ServiceClass) {
|
||||
|
||||
// Make sure we can build the full URL using these patterns.
|
||||
try {
|
||||
pathToRegexp.compile(pattern || ServiceClass.route.pattern)(namedParams)
|
||||
compile(pattern || ServiceClass.route.pattern, {
|
||||
encode: encodeURIComponent,
|
||||
})(namedParams)
|
||||
} catch (e) {
|
||||
throw Error(
|
||||
`In example for ${
|
||||
@@ -69,7 +71,10 @@ function validateExample(example, index, ServiceClass) {
|
||||
}
|
||||
// Make sure there are no extra keys.
|
||||
let keys = []
|
||||
pathToRegexp(pattern || ServiceClass.route.pattern, keys)
|
||||
pathToRegexp(pattern || ServiceClass.route.pattern, keys, {
|
||||
strict: true,
|
||||
sensitive: true,
|
||||
})
|
||||
keys = keys.map(({ name }) => name)
|
||||
const extraKeys = Object.keys(namedParams).filter(k => !keys.includes(k))
|
||||
if (extraKeys.length) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const escapeStringRegexp = require('escape-string-regexp')
|
||||
const Joi = require('@hapi/joi')
|
||||
const pathToRegexp = require('path-to-regexp')
|
||||
const { pathToRegexp } = require('path-to-regexp')
|
||||
|
||||
function makeFullUrl(base, partialUrl) {
|
||||
return `/${[base, partialUrl].filter(Boolean).join('/')}`
|
||||
|
||||
Reference in New Issue
Block a user