react-grep 0.2.3 → 0.3.1
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/dist/index.global.js +3 -3
- package/dist/index.js +75 -3
- package/package.json +9 -3
package/dist/index.global.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var ReactGrep=(function(exports){'use strict';var d=typeof navigator<"u"&&/mac/i.test(navigator.userAgentData?.platform??navigator.userAgent);var g=new Map,
|
|
2
|
-
`)){let i=
|
|
3
|
-
exports.destroy=
|
|
1
|
+
var ReactGrep=(function(exports){'use strict';var d=typeof navigator<"u"&&/mac/i.test(navigator.userAgentData?.platform??navigator.userAgent);var g=new Map,I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_=[];for(let t=0;t<I.length;t++)_[I.charCodeAt(t)]=t;var y=(t,e)=>{let n=0,i=0;for(;e.i<t.length;){let o=_[t.charCodeAt(e.i++)];if(i+=(o&31)<<n,!(o&32))return i&1?-(i>>1):i>>1;n+=5;}return 0},A=t=>{let e=[],n=0,i=0,o=0;for(let r of t.split(";")){let s=[],a=0;if(r){let l={i:0};for(;l.i<r.length;){if(r.charCodeAt(l.i)===44){l.i++;continue}a+=y(r,l),!(l.i>=r.length||r.charCodeAt(l.i)===44)&&(n+=y(r,l),i+=y(r,l),o+=y(r,l),l.i<r.length&&r.charCodeAt(l.i)!==44&&y(r,l),s.push([a,n,i,o]));}}e.push(s);}return e},K=/^data:application\/json[^,]*;base64,([A-Za-z0-9+/=]+)$/,G=(t,e)=>{try{return new URL(t).origin===new URL(e).origin}catch{return false}},C=async(t,e)=>{if(t.startsWith("data:")){let o=K.exec(t);return o?atob(o[1]):null}let n=new URL(t,e).href;if(!G(e,n))return null;let i=await fetch(n);return i.ok?i.text():null},B=t=>{let e=[],n=[];for(let i of t){let o=A(i.map.mappings),r=i.offset.line,s=i.offset.column,a=e.length;for(;n.length<r+o.length;)n.push([]);for(let l=0;l<o.length;l++){let c=n[r+l];for(let u of o[l])c.push([l===0?u[0]+s:u[0],u[1]+a,u[2],u[3]]);}e.push(...i.map.sources);}for(let i of n)i.length>1&&i.sort((o,r)=>o[0]-r[0]);return {sources:e,mappings:n}},m=t=>{try{let e=JSON.parse(t);return Array.isArray(e.sections)?B(e.sections):!e.sources||!e.mappings?null:{sources:e.sources,mappings:A(e.mappings)}}catch{return null}},X=async t=>{try{let e=await fetch(t),i=(await e.text()).match(/\/\/[#@]\s*sourceMappingURL=([^\s]+)$/m);if(i){let s=await C(i[1].trim(),t);if(s){let a=m(s);if(a)return a}}let o=e.headers.get("SourceMap")??e.headers.get("X-SourceMap");if(o){let s=await C(o.trim(),t);if(s){let a=m(s);if(a)return a}}let r=await fetch(`${t}.map`);if(r.ok){let s=await r.text();return m(s)}return null}catch{return null}},z=/^webpack-internal:\/\/\//,D=/^about:\/\/React\/Server\/file:\/\/\//,$=/^about:\/\/React\/Server\/webpack-internal:\/\/\//,V=/[/\\](\.next[/\\].+?)(?:\?.*)?$/,Y=async t=>{try{let e=decodeURIComponent(t.replace(D,"")),n=V.exec(e);if(!n)return null;let o=`${typeof location<"u"?location.origin:""}/__nextjs_source-map?filename=${encodeURIComponent(n[1])}`,r=await fetch(o);if(!r.ok)return null;let s=await r.text();return s?m(s):null}catch{return null}},J=async t=>{try{let e=decodeURIComponent(t.replace($,"").replace(/\?.*$/,"")),i=`${typeof location<"u"?location.origin:""}/__nextjs_source-map?filename=${encodeURIComponent(e)}`,o=await fetch(i);if(!o.ok)return null;let r=await o.text();return r?m(r):null}catch{return null}},P=/sourceMappingURL=(data:application\/json[^"'\s\\]+)/g,Z=()=>{if(typeof performance>"u"||!performance.getEntriesByType)return [];let t=new Set,e=[];for(let n of performance.getEntriesByType("resource")){let i=n;!i.name.endsWith(".js")||t.has(i.name)||(t.add(i.name),e.push(i.name));}return e},Q=async t=>{try{let e=Z(),n=`sourceURL=${t}`;for(let i of e){let o=await fetch(i);if(!o.ok)continue;let r=await o.text(),s=r.indexOf(n);if(s===-1)continue;let a=r.substring(Math.max(0,s-2e5),s),l=null,c;for(P.lastIndex=0;(c=P.exec(a))!==null;)l=c[1];if(!l)continue;let u=await C(l,t);if(u)return m(u)}return null}catch{return null}},q=t=>{let e=g.get(t);if(!e){if(g.size>=100){let n=g.keys().next().value;g.delete(n);}$.test(t)?e=J(t):D.test(t)?e=Y(t):z.test(t)?e=Q(t):e=X(t),g.set(t,e);}return e},ee=(t,e,n)=>{if(e<0||e>=t.mappings.length)return null;let i=t.mappings[e];if(!i.length)return null;let o=0,r=i.length-1;for(;o<r;){let s=o+r+1>>1;i[s][0]<=n?o=s:r=s-1;}return i[o]},F=async(t,e,n)=>{let i=await q(t);if(!i)return null;let o=ee(i,e-1,n-1);if(!o)return null;let r=i.sources[o[1]];return r.startsWith("file:///")?r=decodeURIComponent(new URL(r).pathname):r.startsWith("webpack://")&&(r=r.replace(/^webpack:\/\/\/?\.\/?/,"")),r=r.replace(/^(?:\.\.\/)+/,""),{fileName:r,lineNumber:o[2]+1,columnNumber:o[3]+1}};var b=t=>"env"in t&&typeof t.name=="string",k=new Set([0,1,11,14,15]),te=t=>{try{let e=Object.keys(t).find(n=>n.startsWith("__reactFiber$"));return e?t[e]:null}catch{return null}},ne=t=>{let e=t;for(;e;){if(k.has(e.tag))return e;e=e.return;}return null},oe=t=>{if(typeof t=="function")return t;if(t&&typeof t=="object"){if("render"in t&&typeof t.render=="function")return t.render;if("type"in t&&typeof t.type=="function")return t.type}return null},x=t=>{let{type:e}=t;if(typeof e=="function")return e.displayName||e.name||"Anonymous";if(e&&typeof e=="object"){if("displayName"in e&&e.displayName)return e.displayName;let n=oe(e);if(n)return n.displayName||n.name||"Anonymous"}return "Anonymous"},E=new Set(["jsxDEV","jsxs","jsx","createElement","react-stack-top-frame","react_stack_bottom_frame","fakeJSXCallSite"]),ie=/at (?:(.+) \()?(.+):(\d+):(\d+)\)?$/,re=t=>{if(E.has(t))return true;let e=t.lastIndexOf(".");if(e!==-1){let i=t.substring(e+1).replace(/\s*\[.*$/,"");if(E.has(i))return true}let n=/\[as (\w+)\]/.exec(t);return n!==null&&E.has(n[1])},T=t=>{let e=t._debugStack?.stack;if(!e)return null;for(let n of e.split(`
|
|
2
|
+
`)){let i=ie.exec(n.trim());if(!i)continue;let[,o,r,s,a]=i;if(!(o&&re(o))&&!r.includes("/node_modules/"))return {url:r,line:Number(s),column:Number(a)}}return null},M=async t=>{let e=await F(t.url,t.line,t.column);if(e)return e;let n=t.url;try{let i=new URL(t.url);n=decodeURIComponent(i.pathname);let o=n.indexOf("?");o!==-1&&(n=n.substring(0,o));}catch{}return n=n.replace(/\.\.\//g,""),n.startsWith("/")&&(n=n.substring(1)),{fileName:n,lineNumber:t.line,columnNumber:t.column}},N=async t=>{if(t._debugSource)return t._debugSource;let e=t._debugOwner;if(e&&!b(e)&&e._debugSource)return e._debugSource;let n=T(t);if(n)return M(n);if(e&&!b(e)){let i=T(e);if(i)return M(i)}return null},L=async t=>{if(t._debugSource)return t._debugSource;let e=T(t);return e?M(e):null},R=async t=>{let e=te(t);if(!e)return null;let n=ne(e);if(!n)return null;if(e.return!=null&&k.has(e.return.tag))return {kind:"component",name:x(n),elementTag:null,source:await N(n),callSite:null};let o=e._debugOwner,r=typeof e.type=="string"?e.type:null;return o&&!b(o)&&o===n?{kind:"element",name:x(o),elementTag:r,source:await L(e),callSite:await N(n)}:{kind:"children",name:o&&b(o)?o.name:x(o&&!b(o)&&k.has(o.tag)?o:n),elementTag:r,source:await L(e),callSite:null}};var p={name:"#93c5fd",tag:"#a78bfa",path:"#71717a",pathActive:"#a1a1aa",pathDim:"#3f3f46",hint:"#52525b"},se={position:"fixed",pointerEvents:"none",zIndex:"2147483646",backgroundColor:"rgba(66, 135, 245, 0.15)",border:"1.5px solid rgba(66, 135, 245, 0.6)",borderRadius:"3px",display:"none",transition:"top 60ms ease-out, left 60ms ease-out, width 60ms ease-out, height 60ms ease-out"},le={position:"fixed",pointerEvents:"none",zIndex:"2147483647",display:"none",fontFamily:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace",fontSize:"12px",lineHeight:"1.4",color:"#e4e4e7",backgroundColor:"#18181b",border:"1px solid #3f3f46",borderRadius:"6px",padding:"4px 8px",whiteSpace:"nowrap",maxWidth:"500px",overflow:"hidden",textOverflow:"ellipsis",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},O=(t,e)=>{Object.assign(t.style,e);},S=t=>{let e=t.split("/");return e.length<=2?t:`.../${e.slice(-2).join("/")}`},h=(t,e)=>{let n=document.createElement("span");return n.textContent=t,Object.assign(n.style,e),n},v=class{highlight=null;tooltip=null;copiedTimer=null;init(){this.highlight||(this.highlight=document.createElement("div"),this.highlight.dataset.reactGrep="highlight",O(this.highlight,se),document.body.appendChild(this.highlight),this.tooltip=document.createElement("div"),this.tooltip.dataset.reactGrep="tooltip",O(this.tooltip,le),document.body.appendChild(this.tooltip));}show(e,n,i="source"){if(!this.highlight||!this.tooltip)return;let o=e.getBoundingClientRect();this.highlight.style.top=`${o.top}px`,this.highlight.style.left=`${o.left}px`,this.highlight.style.width=`${o.width}px`,this.highlight.style.height=`${o.height}px`,this.highlight.style.display="block",this.tooltip.textContent="",this.tooltip.appendChild(h(n.name,{color:p.name,fontWeight:"600"})),n.elementTag!=null&&(this.tooltip.appendChild(h(" > ",{color:p.path})),this.tooltip.appendChild(h(n.elementTag,{color:p.tag,fontWeight:"600"})));let r=n.source?`${n.source.fileName}:${n.source.lineNumber}`:null,s=n.callSite?`${n.callSite.fileName}:${n.callSite.lineNumber}`:null;if(r&&s){let u=i==="source"?p.pathActive:p.pathDim,H=i==="callSite"?p.pathActive:p.pathDim,U=d?"\u21E7":"Shift",j=S(r),W=S(s);this.tooltip.appendChild(h(` ${i==="callSite"?"(":""}${j}${i==="callSite"?")":""}`,{color:u})),this.tooltip.appendChild(h(` ${U} `,{color:p.hint})),this.tooltip.appendChild(h(`${i==="source"?"(":""}${W}${i==="source"?")":""}`,{color:H}));}else r&&this.tooltip.appendChild(h(` ${S(r)}`,{color:p.path}));let a=this.tooltip.getBoundingClientRect(),l=o.top-a.height-6,c=o.left;l<4&&(l=o.bottom+6),c+a.width>window.innerWidth-4&&(c=window.innerWidth-a.width-4),this.tooltip.style.top=`${l}px`,this.tooltip.style.left=`${Math.max(4,c)}px`,this.tooltip.style.display="block";}showCopied(e){this.tooltip&&(this.tooltip.textContent="",this.tooltip.appendChild(h("Copied!",{color:"#4ade80",fontWeight:"600"})),this.tooltip.appendChild(h(` ${S(e)}`,{color:"#a1a1aa"})),this.tooltip.style.display="block",this.copiedTimer&&clearTimeout(this.copiedTimer),this.copiedTimer=setTimeout(()=>this.hide(),1500));}hide(){this.highlight&&(this.highlight.style.display="none"),this.tooltip&&(this.tooltip.style.display="none");}destroy(){this.copiedTimer&&(clearTimeout(this.copiedTimer),this.copiedTimer=null),this.highlight?.remove(),this.tooltip?.remove(),this.highlight=null,this.tooltip=null;}};var w=class{overlay=new v;moveGeneration=0;clickGeneration=0;lastTarget=null;lastInfo=null;sourceToggled=false;shiftPressedClean=false;savedCursor="";boundHandlers;constructor(){this.boundHandlers={mousemove:this.handleMouseMove.bind(this),click:this.handleClick.bind(this),keydown:this.handleKeyDown.bind(this),keyup:this.handleKeyUp.bind(this)};}start(){window.addEventListener("mousemove",this.boundHandlers.mousemove),window.addEventListener("click",this.boundHandlers.click,true),window.addEventListener("keydown",this.boundHandlers.keydown),window.addEventListener("keyup",this.boundHandlers.keyup);}stop(){window.removeEventListener("mousemove",this.boundHandlers.mousemove),window.removeEventListener("click",this.boundHandlers.click,true),window.removeEventListener("keydown",this.boundHandlers.keydown),window.removeEventListener("keyup",this.boundHandlers.keyup),this.overlay.destroy(),this.restoreCursor(),this.lastTarget=null,this.lastInfo=null,this.sourceToggled=false,this.shiftPressedClean=false;}isModifierHeld(e){return d?e.metaKey:e.ctrlKey}async handleMouseMove(e){if(!this.isModifierHeld(e)){this.overlay.hide(),this.restoreCursor(),this.lastTarget=null,this.lastInfo=null;return}this.overlay.init(),this.setCrosshairCursor();let n=document.elementFromPoint(e.clientX,e.clientY);if(!n||n.closest("[data-react-grep]"))return;n!==this.lastTarget&&(this.sourceToggled=false);let i=++this.moveGeneration,o=await R(n);if(i===this.moveGeneration){if(!o){this.overlay.hide(),this.lastTarget=null,this.lastInfo=null;return}this.lastTarget=n,this.lastInfo=o,this.overlay.show(n,o,this.getActiveSource());}}async handleClick(e){if(!this.isModifierHeld(e)||!e.shiftKey)return;let n=document.elementFromPoint(e.clientX,e.clientY);if(!n||n.closest("[data-react-grep]"))return;e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.shiftPressedClean=false;let i=++this.clickGeneration,o=await R(n);if(i!==this.clickGeneration||!o)return;let r=this.getActiveCopySource(o);if(!r)return;let{fileName:s,lineNumber:a,columnNumber:l}=r,c=l!=null?`${s}:${a}:${l}`:`${s}:${a}`;await this.copyToClipboard(c),this.overlay.showCopied(c);}handleKeyDown(e){e.key==="Shift"&&this.isModifierHeld(e)&&(this.shiftPressedClean=true);}handleKeyUp(e){if(d&&e.key==="Meta"||!d&&e.key==="Control"){this.overlay.hide(),this.restoreCursor(),this.lastTarget=null,this.lastInfo=null;return}e.key==="Shift"&&this.shiftPressedClean&&this.lastTarget&&this.lastInfo&&this.lastInfo.callSite&&(this.sourceToggled=!this.sourceToggled,this.overlay.show(this.lastTarget,this.lastInfo,this.getActiveSource())),this.shiftPressedClean=false;}getActiveSource(){return this.sourceToggled?"callSite":"source"}getActiveCopySource(e){return this.sourceToggled&&e.callSite?e.callSite:e.source}setCrosshairCursor(){document.body.style.cursor!=="crosshair"&&(this.savedCursor=document.body.style.cursor,document.body.style.cursor="crosshair");}restoreCursor(){document.body.style.cursor==="crosshair"&&(document.body.style.cursor=this.savedCursor);}async copyToClipboard(e){try{await navigator.clipboard.writeText(e);}catch{}}};var f=null,ae=()=>{f||(f=new w,f.start());},ve=()=>{f&&(f.stop(),f=null);};if(typeof window<"u"){let t=()=>ae();document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t();}
|
|
3
|
+
exports.destroy=ve;exports.init=ae;return exports;})({});
|
package/dist/index.js
CHANGED
|
@@ -129,7 +129,9 @@ var fetchAndParse = async (url) => {
|
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
|
+
var WEBPACK_INTERNAL_RE = /^webpack-internal:\/\/\//;
|
|
132
133
|
var ABOUT_SERVER_RE = /^about:\/\/React\/Server\/file:\/\/\//;
|
|
134
|
+
var ABOUT_SERVER_WEBPACK_RE = /^about:\/\/React\/Server\/webpack-internal:\/\/\//;
|
|
133
135
|
var NEXT_DOTDIR_RE = /[/\\](\.next[/\\].+?)(?:\?.*)?$/;
|
|
134
136
|
var fetchAndParseServerFile = async (url) => {
|
|
135
137
|
try {
|
|
@@ -147,6 +149,59 @@ var fetchAndParseServerFile = async (url) => {
|
|
|
147
149
|
return null;
|
|
148
150
|
}
|
|
149
151
|
};
|
|
152
|
+
var fetchAndParseServerWebpackInternal = async (url) => {
|
|
153
|
+
try {
|
|
154
|
+
const modulePath = decodeURIComponent(
|
|
155
|
+
url.replace(ABOUT_SERVER_WEBPACK_RE, "").replace(/\?.*$/, "")
|
|
156
|
+
);
|
|
157
|
+
const origin = typeof location !== "undefined" ? location.origin : "";
|
|
158
|
+
const mapUrl = `${origin}/__nextjs_source-map?filename=${encodeURIComponent(modulePath)}`;
|
|
159
|
+
const res = await fetch(mapUrl);
|
|
160
|
+
if (!res.ok) return null;
|
|
161
|
+
const json = await res.text();
|
|
162
|
+
if (!json) return null;
|
|
163
|
+
return parseSourceMap(json);
|
|
164
|
+
} catch {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
var WEBPACK_SM_RE = /sourceMappingURL=(data:application\/json[^"'\s\\]+)/g;
|
|
169
|
+
var getScriptUrls = () => {
|
|
170
|
+
if (typeof performance === "undefined" || !performance.getEntriesByType) return [];
|
|
171
|
+
const seen = /* @__PURE__ */ new Set();
|
|
172
|
+
const urls = [];
|
|
173
|
+
for (const entry of performance.getEntriesByType("resource")) {
|
|
174
|
+
const re = entry;
|
|
175
|
+
if (!re.name.endsWith(".js") || seen.has(re.name)) continue;
|
|
176
|
+
seen.add(re.name);
|
|
177
|
+
urls.push(re.name);
|
|
178
|
+
}
|
|
179
|
+
return urls;
|
|
180
|
+
};
|
|
181
|
+
var fetchAndParseWebpackInternal = async (url) => {
|
|
182
|
+
try {
|
|
183
|
+
const scriptUrls = getScriptUrls();
|
|
184
|
+
const marker = `sourceURL=${url}`;
|
|
185
|
+
for (const scriptUrl of scriptUrls) {
|
|
186
|
+
const res = await fetch(scriptUrl);
|
|
187
|
+
if (!res.ok) continue;
|
|
188
|
+
const text = await res.text();
|
|
189
|
+
const markerIdx = text.indexOf(marker);
|
|
190
|
+
if (markerIdx === -1) continue;
|
|
191
|
+
const before = text.substring(Math.max(0, markerIdx - 2e5), markerIdx);
|
|
192
|
+
let lastRef = null;
|
|
193
|
+
let m;
|
|
194
|
+
WEBPACK_SM_RE.lastIndex = 0;
|
|
195
|
+
while ((m = WEBPACK_SM_RE.exec(before)) !== null) lastRef = m[1];
|
|
196
|
+
if (!lastRef) continue;
|
|
197
|
+
const json = await fetchSourceMapJson(lastRef, url);
|
|
198
|
+
if (json) return parseSourceMap(json);
|
|
199
|
+
}
|
|
200
|
+
return null;
|
|
201
|
+
} catch {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
150
205
|
var getSourceMap = (url) => {
|
|
151
206
|
let promise = cache.get(url);
|
|
152
207
|
if (!promise) {
|
|
@@ -154,7 +209,10 @@ var getSourceMap = (url) => {
|
|
|
154
209
|
const oldest = cache.keys().next().value;
|
|
155
210
|
cache.delete(oldest);
|
|
156
211
|
}
|
|
157
|
-
|
|
212
|
+
if (ABOUT_SERVER_WEBPACK_RE.test(url)) promise = fetchAndParseServerWebpackInternal(url);
|
|
213
|
+
else if (ABOUT_SERVER_RE.test(url)) promise = fetchAndParseServerFile(url);
|
|
214
|
+
else if (WEBPACK_INTERNAL_RE.test(url)) promise = fetchAndParseWebpackInternal(url);
|
|
215
|
+
else promise = fetchAndParse(url);
|
|
158
216
|
cache.set(url, promise);
|
|
159
217
|
}
|
|
160
218
|
return promise;
|
|
@@ -180,7 +238,10 @@ var resolveOriginalPosition = async (url, line, column) => {
|
|
|
180
238
|
let fileName = map.sources[seg[1]];
|
|
181
239
|
if (fileName.startsWith("file:///")) {
|
|
182
240
|
fileName = decodeURIComponent(new URL(fileName).pathname);
|
|
241
|
+
} else if (fileName.startsWith("webpack://")) {
|
|
242
|
+
fileName = fileName.replace(/^webpack:\/\/\/?\.\/?/, "");
|
|
183
243
|
}
|
|
244
|
+
fileName = fileName.replace(/^(?:\.\.\/)+/, "");
|
|
184
245
|
return {
|
|
185
246
|
fileName,
|
|
186
247
|
lineNumber: seg[2] + 1,
|
|
@@ -243,11 +304,22 @@ var SKIP_FRAMES = /* @__PURE__ */ new Set([
|
|
|
243
304
|
"jsxDEV",
|
|
244
305
|
"jsxs",
|
|
245
306
|
"jsx",
|
|
307
|
+
"createElement",
|
|
246
308
|
"react-stack-top-frame",
|
|
247
309
|
"react_stack_bottom_frame",
|
|
248
310
|
"fakeJSXCallSite"
|
|
249
311
|
]);
|
|
250
|
-
var FRAME_RE = /at (?:(
|
|
312
|
+
var FRAME_RE = /at (?:(.+) \()?(.+):(\d+):(\d+)\)?$/;
|
|
313
|
+
var isSkippedFn = (name) => {
|
|
314
|
+
if (SKIP_FRAMES.has(name)) return true;
|
|
315
|
+
const dotIdx = name.lastIndexOf(".");
|
|
316
|
+
if (dotIdx !== -1) {
|
|
317
|
+
const base = name.substring(dotIdx + 1).replace(/\s*\[.*$/, "");
|
|
318
|
+
if (SKIP_FRAMES.has(base)) return true;
|
|
319
|
+
}
|
|
320
|
+
const aliasMatch = /\[as (\w+)\]/.exec(name);
|
|
321
|
+
return aliasMatch !== null && SKIP_FRAMES.has(aliasMatch[1]);
|
|
322
|
+
};
|
|
251
323
|
var parseFirstUserFrame = (fiber) => {
|
|
252
324
|
const stack = fiber._debugStack?.stack;
|
|
253
325
|
if (!stack) return null;
|
|
@@ -255,7 +327,7 @@ var parseFirstUserFrame = (fiber) => {
|
|
|
255
327
|
const match = FRAME_RE.exec(line.trim());
|
|
256
328
|
if (!match) continue;
|
|
257
329
|
const [, fnName, url, lineStr, colStr] = match;
|
|
258
|
-
if (fnName &&
|
|
330
|
+
if (fnName && isSkippedFn(fnName)) continue;
|
|
259
331
|
if (url.includes("/node_modules/")) continue;
|
|
260
332
|
return { url, line: Number(lineStr), column: Number(colStr) };
|
|
261
333
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-grep",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Hold CMD to see React component names + file:line overlaid on any element",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component",
|
|
@@ -48,10 +48,16 @@
|
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsup",
|
|
50
50
|
"dev": "tsup --watch",
|
|
51
|
-
"check-types": "tsc --noEmit"
|
|
51
|
+
"check-types": "tsc --noEmit",
|
|
52
|
+
"test": "vitest run",
|
|
53
|
+
"test:watch": "vitest",
|
|
54
|
+
"test:coverage": "vitest run --coverage"
|
|
52
55
|
},
|
|
53
56
|
"devDependencies": {
|
|
57
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
58
|
+
"jsdom": "^28.0.0",
|
|
54
59
|
"tsup": "^8.2.4",
|
|
55
|
-
"typescript": "^5.7.0"
|
|
60
|
+
"typescript": "^5.7.0",
|
|
61
|
+
"vitest": "^4.0.18"
|
|
56
62
|
}
|
|
57
63
|
}
|