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/index.cjs
CHANGED
|
@@ -41,7 +41,7 @@ function _markReactElementSource(element, source) {
|
|
|
41
41
|
}
|
|
42
42
|
return element;
|
|
43
43
|
}
|
|
44
|
-
`;return ko.parse(e,{ecmaVersion:"latest",sourceType:"module"}).body[0]}function Yl(e,t){return{type:"CallExpression",callee:{type:"Identifier",name:"_markReactElementSource"},arguments:[e,{type:"Literal",value:t}],optional:!1}}function To(e,t){let{filename:s,projectRoot:r=process.cwd(),injectJsxSource:o=!0,injectComponentSource:h=!0}=t,p;try{p=Kl(s).parse(e,{ecmaVersion:"latest",sourceType:"module",locations:!0})}catch{return null}let g=!1,v=!1,l=new Set,T=[];if(wo(p,{enter(_,D){if(o&&_.type==="CallExpression"&&Xl(_)){let w=_.loc;w&&(this.replace(Yl(_,Qs(s,w.start,r))),v=!0,g=!0)}if(h&&_.type==="FunctionDeclaration"){let w=_.id?.name;w&&_o(w)&&!l.has(w)&&_.loc&&(T.push({node:_,parent:D,assignment:Eo(w,Qs(s,_.loc.start,r))}),l.add(w),g=!0)}if(h&&_.type==="VariableDeclarator"){let w=_.id;if(w.type==="Identifier"&&_o(w.name)&&!l.has(w.name)){let E=_.init;if(E&&Jl(E)){let F=_.loc||E.loc;F&&(T.push({node:_,parent:D,assignment:Eo(w.name,Qs(s,F.start,r))}),l.add(w.name),g=!0)}}}}}),!g)return null;if(v){let _=Ql();p.body.some(w=>w.type==="FunctionDeclaration"&&w.id?.name==="_markReactElementSource")||p.body.unshift(_)}for(let{node:_,parent:D,assignment:w}of T.reverse())if(D?.type==="Program"){let E=p.body.indexOf(_);E!==-1&&p.body.splice(E+1,0,w)}else if(D?.type==="ExportNamedDeclaration"){let E=p.body.find(F=>F.type==="ExportNamedDeclaration"&&F.declaration===D);E&&p.body.splice(p.body.indexOf(E)+1,0,w)}else D?.type==="ExportDefaultDeclaration"&&p.body.splice(p.body.indexOf(D)+1,0,w);return{code:So(p,{generator:zl})}}var Ys="virtual:react-code-locator/client",Po=`\0${Ys}`;function Zl(e={}){let t=JSON.stringify(e);return{name:"react-code-locator-client-injector",apply:"serve",resolveId(s){return s===Ys?Po:null},load(s){return s!==Po?null:`
|
|
44
|
+
`;return ko.parse(e,{ecmaVersion:"latest",sourceType:"module"}).body[0]}function Yl(e,t){return{type:"CallExpression",callee:{type:"Identifier",name:"_markReactElementSource"},arguments:[e,{type:"Literal",value:t}],optional:!1}}function To(e,t){let{filename:s,projectRoot:r=process.cwd(),injectJsxSource:o=!0,injectComponentSource:h=!0}=t,p;try{p=Kl(s).parse(e,{ecmaVersion:"latest",sourceType:"module",locations:!0})}catch{return null}let g=!1,v=!1,l=new Set,T=[];if(wo(p,{enter(_,D){if(o&&_.type==="CallExpression"&&Xl(_)){let w=_.loc;w&&(this.replace(Yl(_,Qs(s,w.start,r))),this.skip(),v=!0,g=!0)}if(h&&_.type==="FunctionDeclaration"){let w=_.id?.name;w&&_o(w)&&!l.has(w)&&_.loc&&(T.push({node:_,parent:D,assignment:Eo(w,Qs(s,_.loc.start,r))}),l.add(w),g=!0)}if(h&&_.type==="VariableDeclarator"){let w=_.id;if(w.type==="Identifier"&&_o(w.name)&&!l.has(w.name)){let E=_.init;if(E&&Jl(E)){let F=_.loc||E.loc;F&&(T.push({node:_,parent:D,assignment:Eo(w.name,Qs(s,F.start,r))}),l.add(w.name),g=!0)}}}}}),!g)return null;if(v){let _=Ql();p.body.some(w=>w.type==="FunctionDeclaration"&&w.id?.name==="_markReactElementSource")||p.body.unshift(_)}for(let{node:_,parent:D,assignment:w}of T.reverse())if(D?.type==="Program"){let E=p.body.indexOf(_);E!==-1&&p.body.splice(E+1,0,w)}else if(D?.type==="ExportNamedDeclaration"){let E=p.body.find(F=>F.type==="ExportNamedDeclaration"&&F.declaration===D);E&&p.body.splice(p.body.indexOf(E)+1,0,w)}else D?.type==="ExportDefaultDeclaration"&&p.body.splice(p.body.indexOf(D)+1,0,w);return{code:So(p,{generator:zl})}}var Ys="virtual:react-code-locator/client",Po=`\0${Ys}`;function Zl(e={}){let t=JSON.stringify(e);return{name:"react-code-locator-client-injector",apply:"serve",resolveId(s){return s===Ys?Po:null},load(s){return s!==Po?null:`
|
|
45
45
|
import { enableReactComponentJump } from "react-code-locator/client";
|
|
46
46
|
|
|
47
47
|
enableReactComponentJump(${t});
|