react-code-locator 0.2.1 → 0.2.2

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/unplugin.js CHANGED
@@ -41,7 +41,7 @@ function _markReactElementSource(element, source) {
41
41
  }
42
42
  return element;
43
43
  }
44
- `;return ao.parse(e,{ecmaVersion:"latest",sourceType:"module"}).body[0]}function Tl(e,t){return{type:"CallExpression",callee:{type:"Identifier",name:"_markReactElementSource"},arguments:[e,{type:"Literal",value:t}],optional:!1}}function no(e,t){let{filename:s,projectRoot:a=process.cwd(),injectJsxSource:o=!0,injectComponentSource:c=!0}=t,p;try{p=wl(s).parse(e,{ecmaVersion:"latest",sourceType:"module",locations:!0})}catch{return null}let g=!1,b=!1,l=new Set,P=[];if(Zn(p,{enter(_,B){if(o&&_.type==="CallExpression"&&Al(_)){let w=_.loc;w&&(this.replace(Tl(_,js(s,w.start,a))),b=!0,g=!0)}if(c&&_.type==="FunctionDeclaration"){let w=_.id?.name;w&&io(w)&&!l.has(w)&&_.loc&&(P.push({node:_,parent:B,assignment:so(w,js(s,_.loc.start,a))}),l.add(w),g=!0)}if(c&&_.type==="VariableDeclarator"){let w=_.id;if(w.type==="Identifier"&&io(w.name)&&!l.has(w.name)){let E=_.init;if(E&&El(E)){let D=_.loc||E.loc;D&&(P.push({node:_,parent:B,assignment:so(w.name,js(s,D.start,a))}),l.add(w.name),g=!0)}}}}}),!g)return null;if(b){let _=kl();p.body.some(w=>w.type==="FunctionDeclaration"&&w.id?.name==="_markReactElementSource")||p.body.unshift(_)}for(let{node:_,parent:B,assignment:w}of P.reverse())if(B?.type==="Program"){let E=p.body.indexOf(_);E!==-1&&p.body.splice(E+1,0,w)}else if(B?.type==="ExportNamedDeclaration"){let E=p.body.find(D=>D.type==="ExportNamedDeclaration"&&D.declaration===B);E&&p.body.splice(p.body.indexOf(E)+1,0,w)}else B?.type==="ExportDefaultDeclaration"&&p.body.splice(p.body.indexOf(B)+1,0,w);return{code:Qn(p,{generator:_l})}}var Us="virtual:react-code-locator/client",oo=`\0${Us}`;function Pl(e={}){let t=JSON.stringify(e);return{name:"react-code-locator-client-injector",apply:"serve",resolveId(s){return s===Us?oo:null},load(s){return s!==oo?null:`
44
+ `;return ao.parse(e,{ecmaVersion:"latest",sourceType:"module"}).body[0]}function Tl(e,t){return{type:"CallExpression",callee:{type:"Identifier",name:"_markReactElementSource"},arguments:[e,{type:"Literal",value:t}],optional:!1}}function no(e,t){let{filename:s,projectRoot:a=process.cwd(),injectJsxSource:o=!0,injectComponentSource:c=!0}=t,p;try{p=wl(s).parse(e,{ecmaVersion:"latest",sourceType:"module",locations:!0})}catch{return null}let g=!1,b=!1,l=new Set,P=[];if(Zn(p,{enter(_,B){if(o&&_.type==="CallExpression"&&Al(_)){let w=_.loc;w&&(this.replace(Tl(_,js(s,w.start,a))),this.skip(),b=!0,g=!0)}if(c&&_.type==="FunctionDeclaration"){let w=_.id?.name;w&&io(w)&&!l.has(w)&&_.loc&&(P.push({node:_,parent:B,assignment:so(w,js(s,_.loc.start,a))}),l.add(w),g=!0)}if(c&&_.type==="VariableDeclarator"){let w=_.id;if(w.type==="Identifier"&&io(w.name)&&!l.has(w.name)){let E=_.init;if(E&&El(E)){let D=_.loc||E.loc;D&&(P.push({node:_,parent:B,assignment:so(w.name,js(s,D.start,a))}),l.add(w.name),g=!0)}}}}}),!g)return null;if(b){let _=kl();p.body.some(w=>w.type==="FunctionDeclaration"&&w.id?.name==="_markReactElementSource")||p.body.unshift(_)}for(let{node:_,parent:B,assignment:w}of P.reverse())if(B?.type==="Program"){let E=p.body.indexOf(_);E!==-1&&p.body.splice(E+1,0,w)}else if(B?.type==="ExportNamedDeclaration"){let E=p.body.find(D=>D.type==="ExportNamedDeclaration"&&D.declaration===B);E&&p.body.splice(p.body.indexOf(E)+1,0,w)}else B?.type==="ExportDefaultDeclaration"&&p.body.splice(p.body.indexOf(B)+1,0,w);return{code:Qn(p,{generator:_l})}}var Us="virtual:react-code-locator/client",oo=`\0${Us}`;function Pl(e={}){let t=JSON.stringify(e);return{name:"react-code-locator-client-injector",apply:"serve",resolveId(s){return s===Us?oo:null},load(s){return s!==oo?null:`
45
45
  import { enableReactComponentJump } from "react-code-locator/client";
46
46
 
47
47
  enableReactComponentJump(${t});