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/esbuild.cjs +1 -1
- package/dist/esbuild.cjs.map +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/esbuild.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/swc.cjs +1 -1
- package/dist/swc.cjs.map +1 -1
- package/dist/swc.js +1 -1
- package/dist/swc.js.map +1 -1
- package/dist/unplugin.cjs +1 -1
- package/dist/unplugin.cjs.map +1 -1
- package/dist/unplugin.js +1 -1
- package/dist/unplugin.js.map +1 -1
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.cjs.map +1 -1
- package/dist/webpack.js +1 -1
- package/dist/webpack.js.map +1 -1
- package/package.json +1 -1
package/dist/unplugin.cjs
CHANGED
|
@@ -41,7 +41,7 @@ function _markReactElementSource(element, source) {
|
|
|
41
41
|
}
|
|
42
42
|
return element;
|
|
43
43
|
}
|
|
44
|
-
`;return go.parse(e,{ecmaVersion:"latest",sourceType:"module"}).body[0]}function El(e,t){return{type:"CallExpression",callee:{type:"Identifier",name:"_markReactElementSource"},arguments:[e,{type:"Literal",value:t}],optional:!1}}function vo(e,t){let{filename:s,projectRoot:a=process.cwd(),injectJsxSource:o=!0,injectComponentSource:c=!0}=t,p;try{p=Sl(s).parse(e,{ecmaVersion:"latest",sourceType:"module",locations:!0})}catch{return null}let g=!1,b=!1,l=new Set,P=[];if(lo(p,{enter(_,B){if(o&&_.type==="CallExpression"&&wl(_)){let w=_.loc;w&&(this.replace(El(_,Ws(s,w.start,a))),b=!0,g=!0)}if(c&&_.type==="FunctionDeclaration"){let w=_.id?.name;w&&mo(w)&&!l.has(w)&&_.loc&&(P.push({node:_,parent:B,assignment:xo(w,Ws(s,_.loc.start,a))}),l.add(w),g=!0)}if(c&&_.type==="VariableDeclarator"){let w=_.id;if(w.type==="Identifier"&&mo(w.name)&&!l.has(w.name)){let E=_.init;if(E&&_l(E)){let D=_.loc||E.loc;D&&(P.push({node:_,parent:B,assignment:xo(w.name,Ws(s,D.start,a))}),l.add(w.name),g=!0)}}}}}),!g)return null;if(b){let _=Al();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:ho(p,{generator:Cl})}}var Gs="virtual:react-code-locator/client",bo=`\0${Gs}`;function kl(e={}){let t=JSON.stringify(e);return{name:"react-code-locator-client-injector",apply:"serve",resolveId(s){return s===Gs?bo:null},load(s){return s!==bo?null:`
|
|
44
|
+
`;return go.parse(e,{ecmaVersion:"latest",sourceType:"module"}).body[0]}function El(e,t){return{type:"CallExpression",callee:{type:"Identifier",name:"_markReactElementSource"},arguments:[e,{type:"Literal",value:t}],optional:!1}}function vo(e,t){let{filename:s,projectRoot:a=process.cwd(),injectJsxSource:o=!0,injectComponentSource:c=!0}=t,p;try{p=Sl(s).parse(e,{ecmaVersion:"latest",sourceType:"module",locations:!0})}catch{return null}let g=!1,b=!1,l=new Set,P=[];if(lo(p,{enter(_,B){if(o&&_.type==="CallExpression"&&wl(_)){let w=_.loc;w&&(this.replace(El(_,Ws(s,w.start,a))),this.skip(),b=!0,g=!0)}if(c&&_.type==="FunctionDeclaration"){let w=_.id?.name;w&&mo(w)&&!l.has(w)&&_.loc&&(P.push({node:_,parent:B,assignment:xo(w,Ws(s,_.loc.start,a))}),l.add(w),g=!0)}if(c&&_.type==="VariableDeclarator"){let w=_.id;if(w.type==="Identifier"&&mo(w.name)&&!l.has(w.name)){let E=_.init;if(E&&_l(E)){let D=_.loc||E.loc;D&&(P.push({node:_,parent:B,assignment:xo(w.name,Ws(s,D.start,a))}),l.add(w.name),g=!0)}}}}}),!g)return null;if(b){let _=Al();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:ho(p,{generator:Cl})}}var Gs="virtual:react-code-locator/client",bo=`\0${Gs}`;function kl(e={}){let t=JSON.stringify(e);return{name:"react-code-locator-client-injector",apply:"serve",resolveId(s){return s===Gs?bo:null},load(s){return s!==bo?null:`
|
|
45
45
|
import { enableReactComponentJump } from "react-code-locator/client";
|
|
46
46
|
|
|
47
47
|
enableReactComponentJump(${t});
|