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/webpack.js
CHANGED
|
@@ -41,5 +41,5 @@ function _markReactElementSource(element, source) {
|
|
|
41
41
|
}
|
|
42
42
|
return element;
|
|
43
43
|
}
|
|
44
|
-
`;return ao.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 no(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(Zn(p,{enter(_,B){if(o&&_.type==="CallExpression"&&wl(_)){let w=_.loc;w&&(this.replace(El(_,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&&_l(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 _=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:Qn(p,{generator:Cl})}}var kl="virtual:react-code-locator/client",tf=`\0${kl}`;var Tl=/\.([jt]sx)$/,Pl=/node_modules/;function Il(e,t,s){let a=Array.isArray(t)?t:[t];return(Array.isArray(s)?s:[s]).some(c=>c.test(e))?!1:a.some(c=>c.test(e))}var hi=ja((e={})=>{let{include:t=Tl,exclude:s=Pl,projectRoot:a=process.cwd(),injectComponentSource:o=!0,injectJsxSource:c=!0}=e;return{name:"react-code-locator",transform(p,g){return process.env.NODE_ENV!=="development"||!Il(g,t,s)?null:no(p,{filename:g,projectRoot:a,injectComponentSource:o,injectJsxSource:c})}}}),Us=hi;var uf=hi.webpack,hf=hi.rollup,cf=hi.esbuild,lf=hi.rspack;var df=Us.webpack,mf=Us.webpack;export{mf as default,df as webpackPlugin};
|
|
44
|
+
`;return ao.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 no(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(Zn(p,{enter(_,B){if(o&&_.type==="CallExpression"&&wl(_)){let w=_.loc;w&&(this.replace(El(_,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&&_l(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 _=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:Qn(p,{generator:Cl})}}var kl="virtual:react-code-locator/client",tf=`\0${kl}`;var Tl=/\.([jt]sx)$/,Pl=/node_modules/;function Il(e,t,s){let a=Array.isArray(t)?t:[t];return(Array.isArray(s)?s:[s]).some(c=>c.test(e))?!1:a.some(c=>c.test(e))}var hi=ja((e={})=>{let{include:t=Tl,exclude:s=Pl,projectRoot:a=process.cwd(),injectComponentSource:o=!0,injectJsxSource:c=!0}=e;return{name:"react-code-locator",transform(p,g){return process.env.NODE_ENV!=="development"||!Il(g,t,s)?null:no(p,{filename:g,projectRoot:a,injectComponentSource:o,injectJsxSource:c})}}}),Us=hi;var uf=hi.webpack,hf=hi.rollup,cf=hi.esbuild,lf=hi.rspack;var df=Us.webpack,mf=Us.webpack;export{mf as default,df as webpackPlugin};
|
|
45
45
|
//# sourceMappingURL=webpack.js.map
|