Comparing version 5.1.0 to 5.1.1
@@ -203,3 +203,3 @@ var __defProp = Object.defineProperty; | ||
const _namesByIndex = { 0: "" }; | ||
let captureNum = 0; | ||
let realCaptureNum = 0; | ||
expression = replaceUnescaped( | ||
@@ -209,6 +209,2 @@ expression, | ||
({ 0: m, groups: { name, mark, transfer } }) => { | ||
captureNum++; | ||
if (name) { | ||
_namesByIndex[captureNum] = name; | ||
} | ||
if (mark) { | ||
@@ -221,2 +217,6 @@ _captureMap.push({ | ||
} | ||
realCaptureNum++; | ||
if (name) { | ||
_namesByIndex[realCaptureNum] = name; | ||
} | ||
_captureMap.push({ | ||
@@ -223,0 +223,0 @@ exclude: false |
@@ -176,3 +176,3 @@ // node_modules/.pnpm/regex-utilities@2.3.0/node_modules/regex-utilities/src/index.js | ||
const _namesByIndex = { 0: "" }; | ||
let captureNum = 0; | ||
let realCaptureNum = 0; | ||
expression = replaceUnescaped( | ||
@@ -182,6 +182,2 @@ expression, | ||
({ 0: m, groups: { name, mark, transfer } }) => { | ||
captureNum++; | ||
if (name) { | ||
_namesByIndex[captureNum] = name; | ||
} | ||
if (mark) { | ||
@@ -194,2 +190,6 @@ _captureMap.push({ | ||
} | ||
realCaptureNum++; | ||
if (name) { | ||
_namesByIndex[realCaptureNum] = name; | ||
} | ||
_captureMap.push({ | ||
@@ -196,0 +196,0 @@ exclude: false |
@@ -1,2 +0,2 @@ | ||
var Regex=(()=>{var Z=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var Te=(e,n)=>{for(var t in n)Z(e,t,{get:n[t],enumerable:!0})},Ue=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of De(n))!be.call(e,s)&&s!==t&&Z(e,s,{get:()=>n[s],enumerable:!(r=xe(n,s))||r.enumerable});return e};var Re=e=>Ue(Z({},"__esModule",{value:!0}),e);var Je={};Te(Je,{pattern:()=>H,regex:()=>We,rewrite:()=>Ke});var d=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function C(e,n,t,r){let s=new RegExp(String.raw`${n}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1],i=0,a="";for(let u of e.matchAll(s)){let{0:c,groups:{$skip:p}}=u;if(!p&&(!r||r===d.DEFAULT==!i)){t instanceof Function?a+=t(u,{context:i?d.CHAR_CLASS:d.DEFAULT,negated:o[o.length-1]}):a+=t;continue}c[0]==="["?(i++,o.push(c[1]==="^")):c==="]"&&i&&(i--,o.pop()),a+=c}return a}function P(e,n,t,r){C(e,n,t,r)}function V(e,n,t=0,r){if(!new RegExp(n,"su").test(e))return null;let s=new RegExp(`${n}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=t;let o=0,i;for(;i=s.exec(e);){let{0:a,groups:{$skip:u}}=i;if(!u&&(!r||r===d.DEFAULT==!o))return i;a==="["?o++:a==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function j(e,n,t){return!!V(e,n,0,t)}function J(e,n){let t=/\\?./gsu;t.lastIndex=n;let r=e.length,s=0,o=1,i;for(;i=t.exec(e);){let[a]=i;if(a==="[")s++;else if(s)a==="]"&&s--;else if(a==="(")o++;else if(a===")"&&(o--,!o)){r=i.index;break}}return e.slice(n,r)}var x="$E$",Q=class e extends RegExp{_captureMap;_namesByIndex;constructor(n,t,r){if(n instanceof RegExp&&r)throw new Error("Cannot provide options when copying a regexp");let s=!!r?.useEmulationGroups,o=s?Fe(n):null;super(o?.expression||n,t);let i=s?o:n instanceof e?n:null;i&&(this._captureMap=i._captureMap,this._namesByIndex=i._namesByIndex)}exec(n){let t=RegExp.prototype.exec.call(this,n);if(!t||!this._captureMap)return t;let r=[...t];t.length=1;let s;this.hasIndices&&(s=[...t.indices],t.indices.length=1);for(let o=1;o<r.length;o++)if(this._captureMap[o].exclude){let i=this._captureMap[o].transfer;if(i&&t.length>i){t[i]=r[o];let a=this._namesByIndex[i];a&&(t.groups[a]=r[o],this.hasIndices&&(t.indices.groups[a]=s[o])),this.hasIndices&&(t.indices[i]=s[o])}}else t.push(r[o]),this.hasIndices&&t.indices.push(s[o]);return t}};function Fe(e){let n=x.replace(/\$/g,"\\$"),t=[{exclude:!1}],r={0:""},s=0;return e=C(e,String.raw`\((?:(?!\?)|\?<(?![=!])(?<name>[^>]+)>)(?<mark>(?:\$(?<transfer>[1-9]\d*))?${n})?`,({0:o,groups:{name:i,mark:a,transfer:u}})=>(s++,i&&(r[s]=i),a?(t.push({exclude:!0,transfer:u&&+u}),o.slice(0,-a.length)):(t.push({exclude:!1}),o)),d.DEFAULT),{_captureMap:t,_namesByIndex:r,expression:e}}var D=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function b(e,n,t,r){return e.slice(0,n)+r+e.slice(n+t.length)}var oe=new RegExp(String.raw`(?<noncapturingStart>${D})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function ae(e,n){if(!/\(\?>/.test(e))return e;let t="(?>",r=`(?:(?=(${n?.useEmulationGroups?x:""}`,s=[0],o=0,i=0,a=NaN,u;do{u=!1;let c=0,p=0,E=!1,l;for(oe.lastIndex=Number.isNaN(a)?0:a+r.length;l=oe.exec(e);){let{0:g,index:A,groups:{capturingStart:h,noncapturingStart:S}}=l;if(g==="[")c++;else if(c)g==="]"&&c--;else if(g===t&&!E)a=A,E=!0;else if(E&&S)p++;else if(h)E?p++:(o++,s.push(o+i));else if(g===")"&&E){if(!p){i++,e=`${e.slice(0,a)}${r}${e.slice(a+t.length,A)}))<$$${i+o}>)${e.slice(A+1)}`,u=!0;break}p--}}}while(u);return e=C(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:c,groups:{backrefNum:p,wrappedBackrefNum:E}})=>{if(p){let l=+p;if(l>s.length-1)throw new Error(`Backref "${c}" greater than number of captures`);return`\\${s[l]}`}return`\\${E}`},d.DEFAULT),e}var ie=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,X=new RegExp(String.raw` | ||
var Regex=(()=>{var Z=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var Te=(e,n)=>{for(var t in n)Z(e,t,{get:n[t],enumerable:!0})},Ue=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of De(n))!be.call(e,s)&&s!==t&&Z(e,s,{get:()=>n[s],enumerable:!(r=xe(n,s))||r.enumerable});return e};var Re=e=>Ue(Z({},"__esModule",{value:!0}),e);var Je={};Te(Je,{pattern:()=>H,regex:()=>We,rewrite:()=>Ke});var d=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function C(e,n,t,r){let s=new RegExp(String.raw`${n}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1],i=0,a="";for(let u of e.matchAll(s)){let{0:c,groups:{$skip:p}}=u;if(!p&&(!r||r===d.DEFAULT==!i)){t instanceof Function?a+=t(u,{context:i?d.CHAR_CLASS:d.DEFAULT,negated:o[o.length-1]}):a+=t;continue}c[0]==="["?(i++,o.push(c[1]==="^")):c==="]"&&i&&(i--,o.pop()),a+=c}return a}function P(e,n,t,r){C(e,n,t,r)}function V(e,n,t=0,r){if(!new RegExp(n,"su").test(e))return null;let s=new RegExp(`${n}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=t;let o=0,i;for(;i=s.exec(e);){let{0:a,groups:{$skip:u}}=i;if(!u&&(!r||r===d.DEFAULT==!o))return i;a==="["?o++:a==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function j(e,n,t){return!!V(e,n,0,t)}function J(e,n){let t=/\\?./gsu;t.lastIndex=n;let r=e.length,s=0,o=1,i;for(;i=t.exec(e);){let[a]=i;if(a==="[")s++;else if(s)a==="]"&&s--;else if(a==="(")o++;else if(a===")"&&(o--,!o)){r=i.index;break}}return e.slice(n,r)}var x="$E$",Q=class e extends RegExp{_captureMap;_namesByIndex;constructor(n,t,r){if(n instanceof RegExp&&r)throw new Error("Cannot provide options when copying a regexp");let s=!!r?.useEmulationGroups,o=s?Fe(n):null;super(o?.expression||n,t);let i=s?o:n instanceof e?n:null;i&&(this._captureMap=i._captureMap,this._namesByIndex=i._namesByIndex)}exec(n){let t=RegExp.prototype.exec.call(this,n);if(!t||!this._captureMap)return t;let r=[...t];t.length=1;let s;this.hasIndices&&(s=[...t.indices],t.indices.length=1);for(let o=1;o<r.length;o++)if(this._captureMap[o].exclude){let i=this._captureMap[o].transfer;if(i&&t.length>i){t[i]=r[o];let a=this._namesByIndex[i];a&&(t.groups[a]=r[o],this.hasIndices&&(t.indices.groups[a]=s[o])),this.hasIndices&&(t.indices[i]=s[o])}}else t.push(r[o]),this.hasIndices&&t.indices.push(s[o]);return t}};function Fe(e){let n=x.replace(/\$/g,"\\$"),t=[{exclude:!1}],r={0:""},s=0;return e=C(e,String.raw`\((?:(?!\?)|\?<(?![=!])(?<name>[^>]+)>)(?<mark>(?:\$(?<transfer>[1-9]\d*))?${n})?`,({0:o,groups:{name:i,mark:a,transfer:u}})=>a?(t.push({exclude:!0,transfer:u&&+u}),o.slice(0,-a.length)):(s++,i&&(r[s]=i),t.push({exclude:!1}),o),d.DEFAULT),{_captureMap:t,_namesByIndex:r,expression:e}}var D=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function b(e,n,t,r){return e.slice(0,n)+r+e.slice(n+t.length)}var oe=new RegExp(String.raw`(?<noncapturingStart>${D})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function ae(e,n){if(!/\(\?>/.test(e))return e;let t="(?>",r=`(?:(?=(${n?.useEmulationGroups?x:""}`,s=[0],o=0,i=0,a=NaN,u;do{u=!1;let c=0,p=0,E=!1,l;for(oe.lastIndex=Number.isNaN(a)?0:a+r.length;l=oe.exec(e);){let{0:g,index:A,groups:{capturingStart:h,noncapturingStart:S}}=l;if(g==="[")c++;else if(c)g==="]"&&c--;else if(g===t&&!E)a=A,E=!0;else if(E&&S)p++;else if(h)E?p++:(o++,s.push(o+i));else if(g===")"&&E){if(!p){i++,e=`${e.slice(0,a)}${r}${e.slice(a+t.length,A)}))<$$${i+o}>)${e.slice(A+1)}`,u=!0;break}p--}}}while(u);return e=C(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:c,groups:{backrefNum:p,wrappedBackrefNum:E}})=>{if(p){let l=+p;if(l>s.length-1)throw new Error(`Backref "${c}" greater than number of captures`);return`\\${s[l]}`}return`\\${E}`},d.DEFAULT),e}var ie=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,X=new RegExp(String.raw` | ||
\\(?: \d+ | ||
@@ -3,0 +3,0 @@ | c[A-Za-z] |
{ | ||
"name": "regex", | ||
"version": "5.1.0", | ||
"version": "5.1.1", | ||
"description": "Regex template tag with extended syntax, context-aware interpolation, and always-on best practices", | ||
@@ -5,0 +5,0 @@ "author": "Steven Levithan", |
@@ -114,3 +114,3 @@ import {Context, replaceUnescaped} from 'regex-utilities'; | ||
const _namesByIndex = {0: ''}; | ||
let captureNum = 0; | ||
let realCaptureNum = 0; | ||
expression = replaceUnescaped( | ||
@@ -120,6 +120,2 @@ expression, | ||
({0: m, groups: {name, mark, transfer}}) => { | ||
captureNum++; | ||
if (name) { | ||
_namesByIndex[captureNum] = name; | ||
} | ||
if (mark) { | ||
@@ -132,2 +128,6 @@ _captureMap.push({ | ||
} | ||
realCaptureNum++; | ||
if (name) { | ||
_namesByIndex[realCaptureNum] = name; | ||
} | ||
_captureMap.push({ | ||
@@ -134,0 +134,0 @@ exclude: false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
547145