Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

path-to-regexp

Package Overview
Dependencies
Maintainers
5
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-to-regexp - npm Package Compare versions

Comparing version 8.1.0 to 8.2.0

44

dist/index.js
"use strict";
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _Iter_peek;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -115,10 +103,9 @@ exports.TokenData = void 0;

this.tokens = tokens;
_Iter_peek.set(this, void 0);
}
peek() {
if (!__classPrivateFieldGet(this, _Iter_peek, "f")) {
if (!this._peek) {
const next = this.tokens.next();
__classPrivateFieldSet(this, _Iter_peek, next.value, "f");
this._peek = next.value;
}
return __classPrivateFieldGet(this, _Iter_peek, "f");
return this._peek;
}

@@ -129,3 +116,3 @@ tryConsume(type) {

return;
__classPrivateFieldSet(this, _Iter_peek, undefined, "f"); // Reset after consumed.
this._peek = undefined; // Reset after consumed.
return token.value;

@@ -149,3 +136,2 @@ }

}
_Iter_peek = new WeakMap();
/**

@@ -309,3 +295,3 @@ * Tokenized path instance.

const sources = [];
const flags = sensitive ? "s" : "is";
const flags = sensitive ? "" : "i";
const paths = Array.isArray(path) ? path : [path];

@@ -356,3 +342,3 @@ const items = paths.map((path) => path instanceof TokenData ? path : parse(path, options));

result += escape(token.value);
backtrack = token.value;
backtrack += token.value;
isSafeSegmentParam || (isSafeSegmentParam = token.value.includes(delimiter));

@@ -369,3 +355,3 @@ continue;

else {
result += `(.+)`;
result += `([\\s\\S]+)`;
}

@@ -381,7 +367,11 @@ keys.push(token);

function negate(delimiter, backtrack) {
const values = [delimiter, backtrack].filter(Boolean);
const isSimple = values.every((value) => value.length === 1);
if (isSimple)
return `[^${escape(values.join(""))}]`;
return `(?:(?!${values.map(escape).join("|")}).)`;
if (backtrack.length < 2) {
if (delimiter.length < 2)
return `[^${escape(delimiter + backtrack)}]`;
return `(?:(?!${escape(delimiter)})[^${escape(backtrack)}])`;
}
if (delimiter.length < 2) {
return `(?:(?!${escape(backtrack)})[^${escape(delimiter)}])`;
}
return `(?:(?!${escape(backtrack)}|${escape(delimiter)})[\\s\\S])`;
}

@@ -416,3 +406,3 @@ /**

function isNextNameSafe(token) {
if (token?.type !== "text")
if ((token === null || token === void 0 ? void 0 : token.type) !== "text")
return true;

@@ -419,0 +409,0 @@ return !ID_CONTINUE.test(token.value[0]);

{
"name": "path-to-regexp",
"version": "8.1.0",
"version": "8.2.0",
"description": "Express style path to RegExp utility",

@@ -35,5 +35,5 @@ "keywords": [

"@size-limit/preset-small-lib": "^11.1.2",
"@types/node": "^20.4.9",
"@types/node": "^22.7.2",
"@types/semver": "^7.3.1",
"@vitest/coverage-v8": "^1.4.0",
"@vitest/coverage-v8": "^2.1.1",
"recheck": "^4.4.5",

@@ -40,0 +40,0 @@ "size-limit": "^11.1.2",

@@ -187,3 +187,3 @@ # Path-to-RegExp

Parameter names, the part after `:` or `*`, must be a valid JavaScript identifier. For example, it cannot start with a number or contain a dash. If you want a parameter name that uses these characters you can wrap the name in quotes, e.g. `:"my-name"`.
Parameter names must be provided after `:` or `*`, and they must be a valid JavaScript identifier. If you want an parameter name that isn't a JavaScript identifier, such as starting with a number, you can wrap the name in quotes like `:"my-name"`.

@@ -198,6 +198,7 @@ ### Unterminated quote

- Regexp characters can no longer be provided.
- The wildcard `*` must have a name, matching the behavior of parameters `:`.
- The optional character `?` is no longer supported, use braces instead: `/:file{.:ext}`.
- Some characters have new meaning or have been reserved (`{}?*+@!;`).
- The parameter name now supports all JavaScript identifier characters, previously it was only `[a-z0-9]`.
- Regexp characters are not supported.
- Some characters have been reserved to avoid confusion during upgrade (`()[]?+!`).
- Parameter names now support valid JavaScript identifiers, or quoted like `:"this"`.

@@ -204,0 +205,0 @@ ## License

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc