@builder.io/dev-tools 1.66.0-beta.202606121644.47b75a5 → 1.66.0
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/cli/index.cjs +4 -4
- package/cli/index.cjs.map +3 -3
- package/core/index.cjs +1 -1
- package/core/index.mjs +1 -1
- package/node/index.cjs +1 -1
- package/node/index.mjs +1 -1
- package/package.json +1 -1
- package/server/index.cjs +3 -3
- package/server/index.mjs +3 -3
package/core/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Vi=Object.create;var xt=Object.defineProperty;var $i=Object.getOwnPropertyDescriptor;var Ki=Object.getOwnPropertyNames;var Mi=Object.getPrototypeOf,Ui=Object.prototype.hasOwnProperty;var zi=(e,t,r)=>t in e?xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ke=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qi=(e,t)=>{for(var r in t)xt(e,r,{get:t[r],enumerable:!0})},cr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ki(t))!Ui.call(e,o)&&o!==r&&xt(e,o,{get:()=>t[o],enumerable:!(n=$i(t,o))||n.enumerable});return e};var pr=(e,t,r)=>(r=e!=null?Vi(Mi(e)):{},cr(t||!e||!e.__esModule?xt(r,"default",{value:e,enumerable:!0}):r,e)),Ji=e=>cr(xt({},"__esModule",{value:!0}),e);var Ue=(e,t,r)=>zi(e,typeof t!="symbol"?t+"":t,r);var dr=ke((zc,fr)=>{"use strict";fr.exports=function(){if(process.env.npm_config_user_agent)return Gi(process.env.npm_config_user_agent)};function Gi(e){let t=e.split(" ")[0],r=t.lastIndexOf("/"),n=t.substring(0,r);return{name:n==="npminstall"?"cnpm":n,version:t.substring(r+1)}}});var Jn=ke(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.getType=ni;Lt.throwUnknownDataType=nc;Lt.throwUnsupportedData=rc;function ni(e){return Object.prototype.toString.call(e)}function nc(e){throw new TypeError("unsupported data type: "+ni(e))}function rc(e){throw new TypeError("unsupported data type: "+e)}});var an=ke(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.s_to_int=Gn;Ke.s_to_big_int=ri;Ke.int_to_s=Hn;Ke.big_int_to_s=oi;Ke.num_to_s=ai;Ke.int_str_to_s=on;Ke.s_to_num=si;var $e="";for(let e=0;e<10;e++){let t=String.fromCharCode(48+e);$e+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(65+e);$e+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(97+e);$e+=t}var Ct=$e.length,Qn={};for(let e=0;e<Ct;e++){let t=$e[e];Qn[t]=e}function Gn(e){let t=0,r=1;for(let n=e.length-1;n>=0;n--){let o=e[n],i=Qn[o];i*=r,t+=i,r*=Ct}return t}function ri(e){let t=BigInt(0),r=BigInt(1),n=BigInt(Ct);for(let o=e.length-1;o>=0;o--){let i=e[o],a=BigInt(Qn[i]);a*=r,t+=a,r*=n}return t}function Hn(e){if(e===0)return $e[0];let t=[];for(;e!==0;){let r=e%Ct,n=$e[r];t.push(n),e-=r,e/=Ct}return t.reverse().join("")}function oi(e){let t=BigInt(0),r=BigInt(Ct);if(e===t)return $e[0];let n=[];for(;e!==t;){let o=e%r,i=$e[Number(o)];n.push(i),e/=r}return n.reverse().join("")}function ii(e){return e.split("").reverse().join("")}function ai(e){if(e<0)return"-"+ai(-e);let[t,r]=e.toString().split(".");if(!r)if(t.includes("e")){let[i,a]=t.split("e");t=i,r="0e"+a}else return Hn(e);let n;r&&([r,n]=r.split("e")),t=on(t),r=ii(r),r=on(r);let o=t+"."+r;if(n){switch(o+=".",n[0]){case"+":n=n.slice(1);break;case"-":o+="-",n=n.slice(1);break}n=on(n),o+=n}return o}function on(e){let t=+e;return t.toString()===e&&t+1!==t&&t-1!==t?Hn(t):":"+oi(BigInt(e))}function Wn(e){return e[0]===":"?ri(e.substring(1)).toString():Gn(e).toString()}function si(e){if(e[0]==="-")return-si(e.substr(1));let[t,r,n]=e.split(".");if(!r)return Gn(t);t=Wn(t),r=Wn(r),r=ii(r);let o=t+"."+r;if(n){o+="e";let i=!1;n[0]==="-"&&(i=!0,n=n.slice(1)),n=Wn(n),o+=i?-n:+n}return+o}});var Xn=ke(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.encodeNum=oc;Me.decodeNum=ic;Me.decodeKey=ac;Me.encodeBool=sc;Me.decodeBool=uc;Me.encodeStr=cc;Me.decodeStr=pc;var Yn=an();function oc(e){return e===1/0?"N|+":e===-1/0?"N|-":Number.isNaN(e)?"N|0":"n|"+(0,Yn.num_to_s)(e)}function ic(e){if(e.length===3&&e[0]==="N"&&e[1]==="|")switch(e[2]){case"+":return 1/0;case"-":return-1/0;case"0":return NaN}return(0,Yn.s_to_num)(e.slice(2))}function ac(e){return typeof e=="number"?e:(0,Yn.s_to_int)(e)}function sc(e){return e?"b|T":"b|F"}function uc(e){if(e.length===3&&e[0]==="b"&&e[1]==="|")switch(e[2]){case"T":return!0;case"F":return!1}return!!e}function cc(e){if(e[1]==="|")switch(e[0]){case"b":case"o":case"n":case"a":case"s":return"s|"+e}return e}function pc(e){return e[0]==="s"&&e[1]==="|"?e.substr(2):e}});var Zn=ke(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.config=void 0;sn.config={sort_key:!1,preserve_nan:!1,error_on_nan:!1,preserve_infinite:!1,error_on_infinite:!1}});var tr=ke(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.memToValues=mc;ot.makeInMemoryStore=ui;ot.makeInMemoryCache=ci;ot.makeInMemoryMemory=fc;ot.addValue=_t;var rt=Zn(),un=Jn(),er=Xn(),lc=an();function mc(e){return e.store.toArray()}function ui(){let e=[];return{forEach(t){for(let r=0;r<e.length;r++)if(t(e[r])==="break")return},add(t){e.push(t)},toArray(){return e}}}function ci(){let e=Object.create(null),t=Object.create(null);return{getValue(r){return e[r]},getSchema(r){return t[r]},forEachValue(r){for(let[n,o]of Object.entries(e))if(r(n,o)==="break")return},forEachSchema(r){for(let[n,o]of Object.entries(t))if(r(n,o)==="break")return},setValue(r,n){e[r]=n},setSchema(r,n){t[r]=n},hasValue(r){return r in e},hasSchema(r){return r in t}}}function fc(){return{store:ui(),cache:ci(),keyCount:0}}function Oe(e,t){if(e.cache.hasValue(t))return e.cache.getValue(t);let r=e.keyCount++,n=(0,lc.num_to_s)(r);return e.store.add(t),e.cache.setValue(t,n),n}function dc(e,t){rt.config.sort_key&&t.sort();let r=t.join(",");if(e.cache.hasSchema(r))return e.cache.getSchema(r);let n=_t(e,t,void 0);return e.cache.setSchema(r,n),n}function _t(e,t,r){if(t===null)return"";switch(typeof t){case"undefined":if(Array.isArray(r))return _t(e,null,r);break;case"object":if(t===null)return Oe(e,null);if(Array.isArray(t)){let n="a";for(let o=0;o<t.length;o++){let i=t[o],a=i===null?"_":_t(e,i,t);n+="|"+a}return n==="a"&&(n="a|"),Oe(e,n)}else{let n=Object.keys(t);if(n.length===0)return Oe(e,"o|");let o="o",i=dc(e,n);o+="|"+i;for(let a of n){let s=t[a],u=_t(e,s,t);o+="|"+u}return Oe(e,o)}case"boolean":return Oe(e,(0,er.encodeBool)(t));case"number":return Number.isNaN(t)?rt.config.preserve_nan?Oe(e,"N|0"):(rt.config.error_on_nan&&(0,un.throwUnsupportedData)("[number NaN]"),""):Number.POSITIVE_INFINITY===t?rt.config.preserve_infinite?Oe(e,"N|+"):(rt.config.error_on_infinite&&(0,un.throwUnsupportedData)("[number Infinity]"),""):Number.NEGATIVE_INFINITY===t?rt.config.preserve_infinite?Oe(e,"N|-"):(rt.config.error_on_infinite&&(0,un.throwUnsupportedData)("[number -Infinity]"),""):Oe(e,(0,er.encodeNum)(t));case"string":return Oe(e,(0,er.encodeStr)(t))}return(0,un.throwUnknownDataType)(t)}});var or=ke(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.compress=Dc;Vt.decode=jt;Vt.decompress=hc;var nr=Jn(),pi=Xn(),rr=tr(),gc=an();function Dc(e){let t=(0,rr.makeInMemoryMemory)(),r=(0,rr.addValue)(t,e,void 0);return[(0,rr.memToValues)(t),r]}function Cc(e,t){if(t==="o|")return{};let r={},n=t.split("|"),o=n[1],i=jt(e,o),a=n.length;a-2===1&&!Array.isArray(i)&&(i=[i]);for(let s=2;s<a;s++){let u=i[s-2],c=n[s];c=jt(e,c),r[u]=c}return r}function xc(e,t){if(t==="a|")return[];let r=t.split("|"),n=r.length-1,o=new Array(n);for(let i=0;i<n;i++){let a=r[i+1];a=jt(e,a),o[i]=a}return o}function jt(e,t){if(t===""||t==="_")return null;let r=(0,pi.decodeKey)(t),n=e[r];if(n===null)return n;switch(typeof n){case"undefined":return n;case"number":return n;case"string":if(n[1]==="|")switch(n[0]){case"b":switch(n[2]){case"T":return!0;case"F":return!1;default:return(0,nr.throwUnknownDataType)(n)}case"o":return Cc(e,n);case"n":return(0,gc.s_to_num)(n.slice(2));case"N":switch(n[2]){case"+":return 1/0;case"-":return-1/0;case"0":return NaN;default:return(0,nr.throwUnknownDataType)(n)}case"a":return xc(e,n)}return(0,pi.decodeStr)(n)}return(0,nr.throwUnknownDataType)(n)}function hc(e){let[t,r]=e;return jt(t,r)}});var mi=ke(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.trimUndefined=Ec;cn.trimUndefinedRecursively=Sc;function Ec(e){for(let t in e)e[t]===void 0&&delete e[t]}function Sc(e){li(e,new Set)}function li(e,t){t.add(e);for(let r in e)if(e[r]===void 0)delete e[r];else{let n=e[r];n&&typeof n=="object"&&!t.has(n)&&li(n,t)}}});var gi=ke(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.config=Y.trimUndefinedRecursively=Y.trimUndefined=Y.addValue=Y.decode=Y.decompress=Y.compress=void 0;var fi=or();Object.defineProperty(Y,"compress",{enumerable:!0,get:function(){return fi.compress}});Object.defineProperty(Y,"decompress",{enumerable:!0,get:function(){return fi.decompress}});var Ac=or();Object.defineProperty(Y,"decode",{enumerable:!0,get:function(){return Ac.decode}});var Fc=tr();Object.defineProperty(Y,"addValue",{enumerable:!0,get:function(){return Fc.addValue}});var di=mi();Object.defineProperty(Y,"trimUndefined",{enumerable:!0,get:function(){return di.trimUndefined}});Object.defineProperty(Y,"trimUndefinedRecursively",{enumerable:!0,get:function(){return di.trimUndefinedRecursively}});var Pc=Zn();Object.defineProperty(Y,"config",{enumerable:!0,get:function(){return Pc.config}})});var $c={};qi($c,{createDevTools:()=>hi,createDevToolsSys:()=>Si,detectFrameworks:()=>ze,detectFrameworksFromPackageJson:()=>gn,ensureConfigPlugin:()=>ki,findBuildToolConfig:()=>ur,getClientScript:()=>ji,parseDotEnvContent:()=>Dn,version:()=>Kt});module.exports=Ji($c);var Wi="1.66.0-beta.202606121644.47b75a5",lr=process.env.OVERRIDE_VERSION??Wi;function ee(e){let t=e.join(e.getAppRootDir(),"tsconfig.json");return e.exists(t)}var Qi=["node_modules","dist","build","public"];async function re(e,t){async function r(o,i){if(i>10)return;let a=await e.readdir(o);for(let s of a){if(Qi.includes(s))continue;let u=e.join(o,s),c=await e.stat(u);if(c){if(c.isFile()&&s.startsWith("builder-registry."))return u;if(c.isDirectory()){let f=await r(u,i+1);if(f)return f}}}}let n=await r(e.getAppRootDir(),0);if(!n){let i=`builder-registry.${await ee(e)?"ts":"js"}`;return e.join(t,i)}return n}async function ht(e,t){let r=e.resolve("/");for(let n=0;n<20;n++){let o=e.join(t,"package.json"),i=await e.readFile(o);if(i)return JSON.parse(i);if(t===r)break;t=e.dirname(t)}return null}async function mr(e,t){for(let r=0;r<20;r++){let n=e.dirname(t),o=e.join(n,"node_modules");if(await e.exists(o))return o;if(t===e.getAppRootDir())break;t=e.dirname(t)}return e.join(e.getAppRootDir(),"node_modules")}async function Et(e,t,r){let n=await e.readdir(t);return n.includes(r)?e.join(t,r):(await Promise.all(n.map(async i=>{if(i.startsWith(".")||i==="node_modules")return;let a=e.join(t,i);if((await e.stat(a)).isDirectory()){let u=await Et(e,a,r);if(u)return u}}))).find(i=>typeof i=="string")}var Dr=pr(dr(),1);function Ee(e){return e.endsWith(".mapper.tsx")||e.endsWith(".mapper.jsx")||e.endsWith(".mapper.ts")||e.endsWith(".mapper.js")||e.endsWith(".mapper.mjs")}function R(e,t,r){t=Ce(t),r=Ce(r),t=e.dirname(t);let n=e.basename(r,e.extname(r));r=e.dirname(r);let o;return n==="index"?o=e.relative(t,r):o=e.relative(t,e.join(r,n)),o=Ce(e.normalize(o)),o.startsWith(".")||(o="./"+o),o}function Ce(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}function Ye(e,t){let r=e.extname(t),n=e.basename(t,r).split(/[\/\\]/),o=n[n.length-1];return gr(o==="index"?e.basename(e.dirname(t)):o)}function gr(e){return K(e).replace(/ /g,"")}function ce(e,t){let r=e.extname(t),n=Ce(e.basename(t,r)).split("/").pop();return K(n==="index"?e.basename(e.dirname(t)):n)}function M(e,t){let r=Ce(e.relative(e.getAppRootDir(),t));r=r.split("/").filter(o=>o!=="."&&o!==".."&&o!=="").join("/"),r.endsWith(".tsx")||r.endsWith(".jsx")?r=r.slice(0,-4):(r.endsWith(".ts")||r.endsWith(".js"))&&(r=r.slice(0,-3));let n=e.getFrameworks();return r.startsWith("src/")&&(r=r.slice(4)),n.some(o=>o.name.includes("next"))?"@/"+r:"~/"+r}function O(e,t){let r=t,n=[];for(let o=0;o<2;o++){let i=e.basename(r);if(!i||i==="components")break;n.unshift(i),r=e.dirname(r)}return n.join("/")}function K(e){for(e=e.replace(/([A-Z])/g," $1").replace(/\./g," ").replace(/_/g," ").replace(/-/g," ").replace(/\s/g," ").trim();e.includes(" ");)e=e.replace(/ /g," ");return e.split(" ").map(t=>t.length>2?t[0].toUpperCase()+t.slice(1):t).join("").trim()}function oe(e){return e.sort((t,r)=>t.name.toLocaleLowerCase().localeCompare(r.name.toLocaleLowerCase()))}async function V(e,t,r,n){if(typeof r!="string"||r==="")throw new Error(`getComponentId(), exportName must be a non-empty string, received: ${r}, ${t}`);return n&&(t=n),t=e.normalize(t),(await e.hash(t+"#"+r)).substring(0,8)}function St(e){return typeof e=="number"}function it(e){return typeof e=="boolean"}function te(e){return typeof e=="string"}function at(e){return typeof e=="string"?/^[A-Z][A-Za-z0-9]*$/.test(e):!1}function se(e){return JSON.parse(JSON.stringify(e))}function Mt(e,t,r){for(let n of t)if(e.dirname(r).includes(n))return!0;return!1}function Cr(){try{let e=(0,Dr.default)();if(e?.name)return e.name}catch{}return"npm"}async function ze(e){let t=[],r=await ht(e,e.getRepoRootDir());if(r){let n=await gn(r,e);t.push(...n)}return t}async function hr(e){let t=await ht(e,e.getRepoRootDir());return t?.scripts?.dev?t.scripts.dev.includes("--turbopack"):!1}async function gn(e,t){let r=[];if(e&&typeof e=="object"){let n=new Set(Object.keys({...e.dependencies,...e.devDependencies}));for(let o of Hi)if(n.has(o)&&!r.some(i=>i.name===o)){let i={name:o};xr.has(o)&&(i.version=await xr.get(o)(t)),r.push(i)}}return r}function dn(e){let t=parseInt(e);return Number.isNaN(t)?void 0:t}var xr=new Map([["next",async e=>{if(!e.spawnSync)return;let t=Cr(),r=t==="npm"?"npx":t,{stdout:n}=e.spawnSync(r,["next","-v"],{encoding:"utf8"});if(!n)return;let o=n.match(/(Next.js v)([\d.]+)/g);if(!o)return;let i=o[0].split("Next.js v")[1],[a,s,u]=i.split(".");return{major:dn(a),minor:dn(s),patch:dn(u)}}]]),Hi=["@shopify/remix-oxygen","@shopify/hydrogen","@builder.io/qwik-city","@remix-run/react","@sveltejs/kit","astro","gatsby","next","nuxt","@builder.io/qwik","@angular/core","react","solid-js","svelte","vue"];async function pe(e){let t=Er(e),r=await e.readFile(t);return typeof r=="string"?JSON.parse(r):{}}async function le(e,t){t=typeof t=="object"&&t!=null?t:{};let r=Er(e);await e.writeFile(r,JSON.stringify(t??{},null,2))}function Er(e){let t=e.getAppRootDir();return e.join(t,"node_modules",".builder","builder-cache.json")}async function Se(e,t,r){let n={envKey:r,envValue:null,file:""};for(let o of t){let i=e.join(e.getAppRootDir(),o),a=await Yi(e,i);if(a){let s=a[r];if(typeof s=="string"&&s.length>0&&s!=="YOUR_API_KEY")return n.envValue=s,n.file=i,n}}return n.file=e.join(e.getAppRootDir(),t[t.length-1]),n}async function Yi(e,t){let r=await e.readFile(t);return typeof r=="string"?Dn(r):null}function Dn(e){let t={},r=e.replace(/\r\n?/gm,`
|
|
1
|
+
"use strict";var Vi=Object.create;var xt=Object.defineProperty;var $i=Object.getOwnPropertyDescriptor;var Ki=Object.getOwnPropertyNames;var Mi=Object.getPrototypeOf,Ui=Object.prototype.hasOwnProperty;var zi=(e,t,r)=>t in e?xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ke=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qi=(e,t)=>{for(var r in t)xt(e,r,{get:t[r],enumerable:!0})},cr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ki(t))!Ui.call(e,o)&&o!==r&&xt(e,o,{get:()=>t[o],enumerable:!(n=$i(t,o))||n.enumerable});return e};var pr=(e,t,r)=>(r=e!=null?Vi(Mi(e)):{},cr(t||!e||!e.__esModule?xt(r,"default",{value:e,enumerable:!0}):r,e)),Ji=e=>cr(xt({},"__esModule",{value:!0}),e);var Ue=(e,t,r)=>zi(e,typeof t!="symbol"?t+"":t,r);var dr=ke((zc,fr)=>{"use strict";fr.exports=function(){if(process.env.npm_config_user_agent)return Gi(process.env.npm_config_user_agent)};function Gi(e){let t=e.split(" ")[0],r=t.lastIndexOf("/"),n=t.substring(0,r);return{name:n==="npminstall"?"cnpm":n,version:t.substring(r+1)}}});var Jn=ke(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.getType=ni;Lt.throwUnknownDataType=nc;Lt.throwUnsupportedData=rc;function ni(e){return Object.prototype.toString.call(e)}function nc(e){throw new TypeError("unsupported data type: "+ni(e))}function rc(e){throw new TypeError("unsupported data type: "+e)}});var an=ke(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.s_to_int=Gn;Ke.s_to_big_int=ri;Ke.int_to_s=Hn;Ke.big_int_to_s=oi;Ke.num_to_s=ai;Ke.int_str_to_s=on;Ke.s_to_num=si;var $e="";for(let e=0;e<10;e++){let t=String.fromCharCode(48+e);$e+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(65+e);$e+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(97+e);$e+=t}var Ct=$e.length,Qn={};for(let e=0;e<Ct;e++){let t=$e[e];Qn[t]=e}function Gn(e){let t=0,r=1;for(let n=e.length-1;n>=0;n--){let o=e[n],i=Qn[o];i*=r,t+=i,r*=Ct}return t}function ri(e){let t=BigInt(0),r=BigInt(1),n=BigInt(Ct);for(let o=e.length-1;o>=0;o--){let i=e[o],a=BigInt(Qn[i]);a*=r,t+=a,r*=n}return t}function Hn(e){if(e===0)return $e[0];let t=[];for(;e!==0;){let r=e%Ct,n=$e[r];t.push(n),e-=r,e/=Ct}return t.reverse().join("")}function oi(e){let t=BigInt(0),r=BigInt(Ct);if(e===t)return $e[0];let n=[];for(;e!==t;){let o=e%r,i=$e[Number(o)];n.push(i),e/=r}return n.reverse().join("")}function ii(e){return e.split("").reverse().join("")}function ai(e){if(e<0)return"-"+ai(-e);let[t,r]=e.toString().split(".");if(!r)if(t.includes("e")){let[i,a]=t.split("e");t=i,r="0e"+a}else return Hn(e);let n;r&&([r,n]=r.split("e")),t=on(t),r=ii(r),r=on(r);let o=t+"."+r;if(n){switch(o+=".",n[0]){case"+":n=n.slice(1);break;case"-":o+="-",n=n.slice(1);break}n=on(n),o+=n}return o}function on(e){let t=+e;return t.toString()===e&&t+1!==t&&t-1!==t?Hn(t):":"+oi(BigInt(e))}function Wn(e){return e[0]===":"?ri(e.substring(1)).toString():Gn(e).toString()}function si(e){if(e[0]==="-")return-si(e.substr(1));let[t,r,n]=e.split(".");if(!r)return Gn(t);t=Wn(t),r=Wn(r),r=ii(r);let o=t+"."+r;if(n){o+="e";let i=!1;n[0]==="-"&&(i=!0,n=n.slice(1)),n=Wn(n),o+=i?-n:+n}return+o}});var Xn=ke(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.encodeNum=oc;Me.decodeNum=ic;Me.decodeKey=ac;Me.encodeBool=sc;Me.decodeBool=uc;Me.encodeStr=cc;Me.decodeStr=pc;var Yn=an();function oc(e){return e===1/0?"N|+":e===-1/0?"N|-":Number.isNaN(e)?"N|0":"n|"+(0,Yn.num_to_s)(e)}function ic(e){if(e.length===3&&e[0]==="N"&&e[1]==="|")switch(e[2]){case"+":return 1/0;case"-":return-1/0;case"0":return NaN}return(0,Yn.s_to_num)(e.slice(2))}function ac(e){return typeof e=="number"?e:(0,Yn.s_to_int)(e)}function sc(e){return e?"b|T":"b|F"}function uc(e){if(e.length===3&&e[0]==="b"&&e[1]==="|")switch(e[2]){case"T":return!0;case"F":return!1}return!!e}function cc(e){if(e[1]==="|")switch(e[0]){case"b":case"o":case"n":case"a":case"s":return"s|"+e}return e}function pc(e){return e[0]==="s"&&e[1]==="|"?e.substr(2):e}});var Zn=ke(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.config=void 0;sn.config={sort_key:!1,preserve_nan:!1,error_on_nan:!1,preserve_infinite:!1,error_on_infinite:!1}});var tr=ke(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.memToValues=mc;ot.makeInMemoryStore=ui;ot.makeInMemoryCache=ci;ot.makeInMemoryMemory=fc;ot.addValue=_t;var rt=Zn(),un=Jn(),er=Xn(),lc=an();function mc(e){return e.store.toArray()}function ui(){let e=[];return{forEach(t){for(let r=0;r<e.length;r++)if(t(e[r])==="break")return},add(t){e.push(t)},toArray(){return e}}}function ci(){let e=Object.create(null),t=Object.create(null);return{getValue(r){return e[r]},getSchema(r){return t[r]},forEachValue(r){for(let[n,o]of Object.entries(e))if(r(n,o)==="break")return},forEachSchema(r){for(let[n,o]of Object.entries(t))if(r(n,o)==="break")return},setValue(r,n){e[r]=n},setSchema(r,n){t[r]=n},hasValue(r){return r in e},hasSchema(r){return r in t}}}function fc(){return{store:ui(),cache:ci(),keyCount:0}}function Oe(e,t){if(e.cache.hasValue(t))return e.cache.getValue(t);let r=e.keyCount++,n=(0,lc.num_to_s)(r);return e.store.add(t),e.cache.setValue(t,n),n}function dc(e,t){rt.config.sort_key&&t.sort();let r=t.join(",");if(e.cache.hasSchema(r))return e.cache.getSchema(r);let n=_t(e,t,void 0);return e.cache.setSchema(r,n),n}function _t(e,t,r){if(t===null)return"";switch(typeof t){case"undefined":if(Array.isArray(r))return _t(e,null,r);break;case"object":if(t===null)return Oe(e,null);if(Array.isArray(t)){let n="a";for(let o=0;o<t.length;o++){let i=t[o],a=i===null?"_":_t(e,i,t);n+="|"+a}return n==="a"&&(n="a|"),Oe(e,n)}else{let n=Object.keys(t);if(n.length===0)return Oe(e,"o|");let o="o",i=dc(e,n);o+="|"+i;for(let a of n){let s=t[a],u=_t(e,s,t);o+="|"+u}return Oe(e,o)}case"boolean":return Oe(e,(0,er.encodeBool)(t));case"number":return Number.isNaN(t)?rt.config.preserve_nan?Oe(e,"N|0"):(rt.config.error_on_nan&&(0,un.throwUnsupportedData)("[number NaN]"),""):Number.POSITIVE_INFINITY===t?rt.config.preserve_infinite?Oe(e,"N|+"):(rt.config.error_on_infinite&&(0,un.throwUnsupportedData)("[number Infinity]"),""):Number.NEGATIVE_INFINITY===t?rt.config.preserve_infinite?Oe(e,"N|-"):(rt.config.error_on_infinite&&(0,un.throwUnsupportedData)("[number -Infinity]"),""):Oe(e,(0,er.encodeNum)(t));case"string":return Oe(e,(0,er.encodeStr)(t))}return(0,un.throwUnknownDataType)(t)}});var or=ke(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.compress=Dc;Vt.decode=jt;Vt.decompress=hc;var nr=Jn(),pi=Xn(),rr=tr(),gc=an();function Dc(e){let t=(0,rr.makeInMemoryMemory)(),r=(0,rr.addValue)(t,e,void 0);return[(0,rr.memToValues)(t),r]}function Cc(e,t){if(t==="o|")return{};let r={},n=t.split("|"),o=n[1],i=jt(e,o),a=n.length;a-2===1&&!Array.isArray(i)&&(i=[i]);for(let s=2;s<a;s++){let u=i[s-2],c=n[s];c=jt(e,c),r[u]=c}return r}function xc(e,t){if(t==="a|")return[];let r=t.split("|"),n=r.length-1,o=new Array(n);for(let i=0;i<n;i++){let a=r[i+1];a=jt(e,a),o[i]=a}return o}function jt(e,t){if(t===""||t==="_")return null;let r=(0,pi.decodeKey)(t),n=e[r];if(n===null)return n;switch(typeof n){case"undefined":return n;case"number":return n;case"string":if(n[1]==="|")switch(n[0]){case"b":switch(n[2]){case"T":return!0;case"F":return!1;default:return(0,nr.throwUnknownDataType)(n)}case"o":return Cc(e,n);case"n":return(0,gc.s_to_num)(n.slice(2));case"N":switch(n[2]){case"+":return 1/0;case"-":return-1/0;case"0":return NaN;default:return(0,nr.throwUnknownDataType)(n)}case"a":return xc(e,n)}return(0,pi.decodeStr)(n)}return(0,nr.throwUnknownDataType)(n)}function hc(e){let[t,r]=e;return jt(t,r)}});var mi=ke(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.trimUndefined=Ec;cn.trimUndefinedRecursively=Sc;function Ec(e){for(let t in e)e[t]===void 0&&delete e[t]}function Sc(e){li(e,new Set)}function li(e,t){t.add(e);for(let r in e)if(e[r]===void 0)delete e[r];else{let n=e[r];n&&typeof n=="object"&&!t.has(n)&&li(n,t)}}});var gi=ke(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.config=Y.trimUndefinedRecursively=Y.trimUndefined=Y.addValue=Y.decode=Y.decompress=Y.compress=void 0;var fi=or();Object.defineProperty(Y,"compress",{enumerable:!0,get:function(){return fi.compress}});Object.defineProperty(Y,"decompress",{enumerable:!0,get:function(){return fi.decompress}});var Ac=or();Object.defineProperty(Y,"decode",{enumerable:!0,get:function(){return Ac.decode}});var Fc=tr();Object.defineProperty(Y,"addValue",{enumerable:!0,get:function(){return Fc.addValue}});var di=mi();Object.defineProperty(Y,"trimUndefined",{enumerable:!0,get:function(){return di.trimUndefined}});Object.defineProperty(Y,"trimUndefinedRecursively",{enumerable:!0,get:function(){return di.trimUndefinedRecursively}});var Pc=Zn();Object.defineProperty(Y,"config",{enumerable:!0,get:function(){return Pc.config}})});var $c={};qi($c,{createDevTools:()=>hi,createDevToolsSys:()=>Si,detectFrameworks:()=>ze,detectFrameworksFromPackageJson:()=>gn,ensureConfigPlugin:()=>ki,findBuildToolConfig:()=>ur,getClientScript:()=>ji,parseDotEnvContent:()=>Dn,version:()=>Kt});module.exports=Ji($c);var Wi="1.66.0",lr=process.env.OVERRIDE_VERSION??Wi;function ee(e){let t=e.join(e.getAppRootDir(),"tsconfig.json");return e.exists(t)}var Qi=["node_modules","dist","build","public"];async function re(e,t){async function r(o,i){if(i>10)return;let a=await e.readdir(o);for(let s of a){if(Qi.includes(s))continue;let u=e.join(o,s),c=await e.stat(u);if(c){if(c.isFile()&&s.startsWith("builder-registry."))return u;if(c.isDirectory()){let f=await r(u,i+1);if(f)return f}}}}let n=await r(e.getAppRootDir(),0);if(!n){let i=`builder-registry.${await ee(e)?"ts":"js"}`;return e.join(t,i)}return n}async function ht(e,t){let r=e.resolve("/");for(let n=0;n<20;n++){let o=e.join(t,"package.json"),i=await e.readFile(o);if(i)return JSON.parse(i);if(t===r)break;t=e.dirname(t)}return null}async function mr(e,t){for(let r=0;r<20;r++){let n=e.dirname(t),o=e.join(n,"node_modules");if(await e.exists(o))return o;if(t===e.getAppRootDir())break;t=e.dirname(t)}return e.join(e.getAppRootDir(),"node_modules")}async function Et(e,t,r){let n=await e.readdir(t);return n.includes(r)?e.join(t,r):(await Promise.all(n.map(async i=>{if(i.startsWith(".")||i==="node_modules")return;let a=e.join(t,i);if((await e.stat(a)).isDirectory()){let u=await Et(e,a,r);if(u)return u}}))).find(i=>typeof i=="string")}var Dr=pr(dr(),1);function Ee(e){return e.endsWith(".mapper.tsx")||e.endsWith(".mapper.jsx")||e.endsWith(".mapper.ts")||e.endsWith(".mapper.js")||e.endsWith(".mapper.mjs")}function R(e,t,r){t=Ce(t),r=Ce(r),t=e.dirname(t);let n=e.basename(r,e.extname(r));r=e.dirname(r);let o;return n==="index"?o=e.relative(t,r):o=e.relative(t,e.join(r,n)),o=Ce(e.normalize(o)),o.startsWith(".")||(o="./"+o),o}function Ce(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}function Ye(e,t){let r=e.extname(t),n=e.basename(t,r).split(/[\/\\]/),o=n[n.length-1];return gr(o==="index"?e.basename(e.dirname(t)):o)}function gr(e){return K(e).replace(/ /g,"")}function ce(e,t){let r=e.extname(t),n=Ce(e.basename(t,r)).split("/").pop();return K(n==="index"?e.basename(e.dirname(t)):n)}function M(e,t){let r=Ce(e.relative(e.getAppRootDir(),t));r=r.split("/").filter(o=>o!=="."&&o!==".."&&o!=="").join("/"),r.endsWith(".tsx")||r.endsWith(".jsx")?r=r.slice(0,-4):(r.endsWith(".ts")||r.endsWith(".js"))&&(r=r.slice(0,-3));let n=e.getFrameworks();return r.startsWith("src/")&&(r=r.slice(4)),n.some(o=>o.name.includes("next"))?"@/"+r:"~/"+r}function O(e,t){let r=t,n=[];for(let o=0;o<2;o++){let i=e.basename(r);if(!i||i==="components")break;n.unshift(i),r=e.dirname(r)}return n.join("/")}function K(e){for(e=e.replace(/([A-Z])/g," $1").replace(/\./g," ").replace(/_/g," ").replace(/-/g," ").replace(/\s/g," ").trim();e.includes(" ");)e=e.replace(/ /g," ");return e.split(" ").map(t=>t.length>2?t[0].toUpperCase()+t.slice(1):t).join("").trim()}function oe(e){return e.sort((t,r)=>t.name.toLocaleLowerCase().localeCompare(r.name.toLocaleLowerCase()))}async function V(e,t,r,n){if(typeof r!="string"||r==="")throw new Error(`getComponentId(), exportName must be a non-empty string, received: ${r}, ${t}`);return n&&(t=n),t=e.normalize(t),(await e.hash(t+"#"+r)).substring(0,8)}function St(e){return typeof e=="number"}function it(e){return typeof e=="boolean"}function te(e){return typeof e=="string"}function at(e){return typeof e=="string"?/^[A-Z][A-Za-z0-9]*$/.test(e):!1}function se(e){return JSON.parse(JSON.stringify(e))}function Mt(e,t,r){for(let n of t)if(e.dirname(r).includes(n))return!0;return!1}function Cr(){try{let e=(0,Dr.default)();if(e?.name)return e.name}catch{}return"npm"}async function ze(e){let t=[],r=await ht(e,e.getRepoRootDir());if(r){let n=await gn(r,e);t.push(...n)}return t}async function hr(e){let t=await ht(e,e.getRepoRootDir());return t?.scripts?.dev?t.scripts.dev.includes("--turbopack"):!1}async function gn(e,t){let r=[];if(e&&typeof e=="object"){let n=new Set(Object.keys({...e.dependencies,...e.devDependencies}));for(let o of Hi)if(n.has(o)&&!r.some(i=>i.name===o)){let i={name:o};xr.has(o)&&(i.version=await xr.get(o)(t)),r.push(i)}}return r}function dn(e){let t=parseInt(e);return Number.isNaN(t)?void 0:t}var xr=new Map([["next",async e=>{if(!e.spawnSync)return;let t=Cr(),r=t==="npm"?"npx":t,{stdout:n}=e.spawnSync(r,["next","-v"],{encoding:"utf8"});if(!n)return;let o=n.match(/(Next.js v)([\d.]+)/g);if(!o)return;let i=o[0].split("Next.js v")[1],[a,s,u]=i.split(".");return{major:dn(a),minor:dn(s),patch:dn(u)}}]]),Hi=["@shopify/remix-oxygen","@shopify/hydrogen","@builder.io/qwik-city","@remix-run/react","@sveltejs/kit","astro","gatsby","next","nuxt","@builder.io/qwik","@angular/core","react","solid-js","svelte","vue"];async function pe(e){let t=Er(e),r=await e.readFile(t);return typeof r=="string"?JSON.parse(r):{}}async function le(e,t){t=typeof t=="object"&&t!=null?t:{};let r=Er(e);await e.writeFile(r,JSON.stringify(t??{},null,2))}function Er(e){let t=e.getAppRootDir();return e.join(t,"node_modules",".builder","builder-cache.json")}async function Se(e,t,r){let n={envKey:r,envValue:null,file:""};for(let o of t){let i=e.join(e.getAppRootDir(),o),a=await Yi(e,i);if(a){let s=a[r];if(typeof s=="string"&&s.length>0&&s!=="YOUR_API_KEY")return n.envValue=s,n.file=i,n}}return n.file=e.join(e.getAppRootDir(),t[t.length-1]),n}async function Yi(e,t){let r=await e.readFile(t);return typeof r=="string"?Dn(r):null}function Dn(e){let t={},r=e.replace(/\r\n?/gm,`
|
|
2
2
|
`),n;for(;(n=Xi.exec(r))!=null;){let o=n[1],i=n[2]||"";i=i.trim();let a=i[0];i=i.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),a==='"'&&(i=i.replace(/\\n/g,`
|
|
3
3
|
`),i=i.replace(/\\r/g,"\r")),t[o]=i}return t}var Xi=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;async function Ae(e,t,r,n){let o="# https://www.builder.io/c/docs/using-your-api-key",i=await e.readFile(t);try{if(i)if(i.includes(r))if(i.includes(n))e.debug(`"${r}" with "${n}" already set in ${t}`);else return e.debug(`Replace "${r}" in ${t}`),i=i.replace(new RegExp(`${r}=.*`),`${r}=${n}`),await e.writeFile(t,i),"update";else return e.debug(`Append "${r}" to ${t}`),i+=`
|
|
4
4
|
|
package/core/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
var Oi=Object.create;var fn=Object.defineProperty;var ki=Object.getOwnPropertyDescriptor;var Li=Object.getOwnPropertyNames;var _i=Object.getPrototypeOf,ji=Object.prototype.hasOwnProperty;var Vi=(e,t,r)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ke=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $i=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Li(t))!ji.call(e,o)&&o!==r&&fn(e,o,{get:()=>t[o],enumerable:!(n=ki(t,o))||n.enumerable});return e};var ar=(e,t,r)=>(r=e!=null?Oi(_i(e)):{},$i(t||!e||!e.__esModule?fn(r,"default",{value:e,enumerable:!0}):r,e));var Ue=(e,t,r)=>Vi(e,typeof t!="symbol"?t+"":t,r);var pr=ke((Kc,cr)=>{"use strict";cr.exports=function(){if(process.env.npm_config_user_agent)return Ui(process.env.npm_config_user_agent)};function Ui(e){let t=e.split(" ")[0],r=t.lastIndexOf("/"),n=t.substring(0,r);return{name:n==="npminstall"?"cnpm":n,version:t.substring(r+1)}}});var zn=ke(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.getType=ei;kt.throwUnknownDataType=Hu;kt.throwUnsupportedData=Yu;function ei(e){return Object.prototype.toString.call(e)}function Hu(e){throw new TypeError("unsupported data type: "+ei(e))}function Yu(e){throw new TypeError("unsupported data type: "+e)}});var rn=ke(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.s_to_int=Wn;Ke.s_to_big_int=ti;Ke.int_to_s=Qn;Ke.big_int_to_s=ni;Ke.num_to_s=oi;Ke.int_str_to_s=nn;Ke.s_to_num=ii;var $e="";for(let e=0;e<10;e++){let t=String.fromCharCode(48+e);$e+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(65+e);$e+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(97+e);$e+=t}var Ct=$e.length,Jn={};for(let e=0;e<Ct;e++){let t=$e[e];Jn[t]=e}function Wn(e){let t=0,r=1;for(let n=e.length-1;n>=0;n--){let o=e[n],i=Jn[o];i*=r,t+=i,r*=Ct}return t}function ti(e){let t=BigInt(0),r=BigInt(1),n=BigInt(Ct);for(let o=e.length-1;o>=0;o--){let i=e[o],a=BigInt(Jn[i]);a*=r,t+=a,r*=n}return t}function Qn(e){if(e===0)return $e[0];let t=[];for(;e!==0;){let r=e%Ct,n=$e[r];t.push(n),e-=r,e/=Ct}return t.reverse().join("")}function ni(e){let t=BigInt(0),r=BigInt(Ct);if(e===t)return $e[0];let n=[];for(;e!==t;){let o=e%r,i=$e[Number(o)];n.push(i),e/=r}return n.reverse().join("")}function ri(e){return e.split("").reverse().join("")}function oi(e){if(e<0)return"-"+oi(-e);let[t,r]=e.toString().split(".");if(!r)if(t.includes("e")){let[i,a]=t.split("e");t=i,r="0e"+a}else return Qn(e);let n;r&&([r,n]=r.split("e")),t=nn(t),r=ri(r),r=nn(r);let o=t+"."+r;if(n){switch(o+=".",n[0]){case"+":n=n.slice(1);break;case"-":o+="-",n=n.slice(1);break}n=nn(n),o+=n}return o}function nn(e){let t=+e;return t.toString()===e&&t+1!==t&&t-1!==t?Qn(t):":"+ni(BigInt(e))}function qn(e){return e[0]===":"?ti(e.substring(1)).toString():Wn(e).toString()}function ii(e){if(e[0]==="-")return-ii(e.substr(1));let[t,r,n]=e.split(".");if(!r)return Wn(t);t=qn(t),r=qn(r),r=ri(r);let o=t+"."+r;if(n){o+="e";let i=!1;n[0]==="-"&&(i=!0,n=n.slice(1)),n=qn(n),o+=i?-n:+n}return+o}});var Hn=ke(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.encodeNum=Xu;Me.decodeNum=Zu;Me.decodeKey=ec;Me.encodeBool=tc;Me.decodeBool=nc;Me.encodeStr=rc;Me.decodeStr=oc;var Gn=rn();function Xu(e){return e===1/0?"N|+":e===-1/0?"N|-":Number.isNaN(e)?"N|0":"n|"+(0,Gn.num_to_s)(e)}function Zu(e){if(e.length===3&&e[0]==="N"&&e[1]==="|")switch(e[2]){case"+":return 1/0;case"-":return-1/0;case"0":return NaN}return(0,Gn.s_to_num)(e.slice(2))}function ec(e){return typeof e=="number"?e:(0,Gn.s_to_int)(e)}function tc(e){return e?"b|T":"b|F"}function nc(e){if(e.length===3&&e[0]==="b"&&e[1]==="|")switch(e[2]){case"T":return!0;case"F":return!1}return!!e}function rc(e){if(e[1]==="|")switch(e[0]){case"b":case"o":case"n":case"a":case"s":return"s|"+e}return e}function oc(e){return e[0]==="s"&&e[1]==="|"?e.substr(2):e}});var Yn=ke(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.config=void 0;on.config={sort_key:!1,preserve_nan:!1,error_on_nan:!1,preserve_infinite:!1,error_on_infinite:!1}});var Zn=ke(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.memToValues=ac;ot.makeInMemoryStore=ai;ot.makeInMemoryCache=si;ot.makeInMemoryMemory=sc;ot.addValue=Lt;var rt=Yn(),an=zn(),Xn=Hn(),ic=rn();function ac(e){return e.store.toArray()}function ai(){let e=[];return{forEach(t){for(let r=0;r<e.length;r++)if(t(e[r])==="break")return},add(t){e.push(t)},toArray(){return e}}}function si(){let e=Object.create(null),t=Object.create(null);return{getValue(r){return e[r]},getSchema(r){return t[r]},forEachValue(r){for(let[n,o]of Object.entries(e))if(r(n,o)==="break")return},forEachSchema(r){for(let[n,o]of Object.entries(t))if(r(n,o)==="break")return},setValue(r,n){e[r]=n},setSchema(r,n){t[r]=n},hasValue(r){return r in e},hasSchema(r){return r in t}}}function sc(){return{store:ai(),cache:si(),keyCount:0}}function Oe(e,t){if(e.cache.hasValue(t))return e.cache.getValue(t);let r=e.keyCount++,n=(0,ic.num_to_s)(r);return e.store.add(t),e.cache.setValue(t,n),n}function uc(e,t){rt.config.sort_key&&t.sort();let r=t.join(",");if(e.cache.hasSchema(r))return e.cache.getSchema(r);let n=Lt(e,t,void 0);return e.cache.setSchema(r,n),n}function Lt(e,t,r){if(t===null)return"";switch(typeof t){case"undefined":if(Array.isArray(r))return Lt(e,null,r);break;case"object":if(t===null)return Oe(e,null);if(Array.isArray(t)){let n="a";for(let o=0;o<t.length;o++){let i=t[o],a=i===null?"_":Lt(e,i,t);n+="|"+a}return n==="a"&&(n="a|"),Oe(e,n)}else{let n=Object.keys(t);if(n.length===0)return Oe(e,"o|");let o="o",i=uc(e,n);o+="|"+i;for(let a of n){let s=t[a],u=Lt(e,s,t);o+="|"+u}return Oe(e,o)}case"boolean":return Oe(e,(0,Xn.encodeBool)(t));case"number":return Number.isNaN(t)?rt.config.preserve_nan?Oe(e,"N|0"):(rt.config.error_on_nan&&(0,an.throwUnsupportedData)("[number NaN]"),""):Number.POSITIVE_INFINITY===t?rt.config.preserve_infinite?Oe(e,"N|+"):(rt.config.error_on_infinite&&(0,an.throwUnsupportedData)("[number Infinity]"),""):Number.NEGATIVE_INFINITY===t?rt.config.preserve_infinite?Oe(e,"N|-"):(rt.config.error_on_infinite&&(0,an.throwUnsupportedData)("[number -Infinity]"),""):Oe(e,(0,Xn.encodeNum)(t));case"string":return Oe(e,(0,Xn.encodeStr)(t))}return(0,an.throwUnknownDataType)(t)}});var nr=ke(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.compress=pc;jt.decode=_t;jt.decompress=fc;var er=zn(),ui=Hn(),tr=Zn(),cc=rn();function pc(e){let t=(0,tr.makeInMemoryMemory)(),r=(0,tr.addValue)(t,e,void 0);return[(0,tr.memToValues)(t),r]}function lc(e,t){if(t==="o|")return{};let r={},n=t.split("|"),o=n[1],i=_t(e,o),a=n.length;a-2===1&&!Array.isArray(i)&&(i=[i]);for(let s=2;s<a;s++){let u=i[s-2],c=n[s];c=_t(e,c),r[u]=c}return r}function mc(e,t){if(t==="a|")return[];let r=t.split("|"),n=r.length-1,o=new Array(n);for(let i=0;i<n;i++){let a=r[i+1];a=_t(e,a),o[i]=a}return o}function _t(e,t){if(t===""||t==="_")return null;let r=(0,ui.decodeKey)(t),n=e[r];if(n===null)return n;switch(typeof n){case"undefined":return n;case"number":return n;case"string":if(n[1]==="|")switch(n[0]){case"b":switch(n[2]){case"T":return!0;case"F":return!1;default:return(0,er.throwUnknownDataType)(n)}case"o":return lc(e,n);case"n":return(0,cc.s_to_num)(n.slice(2));case"N":switch(n[2]){case"+":return 1/0;case"-":return-1/0;case"0":return NaN;default:return(0,er.throwUnknownDataType)(n)}case"a":return mc(e,n)}return(0,ui.decodeStr)(n)}return(0,er.throwUnknownDataType)(n)}function fc(e){let[t,r]=e;return _t(t,r)}});var pi=ke(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.trimUndefined=dc;sn.trimUndefinedRecursively=gc;function dc(e){for(let t in e)e[t]===void 0&&delete e[t]}function gc(e){ci(e,new Set)}function ci(e,t){t.add(e);for(let r in e)if(e[r]===void 0)delete e[r];else{let n=e[r];n&&typeof n=="object"&&!t.has(n)&&ci(n,t)}}});var fi=ke(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.config=Y.trimUndefinedRecursively=Y.trimUndefined=Y.addValue=Y.decode=Y.decompress=Y.compress=void 0;var li=nr();Object.defineProperty(Y,"compress",{enumerable:!0,get:function(){return li.compress}});Object.defineProperty(Y,"decompress",{enumerable:!0,get:function(){return li.decompress}});var Dc=nr();Object.defineProperty(Y,"decode",{enumerable:!0,get:function(){return Dc.decode}});var Cc=Zn();Object.defineProperty(Y,"addValue",{enumerable:!0,get:function(){return Cc.addValue}});var mi=pi();Object.defineProperty(Y,"trimUndefined",{enumerable:!0,get:function(){return mi.trimUndefined}});Object.defineProperty(Y,"trimUndefinedRecursively",{enumerable:!0,get:function(){return mi.trimUndefinedRecursively}});var xc=Yn();Object.defineProperty(Y,"config",{enumerable:!0,get:function(){return xc.config}})});var Ki="1.66.0-beta.202606121644.47b75a5",sr=process.env.OVERRIDE_VERSION??Ki;function ee(e){let t=e.join(e.getAppRootDir(),"tsconfig.json");return e.exists(t)}var Mi=["node_modules","dist","build","public"];async function re(e,t){async function r(o,i){if(i>10)return;let a=await e.readdir(o);for(let s of a){if(Mi.includes(s))continue;let u=e.join(o,s),c=await e.stat(u);if(c){if(c.isFile()&&s.startsWith("builder-registry."))return u;if(c.isDirectory()){let f=await r(u,i+1);if(f)return f}}}}let n=await r(e.getAppRootDir(),0);if(!n){let i=`builder-registry.${await ee(e)?"ts":"js"}`;return e.join(t,i)}return n}async function xt(e,t){let r=e.resolve("/");for(let n=0;n<20;n++){let o=e.join(t,"package.json"),i=await e.readFile(o);if(i)return JSON.parse(i);if(t===r)break;t=e.dirname(t)}return null}async function ur(e,t){for(let r=0;r<20;r++){let n=e.dirname(t),o=e.join(n,"node_modules");if(await e.exists(o))return o;if(t===e.getAppRootDir())break;t=e.dirname(t)}return e.join(e.getAppRootDir(),"node_modules")}async function ht(e,t,r){let n=await e.readdir(t);return n.includes(r)?e.join(t,r):(await Promise.all(n.map(async i=>{if(i.startsWith(".")||i==="node_modules")return;let a=e.join(t,i);if((await e.stat(a)).isDirectory()){let u=await ht(e,a,r);if(u)return u}}))).find(i=>typeof i=="string")}var mr=ar(pr(),1);function Ee(e){return e.endsWith(".mapper.tsx")||e.endsWith(".mapper.jsx")||e.endsWith(".mapper.ts")||e.endsWith(".mapper.js")||e.endsWith(".mapper.mjs")}function R(e,t,r){t=Ce(t),r=Ce(r),t=e.dirname(t);let n=e.basename(r,e.extname(r));r=e.dirname(r);let o;return n==="index"?o=e.relative(t,r):o=e.relative(t,e.join(r,n)),o=Ce(e.normalize(o)),o.startsWith(".")||(o="./"+o),o}function Ce(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}function He(e,t){let r=e.extname(t),n=e.basename(t,r).split(/[\/\\]/),o=n[n.length-1];return lr(o==="index"?e.basename(e.dirname(t)):o)}function lr(e){return K(e).replace(/ /g,"")}function ce(e,t){let r=e.extname(t),n=Ce(e.basename(t,r)).split("/").pop();return K(n==="index"?e.basename(e.dirname(t)):n)}function M(e,t){let r=Ce(e.relative(e.getAppRootDir(),t));r=r.split("/").filter(o=>o!=="."&&o!==".."&&o!=="").join("/"),r.endsWith(".tsx")||r.endsWith(".jsx")?r=r.slice(0,-4):(r.endsWith(".ts")||r.endsWith(".js"))&&(r=r.slice(0,-3));let n=e.getFrameworks();return r.startsWith("src/")&&(r=r.slice(4)),n.some(o=>o.name.includes("next"))?"@/"+r:"~/"+r}function O(e,t){let r=t,n=[];for(let o=0;o<2;o++){let i=e.basename(r);if(!i||i==="components")break;n.unshift(i),r=e.dirname(r)}return n.join("/")}function K(e){for(e=e.replace(/([A-Z])/g," $1").replace(/\./g," ").replace(/_/g," ").replace(/-/g," ").replace(/\s/g," ").trim();e.includes(" ");)e=e.replace(/ /g," ");return e.split(" ").map(t=>t.length>2?t[0].toUpperCase()+t.slice(1):t).join("").trim()}function oe(e){return e.sort((t,r)=>t.name.toLocaleLowerCase().localeCompare(r.name.toLocaleLowerCase()))}async function V(e,t,r,n){if(typeof r!="string"||r==="")throw new Error(`getComponentId(), exportName must be a non-empty string, received: ${r}, ${t}`);return n&&(t=n),t=e.normalize(t),(await e.hash(t+"#"+r)).substring(0,8)}function Et(e){return typeof e=="number"}function it(e){return typeof e=="boolean"}function te(e){return typeof e=="string"}function at(e){return typeof e=="string"?/^[A-Z][A-Za-z0-9]*$/.test(e):!1}function se(e){return JSON.parse(JSON.stringify(e))}function $t(e,t,r){for(let n of t)if(e.dirname(r).includes(n))return!0;return!1}function fr(){try{let e=(0,mr.default)();if(e?.name)return e.name}catch{}return"npm"}async function Ye(e){let t=[],r=await xt(e,e.getRepoRootDir());if(r){let n=await Dr(r,e);t.push(...n)}return t}async function gr(e){let t=await xt(e,e.getRepoRootDir());return t?.scripts?.dev?t.scripts.dev.includes("--turbopack"):!1}async function Dr(e,t){let r=[];if(e&&typeof e=="object"){let n=new Set(Object.keys({...e.dependencies,...e.devDependencies}));for(let o of zi)if(n.has(o)&&!r.some(i=>i.name===o)){let i={name:o};dr.has(o)&&(i.version=await dr.get(o)(t)),r.push(i)}}return r}function dn(e){let t=parseInt(e);return Number.isNaN(t)?void 0:t}var dr=new Map([["next",async e=>{if(!e.spawnSync)return;let t=fr(),r=t==="npm"?"npx":t,{stdout:n}=e.spawnSync(r,["next","-v"],{encoding:"utf8"});if(!n)return;let o=n.match(/(Next.js v)([\d.]+)/g);if(!o)return;let i=o[0].split("Next.js v")[1],[a,s,u]=i.split(".");return{major:dn(a),minor:dn(s),patch:dn(u)}}]]),zi=["@shopify/remix-oxygen","@shopify/hydrogen","@builder.io/qwik-city","@remix-run/react","@sveltejs/kit","astro","gatsby","next","nuxt","@builder.io/qwik","@angular/core","react","solid-js","svelte","vue"];async function pe(e){let t=Cr(e),r=await e.readFile(t);return typeof r=="string"?JSON.parse(r):{}}async function le(e,t){t=typeof t=="object"&&t!=null?t:{};let r=Cr(e);await e.writeFile(r,JSON.stringify(t??{},null,2))}function Cr(e){let t=e.getAppRootDir();return e.join(t,"node_modules",".builder","builder-cache.json")}async function Se(e,t,r){let n={envKey:r,envValue:null,file:""};for(let o of t){let i=e.join(e.getAppRootDir(),o),a=await qi(e,i);if(a){let s=a[r];if(typeof s=="string"&&s.length>0&&s!=="YOUR_API_KEY")return n.envValue=s,n.file=i,n}}return n.file=e.join(e.getAppRootDir(),t[t.length-1]),n}async function qi(e,t){let r=await e.readFile(t);return typeof r=="string"?xr(r):null}function xr(e){let t={},r=e.replace(/\r\n?/gm,`
|
|
2
|
+
var Oi=Object.create;var fn=Object.defineProperty;var ki=Object.getOwnPropertyDescriptor;var Li=Object.getOwnPropertyNames;var _i=Object.getPrototypeOf,ji=Object.prototype.hasOwnProperty;var Vi=(e,t,r)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ke=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $i=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Li(t))!ji.call(e,o)&&o!==r&&fn(e,o,{get:()=>t[o],enumerable:!(n=ki(t,o))||n.enumerable});return e};var ar=(e,t,r)=>(r=e!=null?Oi(_i(e)):{},$i(t||!e||!e.__esModule?fn(r,"default",{value:e,enumerable:!0}):r,e));var Ue=(e,t,r)=>Vi(e,typeof t!="symbol"?t+"":t,r);var pr=ke((Kc,cr)=>{"use strict";cr.exports=function(){if(process.env.npm_config_user_agent)return Ui(process.env.npm_config_user_agent)};function Ui(e){let t=e.split(" ")[0],r=t.lastIndexOf("/"),n=t.substring(0,r);return{name:n==="npminstall"?"cnpm":n,version:t.substring(r+1)}}});var zn=ke(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.getType=ei;kt.throwUnknownDataType=Hu;kt.throwUnsupportedData=Yu;function ei(e){return Object.prototype.toString.call(e)}function Hu(e){throw new TypeError("unsupported data type: "+ei(e))}function Yu(e){throw new TypeError("unsupported data type: "+e)}});var rn=ke(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.s_to_int=Wn;Ke.s_to_big_int=ti;Ke.int_to_s=Qn;Ke.big_int_to_s=ni;Ke.num_to_s=oi;Ke.int_str_to_s=nn;Ke.s_to_num=ii;var $e="";for(let e=0;e<10;e++){let t=String.fromCharCode(48+e);$e+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(65+e);$e+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(97+e);$e+=t}var Ct=$e.length,Jn={};for(let e=0;e<Ct;e++){let t=$e[e];Jn[t]=e}function Wn(e){let t=0,r=1;for(let n=e.length-1;n>=0;n--){let o=e[n],i=Jn[o];i*=r,t+=i,r*=Ct}return t}function ti(e){let t=BigInt(0),r=BigInt(1),n=BigInt(Ct);for(let o=e.length-1;o>=0;o--){let i=e[o],a=BigInt(Jn[i]);a*=r,t+=a,r*=n}return t}function Qn(e){if(e===0)return $e[0];let t=[];for(;e!==0;){let r=e%Ct,n=$e[r];t.push(n),e-=r,e/=Ct}return t.reverse().join("")}function ni(e){let t=BigInt(0),r=BigInt(Ct);if(e===t)return $e[0];let n=[];for(;e!==t;){let o=e%r,i=$e[Number(o)];n.push(i),e/=r}return n.reverse().join("")}function ri(e){return e.split("").reverse().join("")}function oi(e){if(e<0)return"-"+oi(-e);let[t,r]=e.toString().split(".");if(!r)if(t.includes("e")){let[i,a]=t.split("e");t=i,r="0e"+a}else return Qn(e);let n;r&&([r,n]=r.split("e")),t=nn(t),r=ri(r),r=nn(r);let o=t+"."+r;if(n){switch(o+=".",n[0]){case"+":n=n.slice(1);break;case"-":o+="-",n=n.slice(1);break}n=nn(n),o+=n}return o}function nn(e){let t=+e;return t.toString()===e&&t+1!==t&&t-1!==t?Qn(t):":"+ni(BigInt(e))}function qn(e){return e[0]===":"?ti(e.substring(1)).toString():Wn(e).toString()}function ii(e){if(e[0]==="-")return-ii(e.substr(1));let[t,r,n]=e.split(".");if(!r)return Wn(t);t=qn(t),r=qn(r),r=ri(r);let o=t+"."+r;if(n){o+="e";let i=!1;n[0]==="-"&&(i=!0,n=n.slice(1)),n=qn(n),o+=i?-n:+n}return+o}});var Hn=ke(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.encodeNum=Xu;Me.decodeNum=Zu;Me.decodeKey=ec;Me.encodeBool=tc;Me.decodeBool=nc;Me.encodeStr=rc;Me.decodeStr=oc;var Gn=rn();function Xu(e){return e===1/0?"N|+":e===-1/0?"N|-":Number.isNaN(e)?"N|0":"n|"+(0,Gn.num_to_s)(e)}function Zu(e){if(e.length===3&&e[0]==="N"&&e[1]==="|")switch(e[2]){case"+":return 1/0;case"-":return-1/0;case"0":return NaN}return(0,Gn.s_to_num)(e.slice(2))}function ec(e){return typeof e=="number"?e:(0,Gn.s_to_int)(e)}function tc(e){return e?"b|T":"b|F"}function nc(e){if(e.length===3&&e[0]==="b"&&e[1]==="|")switch(e[2]){case"T":return!0;case"F":return!1}return!!e}function rc(e){if(e[1]==="|")switch(e[0]){case"b":case"o":case"n":case"a":case"s":return"s|"+e}return e}function oc(e){return e[0]==="s"&&e[1]==="|"?e.substr(2):e}});var Yn=ke(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.config=void 0;on.config={sort_key:!1,preserve_nan:!1,error_on_nan:!1,preserve_infinite:!1,error_on_infinite:!1}});var Zn=ke(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.memToValues=ac;ot.makeInMemoryStore=ai;ot.makeInMemoryCache=si;ot.makeInMemoryMemory=sc;ot.addValue=Lt;var rt=Yn(),an=zn(),Xn=Hn(),ic=rn();function ac(e){return e.store.toArray()}function ai(){let e=[];return{forEach(t){for(let r=0;r<e.length;r++)if(t(e[r])==="break")return},add(t){e.push(t)},toArray(){return e}}}function si(){let e=Object.create(null),t=Object.create(null);return{getValue(r){return e[r]},getSchema(r){return t[r]},forEachValue(r){for(let[n,o]of Object.entries(e))if(r(n,o)==="break")return},forEachSchema(r){for(let[n,o]of Object.entries(t))if(r(n,o)==="break")return},setValue(r,n){e[r]=n},setSchema(r,n){t[r]=n},hasValue(r){return r in e},hasSchema(r){return r in t}}}function sc(){return{store:ai(),cache:si(),keyCount:0}}function Oe(e,t){if(e.cache.hasValue(t))return e.cache.getValue(t);let r=e.keyCount++,n=(0,ic.num_to_s)(r);return e.store.add(t),e.cache.setValue(t,n),n}function uc(e,t){rt.config.sort_key&&t.sort();let r=t.join(",");if(e.cache.hasSchema(r))return e.cache.getSchema(r);let n=Lt(e,t,void 0);return e.cache.setSchema(r,n),n}function Lt(e,t,r){if(t===null)return"";switch(typeof t){case"undefined":if(Array.isArray(r))return Lt(e,null,r);break;case"object":if(t===null)return Oe(e,null);if(Array.isArray(t)){let n="a";for(let o=0;o<t.length;o++){let i=t[o],a=i===null?"_":Lt(e,i,t);n+="|"+a}return n==="a"&&(n="a|"),Oe(e,n)}else{let n=Object.keys(t);if(n.length===0)return Oe(e,"o|");let o="o",i=uc(e,n);o+="|"+i;for(let a of n){let s=t[a],u=Lt(e,s,t);o+="|"+u}return Oe(e,o)}case"boolean":return Oe(e,(0,Xn.encodeBool)(t));case"number":return Number.isNaN(t)?rt.config.preserve_nan?Oe(e,"N|0"):(rt.config.error_on_nan&&(0,an.throwUnsupportedData)("[number NaN]"),""):Number.POSITIVE_INFINITY===t?rt.config.preserve_infinite?Oe(e,"N|+"):(rt.config.error_on_infinite&&(0,an.throwUnsupportedData)("[number Infinity]"),""):Number.NEGATIVE_INFINITY===t?rt.config.preserve_infinite?Oe(e,"N|-"):(rt.config.error_on_infinite&&(0,an.throwUnsupportedData)("[number -Infinity]"),""):Oe(e,(0,Xn.encodeNum)(t));case"string":return Oe(e,(0,Xn.encodeStr)(t))}return(0,an.throwUnknownDataType)(t)}});var nr=ke(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.compress=pc;jt.decode=_t;jt.decompress=fc;var er=zn(),ui=Hn(),tr=Zn(),cc=rn();function pc(e){let t=(0,tr.makeInMemoryMemory)(),r=(0,tr.addValue)(t,e,void 0);return[(0,tr.memToValues)(t),r]}function lc(e,t){if(t==="o|")return{};let r={},n=t.split("|"),o=n[1],i=_t(e,o),a=n.length;a-2===1&&!Array.isArray(i)&&(i=[i]);for(let s=2;s<a;s++){let u=i[s-2],c=n[s];c=_t(e,c),r[u]=c}return r}function mc(e,t){if(t==="a|")return[];let r=t.split("|"),n=r.length-1,o=new Array(n);for(let i=0;i<n;i++){let a=r[i+1];a=_t(e,a),o[i]=a}return o}function _t(e,t){if(t===""||t==="_")return null;let r=(0,ui.decodeKey)(t),n=e[r];if(n===null)return n;switch(typeof n){case"undefined":return n;case"number":return n;case"string":if(n[1]==="|")switch(n[0]){case"b":switch(n[2]){case"T":return!0;case"F":return!1;default:return(0,er.throwUnknownDataType)(n)}case"o":return lc(e,n);case"n":return(0,cc.s_to_num)(n.slice(2));case"N":switch(n[2]){case"+":return 1/0;case"-":return-1/0;case"0":return NaN;default:return(0,er.throwUnknownDataType)(n)}case"a":return mc(e,n)}return(0,ui.decodeStr)(n)}return(0,er.throwUnknownDataType)(n)}function fc(e){let[t,r]=e;return _t(t,r)}});var pi=ke(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.trimUndefined=dc;sn.trimUndefinedRecursively=gc;function dc(e){for(let t in e)e[t]===void 0&&delete e[t]}function gc(e){ci(e,new Set)}function ci(e,t){t.add(e);for(let r in e)if(e[r]===void 0)delete e[r];else{let n=e[r];n&&typeof n=="object"&&!t.has(n)&&ci(n,t)}}});var fi=ke(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.config=Y.trimUndefinedRecursively=Y.trimUndefined=Y.addValue=Y.decode=Y.decompress=Y.compress=void 0;var li=nr();Object.defineProperty(Y,"compress",{enumerable:!0,get:function(){return li.compress}});Object.defineProperty(Y,"decompress",{enumerable:!0,get:function(){return li.decompress}});var Dc=nr();Object.defineProperty(Y,"decode",{enumerable:!0,get:function(){return Dc.decode}});var Cc=Zn();Object.defineProperty(Y,"addValue",{enumerable:!0,get:function(){return Cc.addValue}});var mi=pi();Object.defineProperty(Y,"trimUndefined",{enumerable:!0,get:function(){return mi.trimUndefined}});Object.defineProperty(Y,"trimUndefinedRecursively",{enumerable:!0,get:function(){return mi.trimUndefinedRecursively}});var xc=Yn();Object.defineProperty(Y,"config",{enumerable:!0,get:function(){return xc.config}})});var Ki="1.66.0",sr=process.env.OVERRIDE_VERSION??Ki;function ee(e){let t=e.join(e.getAppRootDir(),"tsconfig.json");return e.exists(t)}var Mi=["node_modules","dist","build","public"];async function re(e,t){async function r(o,i){if(i>10)return;let a=await e.readdir(o);for(let s of a){if(Mi.includes(s))continue;let u=e.join(o,s),c=await e.stat(u);if(c){if(c.isFile()&&s.startsWith("builder-registry."))return u;if(c.isDirectory()){let f=await r(u,i+1);if(f)return f}}}}let n=await r(e.getAppRootDir(),0);if(!n){let i=`builder-registry.${await ee(e)?"ts":"js"}`;return e.join(t,i)}return n}async function xt(e,t){let r=e.resolve("/");for(let n=0;n<20;n++){let o=e.join(t,"package.json"),i=await e.readFile(o);if(i)return JSON.parse(i);if(t===r)break;t=e.dirname(t)}return null}async function ur(e,t){for(let r=0;r<20;r++){let n=e.dirname(t),o=e.join(n,"node_modules");if(await e.exists(o))return o;if(t===e.getAppRootDir())break;t=e.dirname(t)}return e.join(e.getAppRootDir(),"node_modules")}async function ht(e,t,r){let n=await e.readdir(t);return n.includes(r)?e.join(t,r):(await Promise.all(n.map(async i=>{if(i.startsWith(".")||i==="node_modules")return;let a=e.join(t,i);if((await e.stat(a)).isDirectory()){let u=await ht(e,a,r);if(u)return u}}))).find(i=>typeof i=="string")}var mr=ar(pr(),1);function Ee(e){return e.endsWith(".mapper.tsx")||e.endsWith(".mapper.jsx")||e.endsWith(".mapper.ts")||e.endsWith(".mapper.js")||e.endsWith(".mapper.mjs")}function R(e,t,r){t=Ce(t),r=Ce(r),t=e.dirname(t);let n=e.basename(r,e.extname(r));r=e.dirname(r);let o;return n==="index"?o=e.relative(t,r):o=e.relative(t,e.join(r,n)),o=Ce(e.normalize(o)),o.startsWith(".")||(o="./"+o),o}function Ce(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}function He(e,t){let r=e.extname(t),n=e.basename(t,r).split(/[\/\\]/),o=n[n.length-1];return lr(o==="index"?e.basename(e.dirname(t)):o)}function lr(e){return K(e).replace(/ /g,"")}function ce(e,t){let r=e.extname(t),n=Ce(e.basename(t,r)).split("/").pop();return K(n==="index"?e.basename(e.dirname(t)):n)}function M(e,t){let r=Ce(e.relative(e.getAppRootDir(),t));r=r.split("/").filter(o=>o!=="."&&o!==".."&&o!=="").join("/"),r.endsWith(".tsx")||r.endsWith(".jsx")?r=r.slice(0,-4):(r.endsWith(".ts")||r.endsWith(".js"))&&(r=r.slice(0,-3));let n=e.getFrameworks();return r.startsWith("src/")&&(r=r.slice(4)),n.some(o=>o.name.includes("next"))?"@/"+r:"~/"+r}function O(e,t){let r=t,n=[];for(let o=0;o<2;o++){let i=e.basename(r);if(!i||i==="components")break;n.unshift(i),r=e.dirname(r)}return n.join("/")}function K(e){for(e=e.replace(/([A-Z])/g," $1").replace(/\./g," ").replace(/_/g," ").replace(/-/g," ").replace(/\s/g," ").trim();e.includes(" ");)e=e.replace(/ /g," ");return e.split(" ").map(t=>t.length>2?t[0].toUpperCase()+t.slice(1):t).join("").trim()}function oe(e){return e.sort((t,r)=>t.name.toLocaleLowerCase().localeCompare(r.name.toLocaleLowerCase()))}async function V(e,t,r,n){if(typeof r!="string"||r==="")throw new Error(`getComponentId(), exportName must be a non-empty string, received: ${r}, ${t}`);return n&&(t=n),t=e.normalize(t),(await e.hash(t+"#"+r)).substring(0,8)}function Et(e){return typeof e=="number"}function it(e){return typeof e=="boolean"}function te(e){return typeof e=="string"}function at(e){return typeof e=="string"?/^[A-Z][A-Za-z0-9]*$/.test(e):!1}function se(e){return JSON.parse(JSON.stringify(e))}function $t(e,t,r){for(let n of t)if(e.dirname(r).includes(n))return!0;return!1}function fr(){try{let e=(0,mr.default)();if(e?.name)return e.name}catch{}return"npm"}async function Ye(e){let t=[],r=await xt(e,e.getRepoRootDir());if(r){let n=await Dr(r,e);t.push(...n)}return t}async function gr(e){let t=await xt(e,e.getRepoRootDir());return t?.scripts?.dev?t.scripts.dev.includes("--turbopack"):!1}async function Dr(e,t){let r=[];if(e&&typeof e=="object"){let n=new Set(Object.keys({...e.dependencies,...e.devDependencies}));for(let o of zi)if(n.has(o)&&!r.some(i=>i.name===o)){let i={name:o};dr.has(o)&&(i.version=await dr.get(o)(t)),r.push(i)}}return r}function dn(e){let t=parseInt(e);return Number.isNaN(t)?void 0:t}var dr=new Map([["next",async e=>{if(!e.spawnSync)return;let t=fr(),r=t==="npm"?"npx":t,{stdout:n}=e.spawnSync(r,["next","-v"],{encoding:"utf8"});if(!n)return;let o=n.match(/(Next.js v)([\d.]+)/g);if(!o)return;let i=o[0].split("Next.js v")[1],[a,s,u]=i.split(".");return{major:dn(a),minor:dn(s),patch:dn(u)}}]]),zi=["@shopify/remix-oxygen","@shopify/hydrogen","@builder.io/qwik-city","@remix-run/react","@sveltejs/kit","astro","gatsby","next","nuxt","@builder.io/qwik","@angular/core","react","solid-js","svelte","vue"];async function pe(e){let t=Cr(e),r=await e.readFile(t);return typeof r=="string"?JSON.parse(r):{}}async function le(e,t){t=typeof t=="object"&&t!=null?t:{};let r=Cr(e);await e.writeFile(r,JSON.stringify(t??{},null,2))}function Cr(e){let t=e.getAppRootDir();return e.join(t,"node_modules",".builder","builder-cache.json")}async function Se(e,t,r){let n={envKey:r,envValue:null,file:""};for(let o of t){let i=e.join(e.getAppRootDir(),o),a=await qi(e,i);if(a){let s=a[r];if(typeof s=="string"&&s.length>0&&s!=="YOUR_API_KEY")return n.envValue=s,n.file=i,n}}return n.file=e.join(e.getAppRootDir(),t[t.length-1]),n}async function qi(e,t){let r=await e.readFile(t);return typeof r=="string"?xr(r):null}function xr(e){let t={},r=e.replace(/\r\n?/gm,`
|
|
3
3
|
`),n;for(;(n=Ji.exec(r))!=null;){let o=n[1],i=n[2]||"";i=i.trim();let a=i[0];i=i.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),a==='"'&&(i=i.replace(/\\n/g,`
|
|
4
4
|
`),i=i.replace(/\\r/g,"\r")),t[o]=i}return t}var Ji=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;async function Ae(e,t,r,n){let o="# https://www.builder.io/c/docs/using-your-api-key",i=await e.readFile(t);try{if(i)if(i.includes(r))if(i.includes(n))e.debug(`"${r}" with "${n}" already set in ${t}`);else return e.debug(`Replace "${r}" in ${t}`),i=i.replace(new RegExp(`${r}=.*`),`${r}=${n}`),await e.writeFile(t,i),"update";else return e.debug(`Append "${r}" to ${t}`),i+=`
|
|
5
5
|
|
package/node/index.cjs
CHANGED
|
@@ -104,5 +104,5 @@ ${" ".repeat(6+r)}^`),l));s+=`
|
|
|
104
104
|
${c.join(`
|
|
105
105
|
`)}
|
|
106
106
|
`}this.message=s}},Nl=new Set(["Literal","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","BigIntLiteral"]),xn=new Set(["string","number","boolean","bigint","symbol","undefined"]),se=$e;function kl(i){return/^[$A-Z_a-z][\w$]*$/.test(i)}var wr="__magicast_proxy";function ae(i,s=new Set){if(i===void 0)return se.identifier("undefined");if(i===null)return se.literal(null);if(xn.has(typeof i))return se.literal(i);if(s.has(i))throw new oe("Can not serialize circular reference");if(s.add(i),i[wr])return i.$ast;if(i instanceof RegExp){let e=se.regExpLiteral(i.source,i.flags);return delete e.extra.raw,e}return i instanceof Set?se.newExpression(se.identifier("Set"),[se.arrayExpression([...i].map(e=>ae(e,s)))]):i instanceof Date?se.newExpression(se.identifier("Date"),[se.literal(i.toISOString())]):i instanceof Map?se.newExpression(se.identifier("Map"),[se.arrayExpression([...i].map(([e,t])=>se.arrayExpression([ae(e,s),ae(t,s)])))]):Array.isArray(i)?se.arrayExpression(i.map(e=>ae(e,s))):typeof i=="object"?se.objectExpression(Object.entries(i).map(([e,t])=>se.property("init",/^[$A-Z_a-z][\w$]*$/g.test(e)?se.identifier(e):se.literal(e),ae(t,s)))):se.literal(i)}function gs(i,s={}){let e=s;return e[wr]=!0,e.$ast=i,e.$type||(e.$type="object"),e}var Ll={enumerable:!0,configurable:!0};function be(i,s,e){let t=gs(i,s);return new Proxy({},{ownKeys(){return Object.keys(t).filter(r=>r!==wr&&!r.startsWith("$"))},getOwnPropertyDescriptor(){return Ll},has(r,n){return n in t},...e,get(r,n,a){if(n in t)return t[n];if(e.get)return e.get(r,n,a)},set(r,n,a,o){return n in t?(t[n]=a,!0):e.set?e.set(r,n,a,o):!1}})}var de=$e,or=new WeakMap;function Ol(i,s,e){if(or.has(s))return or.get(s);let t=be(s,{get $declaration(){return i},get imported(){return s.type==="ImportDefaultSpecifier"?"default":s.type==="ImportNamespaceSpecifier"?"*":s.imported.type==="Identifier"?s.imported.name:s.imported.value},set imported(r){if(s.type!=="ImportSpecifier")throw new oe("Changing import name is not yet implemented");s.imported.type==="Identifier"?s.imported.name=r:s.imported.value=r},get local(){return s.local.name},set local(r){s.local.name=r},get from(){return i.source.value},set from(r){if(r===i.source.value)return;i.specifiers=i.specifiers.filter(a=>a!==s),i.specifiers.length===0&&(e.body=e.body.filter(a=>a!==i));let n=e.body.find(a=>a.type==="ImportDeclaration"&&a.source.value===r);n?n.specifiers.push(s):e.body.unshift(de.importDeclaration([s],de.stringLiteral(r)))},toJSON(){return{imported:this.imported,local:this.local,from:this.from}}},{ownKeys(){return["imported","local","from","toJSON"]}});return or.set(s,t),t}function Dl(i,s){let e=()=>{let n=[];for(let a of i.body)if(a.type==="ImportDeclaration")for(let o of a.specifiers)n.push(Ol(a,o,i));return n},t=(n,a,o)=>{let c=e(),l=c.find(d=>d.local===n),u=a.local||n;if(l)return l.imported=a.imported,l.local=u,l.from=a.from,!0;let h=a.imported==="default"?de.importDefaultSpecifier(de.identifier(u)):a.imported==="*"?de.importNamespaceSpecifier(de.identifier(u)):de.importSpecifier(de.identifier(a.imported),de.identifier(u)),m=c.find(d=>d.from===a.from)?.$declaration;if(m)m.specifiers.push(h);else if(o==="prepend"||c.length===0)i.body.unshift(de.importDeclaration([h],de.stringLiteral(a.from)));else{let d=c.at(-1).$declaration,p=i.body.indexOf(d);i.body.splice(p+1,0,de.importDeclaration([h],de.stringLiteral(a.from)))}return!0},r=n=>{let a=e().find(l=>l.local===n);if(!a)return!1;let o=a.$declaration,c=a.$ast;return o.specifiers=o.specifiers.filter(l=>l!==c),o.specifiers.length===0&&(i.body=i.body.filter(l=>l!==o)),!0};return be(i,{$type:"imports",$add(n){t(n.local||n.imported,n,"prepend")},$prepend(n){t(n.local||n.imported,n,"prepend")},$append(n){t(n.local||n.imported,n,"append")},get $items(){return e()},toJSON(){return e().reduce((n,a)=>(n[a.local]=a,n),{})}},{get(n,a){return e().find(o=>o.local===a)},set(n,a,o){return t(a,o,"prepend")},deleteProperty(n,a){return r(a)},ownKeys(){return e().map(n=>n.local)},has(n,a){return e().some(o=>o.local===a)}})}function dt(i,s,e){let t=gs(i,{$type:"array",push(r){s.push(ae(r))},pop(){return ie(s.pop(),e)},unshift(r){s.unshift(ae(r))},shift(){return ie(s.shift(),e)},splice(r,n,...a){return s.splice(r,n,...a.map(o=>ae(o))).map(o=>ie(o,e))},toJSON(){return s.map(r=>ie(r,e))}});return new Proxy([],{get(r,n,a){if(n in t)return t[n];let o=a;if(n==="map")return l=>{let u=[],h=0;for(let m of o)u.push(l(m,h,o)),h++;return u};if(n==="filter")return l=>{let u=[],h=0;for(let m of o)l(m,h,o)&&u.push(m),h++;return u};if(n==="forEach")return l=>{let u=0;for(let h of o)l(h,u,o),u++};if(n==="reduce")return(l,...u)=>{let h=[...o];if(h.length===0&&u.length===0)throw new TypeError("Reduce of empty array with no initial value");let m,d=0;u.length>0?m=u[0]:(m=h[0],d=1);for(let p=d;p<h.length;p++)m=l(m,h[p],p,h);return m};if(n==="find")return l=>{let u=0;for(let h of o){if(l(h,u,o))return h;u++}};if(n==="findIndex")return l=>{let u=0;for(let h of o){if(l(h,u,o))return u;u++}return-1};if(n==="includes")return(l,u)=>[...o].includes(l,u);if(n==="length")return s.length;if(n===Symbol.iterator)return function*(){for(let l of s)yield ie(l,e)};if(typeof n=="symbol")return Reflect.get(r,n,a);let c=+n;if(!Number.isNaN(c)){let l=s[c];if(l)return ie(l,e)}return Reflect.get(r,n,a)},set(r,n,a,o){if(typeof n=="symbol")return Reflect.set(r,n,a,o);let c=+n;return Number.isNaN(c)?Reflect.set(r,n,a,o):(s[c]=ae(a),!0)},deleteProperty(r,n){if(typeof n=="symbol")return Reflect.deleteProperty(r,n);let a=+n;return Number.isNaN(a)?Reflect.deleteProperty(r,n):(s[a]=ae(void 0),!0)},ownKeys(){return["length",...s.map((r,n)=>n.toString())]},getOwnPropertyDescriptor(r,n){if(n in t)return{configurable:!0,enumerable:!0,value:t[n]};if(n==="length")return{value:s.length,writable:!0,enumerable:!1,configurable:!1};if(typeof n=="symbol")return Reflect.getOwnPropertyDescriptor(r,n);let a=+n;return!Number.isNaN(a)&&a<s.length?{value:ie(s[a],e),writable:!0,enumerable:!0,configurable:!0}:Reflect.getOwnPropertyDescriptor(r,n)}})}function Ml(i,s){if("elements"in i)return dt(i,i.elements,s)}function bn(i,s){if(i.type!=="CallExpression")throw new oe("Not a function call");function e(r){if(r.type==="Identifier")return r.name;if(r.type==="MemberExpression")return`${e(r.object)}.${e(r.property)}`;throw new oe("Not implemented")}let t=dt(i,i.arguments,s);return be(i,{$type:"function-call",$callee:e(i.callee),$args:t},{})}function Fl(i,s){if(i.type!=="ArrowFunctionExpression")throw new oe("Not an arrow function expression");let e=gs(i,{$type:"arrow-function-expression",$params:dt(i,i.params,s),$body:ie(i.body,s)});return new Proxy(()=>{},{get(t,r,n){return r in e?e[r]:Reflect.get(t,r,n)},apply(){throw new oe("Calling proxified functions is not supported. Use `generateCode` to get the code string.")}})}var Xe=$e;function _l(i,s){if(!("properties"in i))return;let e=(n,a=!1)=>{let o=n.type;if(o==="Property"||o==="ObjectProperty"||o==="ObjectMethod"){let c=n.key;if(c.type==="Identifier")return c.name;if(c.type==="StringLiteral"||c.type==="NumericLiteral"||c.type==="BooleanLiteral")return c.value.toString()}if(a)throw new oe(`Casting "${n.type}" is not supported`,{ast:n,code:s?.$code})},t=n=>{let a=String(n);for(let o of i.properties)if(e(o)===a){let c=o.type;if(c==="Property"||c==="ObjectProperty")return o.value;if(o.type==="ObjectMethod"){let l=Xe.functionExpression(null,o.params,o.body,o.generator,o.async);return l.async=o.async,l.loc=o.loc,l}}},r=(n,a)=>{let o=i.properties.find(c=>e(c)===n);if(o){let c=o.type;if(c==="Property"||c==="ObjectProperty")o.value=a;else if(o.type==="ObjectMethod"){let l=Xe.property("init",Xe.identifier(n),a),u=i.properties.indexOf(o);u!==-1&&(i.properties[u]=l)}}else{let c=Xe.property("init",kl(n)?Xe.identifier(n):Xe.stringLiteral(n),a);i.properties.push(c)}};return be(i,{$type:"object",toJSON(){return i.properties.reduce((n,a)=>{let o=e(a);if(o){let c=a.type;if(c==="Property"||c==="ObjectProperty")n[o]=ie(a.value,s);else if(a.type==="ObjectMethod"){let l=Xe.functionExpression(null,a.params,a.body,a.generator,a.async);l.async=a.async,l.loc=a.loc,n[o]=ie(l,s)}}return n},{})}},{get(n,a){let o=t(a);if(o)return ie(o,s)},set(n,a,o){return typeof a!="string"&&(a=String(a)),r(a,ae(o)),!0},deleteProperty(n,a){typeof a!="string"&&(a=String(a));let o=i.properties.findIndex(c=>e(c)===a);return o!==-1&&i.properties.splice(o,1),!0},ownKeys(){return i.properties.map(n=>e(n)).filter(Boolean)},getOwnPropertyDescriptor(n,a){if(typeof a=="string"&&Array.from(this.ownKeys(n)).includes(a))return{enumerable:!0,configurable:!0}},has(n,a){return typeof a=="string"?Array.from(this.ownKeys(n)).includes(a):!1}})}function Tn(i,s){if(i.type!=="NewExpression")throw new oe("Not a new expression");function e(r){if(r.type==="Identifier")return r.name;if(r.type==="MemberExpression")return`${e(r.object)}.${e(r.property)}`;throw new oe("Not implemented")}let t=dt(i,i.arguments,s);return be(i,{$type:"new-expression",$callee:e(i.callee),$args:t},{})}function Bl(i){if(i.type!=="Identifier")throw new oe("Not an identifier");return be(i,{$type:"identifier",$name:i.name},{})}function jl(i){if(i.type!=="LogicalExpression")throw new oe("Not a logical expression");return be(i,{$type:"logicalExpression"},{})}function Rl(i,s){if(i.type!=="MemberExpression")throw new oe("Not a member expression");return be(i,{$type:"member-expression",$object:ie(i.object,s),$property:ie(i.property,s)},{})}function Pn(i,s){return be(i,{$type:"binary-expression",$left:ie(i.left,s),$right:ie(i.right,s),$operator:i.operator},{})}function Ul(i,s){return be(i,{$type:"block-statement",$body:dt(i,i.body,s)},{})}function Vl(i,s){let e=gs(i,{$type:"function-expression",$params:dt(i,i.params,s),$body:ie(i.body,s)});return new Proxy(()=>{},{get(t,r,n){return r in e?e[r]:Reflect.get(t,r,n)},apply(){throw new oe("Calling proxified functions is not supported. Use `generateCode` to get the code string.")}})}var lr=new WeakMap;function ie(i,s){if(xn.has(typeof i))return i;if(i.type==="Identifier"&&i.name==="undefined")return;if(i.type==="RegExpLiteral"){let{pattern:t,flags:r}=i;return new RegExp(t,r)}if(Nl.has(i.type))return i.value;if(lr.has(i))return lr.get(i);let e;switch(i.type){case"ObjectExpression":e=_l(i,s);break;case"ArrayExpression":e=Ml(i,s);break;case"CallExpression":e=bn(i,s);break;case"ArrowFunctionExpression":e=Fl(i,s);break;case"FunctionExpression":e=Vl(i,s);break;case"NewExpression":e=Tn(i,s);break;case"Identifier":e=Bl(i);break;case"LogicalExpression":e=jl(i);break;case"MemberExpression":e=Rl(i);break;case"BinaryExpression":e=Pn(i,s);break;case"BlockStatement":e=Ul(i,s);break;case"TSAsExpression":case"TSSatisfiesExpression":e=ie(i.expression,s);break;default:throw new oe(`Casting "${i.type}" is not supported`,{ast:i,code:s?.$code})}return lr.set(i,e),e}var Ne=$e;function ql(i,s){let e=r=>{let n=r==="default"?"ExportDefaultDeclaration":"ExportNamedDeclaration";for(let a of i.body)if(a.type===n){if(r==="default")return a.declaration;if(a.declaration){if(a.declaration.type==="VariableDeclaration"){let o=a.declaration.declarations[0];if("name"in o.id&&o.id.name===r)return o.init}if(a.declaration.type==="FunctionDeclaration"&&a.declaration.id&&a.declaration.id.name===r){let o=a.declaration,c=Ne.functionExpression(o.id,o.params,o.body,o.generator,o.async);return c.async=o.async,c.loc=o.loc,c}}}},t=(r,n)=>{let a=r==="default"?"ExportDefaultDeclaration":"ExportNamedDeclaration",o=ae(n);for(let c of i.body)if(c.type===a){if(r==="default"){c.declaration=o;return}if(c.declaration){if(c.declaration.type==="VariableDeclaration"){let l=c.declaration.declarations[0];if("name"in l.id&&l.id.name===r){l.init=o;return}}if(c.declaration.type==="FunctionDeclaration"&&c.declaration.id&&c.declaration.id.name===r){let l=Ne.exportNamedDeclaration(Ne.variableDeclaration("const",[Ne.variableDeclarator(Ne.identifier(r),o)])),u=i.body.indexOf(c);u!==-1&&(i.body[u]=l);return}}}i.body.push(r==="default"?Ne.exportDefaultDeclaration(o):Ne.exportNamedDeclaration(Ne.variableDeclaration("const",[Ne.variableDeclarator(Ne.identifier(r),o)])))};return be(i,{$type:"exports"},{get(r,n){let a=e(n);if(a)return ie(a,s)},set(r,n,a){return t(n,a),!0},ownKeys(){return i.body.flatMap(r=>{if(r.type==="ExportDefaultDeclaration")return["default"];if(r.type==="ExportNamedDeclaration"&&r.declaration){if(r.declaration.type==="VariableDeclaration")return r.declaration.declarations.map(n=>"name"in n.id?n.id.name:"");if(r.declaration.type==="FunctionDeclaration")return r.declaration.id?[r.declaration.id.name]:[]}return[]}).filter(Boolean)},deleteProperty(r,n){let a=n==="default"?"ExportDefaultDeclaration":"ExportNamedDeclaration";for(let o=0;o<i.body.length;o++){let c=i.body[o];if(c.type===a){if(n==="default")return i.body.splice(o,1),!0;if(c.declaration){if(c.declaration.type==="VariableDeclaration"){let l=c.declaration.declarations[0];if("name"in l.id&&l.id.name===n)return i.body.splice(o,1),!0}if(c.declaration.type==="FunctionDeclaration"&&c.declaration.id&&c.declaration.id.name===n)return i.body.splice(o,1),!0}}}return!1}})}function zl(i,s){let e=i.program;if(e.type!=="Program")throw new oe(`Cannot proxify ${i.type} as module`);let t={$code:s,$type:"module"},r=be(e,t,{ownKeys(){return["imports","exports","generate"]}});return t.exports=ql(e,r),t.imports=Dl(e,r),t.generate=n=>xs(r,n),r}function Er(i,s={}){let e={wrapColumn:s.wrapColumn===void 0,indent:s.tabWidth===void 0||s.useTabs===void 0,quote:s.quote===void 0,arrowParens:s.arrowParensAlways===void 0,trailingComma:s.trailingComma===void 0},t=2,r=0,n=0,a=0,o=0,c=/(?<doubleQuote>"[^"]+")|(?<singleQuote>'[^']+')|(?<singleParam>\([^),]+\)\s*=>)|(?<trailingComma>,\s*[\]}])/g,l={doubleQuote:0,singleQuote:0,singleParam:0,trailingComma:0},u=(i||"").split(`
|
|
107
|
-
`),h=!1;for(let m of u){let d=m.trim();if(d.length!==0){if(e.wrapColumn&&m.length>a&&(a=m.length),e.indent){let p=m.match(/^\s+/)?.[0]||"";p.length>0&&(p.length>0&&p.length<t&&(t=p.length),p[0]===" "?r++:p.length>0&&r--)}if(d.at(-1)===";"?n++:d.length>0&&n--,e.quote||e.arrowParens){let p=d.matchAll(c);for(let y of p)if(y.groups)for(let f in l)y.groups[f]&&l[f]++}e.trailingComma&&((m.startsWith("}")||m.startsWith("]"))&&(h?o++:o--),h=d.endsWith(","))}}return{wrapColumn:a,useTabs:r>0,tabWidth:t,quote:l.singleQuote>l.doubleQuote?"single":"double",arrowParensAlways:l.singleParam>0,trailingComma:o>0||l.trailingComma>0,useSemi:n>0,arrayBracketSpacing:void 0,objectCurlySpacing:void 0,...s}}var Wl=$e;function Ar(i,s){return zl(an(i,{parser:s?.parser||gn(),...s}),i)}function vr(i,s){let e=an("("+i+")",{parser:s?.parser||gn(),...s}),t=e.program.body[0];t.type==="ExpressionStatement"&&(t=t.expression),t.extra?.parenthesized&&(t.extra.parenthesized=!1);let r={$ast:e,$code:" "+i+" ",$type:"module"};return ie(t,r)}function xs(i,s={}){let e=i.$ast||i;e.type==="FunctionExpression"&&(e=Wl.expressionStatement(e));let t=s.format===!1||!("$code"in i)?{}:Er(i.$code,s.format),{code:r,map:n}=Cl(e,{...s,...t});return{code:r,map:n}}var Lt=$e,Sn={functionCall(i,...s){return bn(Lt.callExpression(Lt.identifier(i),s.map(e=>ae(e))))},newExpression(i,...s){return Tn(Lt.newExpression(Lt.identifier(i),s.map(e=>ae(e))))},binaryExpression(i,s,e){return Pn(Lt.binaryExpression(s,ae(i),ae(e)))},literal(i){return ae(i)},raw(i){return vr(i)}};var bs=require("node:fs");async function Jl(i,s={}){let e=await bs.promises.readFile(i,"utf8");return s.sourceFileName=s.sourceFileName??i,Ar(e,s)}async function Hl(i,s,e){let{code:t,map:r}=xs("$ast"in i?i.$ast:i,e);await bs.promises.writeFile(s,t),r&&await bs.promises.writeFile(s+".map",r)}var qe=et(require("@sentry/node"),1);var Kl="1.66.0
|
|
107
|
+
`),h=!1;for(let m of u){let d=m.trim();if(d.length!==0){if(e.wrapColumn&&m.length>a&&(a=m.length),e.indent){let p=m.match(/^\s+/)?.[0]||"";p.length>0&&(p.length>0&&p.length<t&&(t=p.length),p[0]===" "?r++:p.length>0&&r--)}if(d.at(-1)===";"?n++:d.length>0&&n--,e.quote||e.arrowParens){let p=d.matchAll(c);for(let y of p)if(y.groups)for(let f in l)y.groups[f]&&l[f]++}e.trailingComma&&((m.startsWith("}")||m.startsWith("]"))&&(h?o++:o--),h=d.endsWith(","))}}return{wrapColumn:a,useTabs:r>0,tabWidth:t,quote:l.singleQuote>l.doubleQuote?"single":"double",arrowParensAlways:l.singleParam>0,trailingComma:o>0||l.trailingComma>0,useSemi:n>0,arrayBracketSpacing:void 0,objectCurlySpacing:void 0,...s}}var Wl=$e;function Ar(i,s){return zl(an(i,{parser:s?.parser||gn(),...s}),i)}function vr(i,s){let e=an("("+i+")",{parser:s?.parser||gn(),...s}),t=e.program.body[0];t.type==="ExpressionStatement"&&(t=t.expression),t.extra?.parenthesized&&(t.extra.parenthesized=!1);let r={$ast:e,$code:" "+i+" ",$type:"module"};return ie(t,r)}function xs(i,s={}){let e=i.$ast||i;e.type==="FunctionExpression"&&(e=Wl.expressionStatement(e));let t=s.format===!1||!("$code"in i)?{}:Er(i.$code,s.format),{code:r,map:n}=Cl(e,{...s,...t});return{code:r,map:n}}var Lt=$e,Sn={functionCall(i,...s){return bn(Lt.callExpression(Lt.identifier(i),s.map(e=>ae(e))))},newExpression(i,...s){return Tn(Lt.newExpression(Lt.identifier(i),s.map(e=>ae(e))))},binaryExpression(i,s,e){return Pn(Lt.binaryExpression(s,ae(i),ae(e)))},literal(i){return ae(i)},raw(i){return vr(i)}};var bs=require("node:fs");async function Jl(i,s={}){let e=await bs.promises.readFile(i,"utf8");return s.sourceFileName=s.sourceFileName??i,Ar(e,s)}async function Hl(i,s,e){let{code:t,map:r}=xs("$ast"in i?i.$ast:i,e);await bs.promises.writeFile(s,t),r&&await bs.promises.writeFile(s+".map",r)}var qe=et(require("@sentry/node"),1);var Kl="1.66.0",wn=process.env.OVERRIDE_VERSION??Kl;var Vt;function Xl(){if(Vt!==void 0)return Vt;try{return Vt=require("prettier"),Vt}catch{return Vt=null,null}}async function Cn(i,s){let e=await(0,ne.readdir)(i,{withFileTypes:!0}),t=[];for(let r of e){let n=q.default.join(i,r.name);if(r.isDirectory()){if(!s.has(r.name))try{let a=await Cn(n,s);t.push(...a)}catch(a){qe.captureException(a,{tags:{errorType:"filesystem_permission",component:"readdirRecursive"},extra:{directory:n,errorCode:a.code}})}}else t.push(n)}return t}async function In(i){let s=new Set,e=(...l)=>{if(process.env.DEBUG){let u=new Date,h=`${String(u.getMinutes()).padStart(2,"0")}:${String(u.getSeconds()).padStart(2,"0")}.${String(u.getMilliseconds()).padStart(3,"0")}`;console.debug(h,"[builder-dev-tools]",...l)}},t=async l=>{let u=(0,En.createHash)("md5");return u.update(l),u.digest("hex")},r=q.default.normalize(q.default.resolve(process.cwd(),i.cwd)),n=ec(q.default.normalize(i.cwd))??r,a=tc(q.default.normalize(i.cwd))??n,o={...q.default,getCwdDir:()=>r,getRepoRootDir:()=>n,getAppRootDir:()=>a,cwd:()=>process.cwd(),exists:async l=>{try{return await(0,ne.access)(l),!0}catch{return!1}},magicast:Cr,existsSync:l=>(0,Q.existsSync)(l),readdir:async(l,u)=>{let h=await(0,ne.readdir)(l);return u?h.map(m=>q.default.join(l,m)):h},readdirRecursive:async(l,u)=>Cn(l,new Set(u)),readdirSync:l=>(0,Q.readdirSync)(l),readFile:async l=>{try{return await(0,ne.readFile)(l,"utf-8")}catch(u){if(u.code==="ENOENT")return null;throw e(u,l),u}},readFileSync(l){try{return(0,Q.readFileSync)(l,"utf-8")}catch(u){if(u.code==="ENOENT")return null;throw e(u,l),u}},readFileSyncBuffer(l){try{return new Uint8Array((0,Q.readFileSync)(l,{encoding:null}))}catch(u){if(u.code==="ENOENT")return null;throw e(u,l),u}},async readBinaryFile(l){try{let u=await(0,ne.readFile)(l);return new Uint8Array(u)}catch(u){if(u.code==="ENOENT")return null;throw e(u,l),u}},spawnSync:Ze.spawnSync,stat:async l=>await(0,ne.stat)(l),statSync:l=>(0,Q.statSync)(l),unlinkSync:l=>{(0,Q.unlinkSync)(l)},unlink:async l=>{await(0,ne.unlink)(l)},rm:async(l,u)=>{await(0,ne.rm)(l,{recursive:u?.recursive,force:u?.force})},writeFile:async(l,u)=>{l=q.default.normalize(l);let h={path:l,basename:q.default.basename(l),dirname:q.default.dirname(l),extname:q.default.extname(l)};await(0,ne.mkdir)(q.default.dirname(l),{recursive:!0}),await(0,ne.writeFile)(l,u);for(let m of s)await m(h)},hash:t,getDeviceId:()=>t(`${(0,Ts.hostname)()}:${(0,Ts.homedir)()}`),formatCode:async(l,u)=>{let h=Xl();if(!h)return u;let m=null;try{m=await h.resolveConfig(l)}catch{}try{return h.format(u,{...m,filepath:l})}catch{}return u},on:(l,u)=>{l==="change"&&s.add(u)},off:(l,u)=>{l==="change"&&s.delete(u)},debug:e,launchEditor:async l=>new Promise(u=>{try{let h=l.filePath;typeof l.line=="number"&&(h+=`:${l.line}`,typeof l.column=="number"&&(h+=`:${l.column}`)),(0,vn.default)(h,void 0,(m,d)=>{let p=new Error(`Failed to launch editor for ${d}`);u({success:!1,message:p.message})}),setTimeout(()=>{u({success:!0})},100)}catch{u({success:!1,message:"Failed to launch editor"})}}),platform:()=>({runtime:"node",os:process.platform}),getRepoInfo:async l=>{let u=q.default.normalize(l??i.cwd);return{hasGit:Yl(u),remoteUrl:Gl(u),defaultBranch:Ql(u),commit:$l(u),currentBranch:Zl(u)}},getFrameworks:()=>[],ts:An.default,Sentry:qe,connectionTracker:null,version:wn,sdkVersion:null,ignoreMissingConfig:i.ignoreMissingConfig,kind:null};o.connectionTracker=new Kt(o);let c=await Vr(o);return o.getFrameworks=()=>c,o}function Gl(i){try{return((0,Ze.spawnSync)("git",["config","--get","remote.origin.url"],{cwd:i}).stdout||"").toString().trim()}catch(s){return qe.captureException(new Error("Error getting git remote URL:",{cause:s})),""}}function Ql(i){let s="master";try{let e=(0,Ze.spawnSync)("git",["branch","-r"],{cwd:i});return e.stdout&&e.stdout.toString().trim().split(`
|
|
108
108
|
`).map(r=>r.trim()).includes("origin/main")?"main":s}catch(e){return qe.captureException(new Error("Error getting git default branch name:",{cause:e})),s}}function Yl(i){try{return((0,Ze.spawnSync)("git",["rev-parse","--is-inside-work-tree"],{cwd:i}).stdout||"").toString().trim()==="true"}catch(s){return qe.captureException(new Error("Error getting git commit:",{cause:s})),!1}}function $l(i){try{return((0,Ze.spawnSync)("git",["rev-parse","HEAD"],{cwd:i}).stdout||"").toString().trim()}catch(s){return qe.captureException(new Error("Error getting git commit:",{cause:s})),""}}function Zl(i){try{return((0,Ze.spawnSync)("git",["branch","--show-current"],{cwd:i}).stdout||"").toString().trim()}catch(s){return qe.captureException(new Error("Error getting current branch name:",{cause:s})),""}}function ec(i){let s=q.default.resolve("/");for(let e=0;e<20;e++){let t=q.default.join(i,"package.json");if((0,Q.existsSync)(t))return i;if(i===s)break;i=q.default.dirname(i)}return null}function tc(i){let s=q.default.resolve("/");for(let e=0;e<20;e++){if((0,Q.existsSync)(q.default.join(i,"builder.config.json"))||(0,Q.existsSync)(q.default.join(i,"fusion.config.json"))||(0,Q.existsSync)(q.default.join(i,"package.json"))||(0,Q.existsSync)(q.default.join(i,"remix.config.js"))||(0,Q.existsSync)(q.default.join(i,"remix.config.mjs"))||(0,Q.existsSync)(q.default.join(i,"remix.config.ts"))||(0,Q.existsSync)(q.default.join(i,"vite.config.js"))||(0,Q.existsSync)(q.default.join(i,"vite.config.ts"))||(0,Q.existsSync)(q.default.join(i,"vite.config.mjs"))||(0,Q.existsSync)(q.default.join(i,"next.config.js"))||(0,Q.existsSync)(q.default.join(i,"next.config.ts"))||(0,Q.existsSync)(q.default.join(i,"angular.json"))||(0,Q.existsSync)(q.default.join(i,"project.json"))||(0,Q.existsSync)(q.default.join(i,"tsconfig.json")))return i;if(i===s)break;i=q.default.dirname(i)}return null}0&&(module.exports={createDevToolsNodeSys});
|
package/node/index.mjs
CHANGED
|
@@ -105,5 +105,5 @@ ${" ".repeat(6+r)}^`),l));s+=`
|
|
|
105
105
|
${c.join(`
|
|
106
106
|
`)}
|
|
107
107
|
`}this.message=s}},vl=new Set(["Literal","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","BigIntLiteral"]),dn=new Set(["string","number","boolean","bigint","symbol","undefined"]),te=Ye;function Cl(i){return/^[$A-Z_a-z][\w$]*$/.test(i)}var br="__magicast_proxy";function ie(i,s=new Set){if(i===void 0)return te.identifier("undefined");if(i===null)return te.literal(null);if(dn.has(typeof i))return te.literal(i);if(s.has(i))throw new ne("Can not serialize circular reference");if(s.add(i),i[br])return i.$ast;if(i instanceof RegExp){let e=te.regExpLiteral(i.source,i.flags);return delete e.extra.raw,e}return i instanceof Set?te.newExpression(te.identifier("Set"),[te.arrayExpression([...i].map(e=>ie(e,s)))]):i instanceof Date?te.newExpression(te.identifier("Date"),[te.literal(i.toISOString())]):i instanceof Map?te.newExpression(te.identifier("Map"),[te.arrayExpression([...i].map(([e,t])=>te.arrayExpression([ie(e,s),ie(t,s)])))]):Array.isArray(i)?te.arrayExpression(i.map(e=>ie(e,s))):typeof i=="object"?te.objectExpression(Object.entries(i).map(([e,t])=>te.property("init",/^[$A-Z_a-z][\w$]*$/g.test(e)?te.identifier(e):te.literal(e),ie(t,s)))):te.literal(i)}function ms(i,s={}){let e=s;return e[br]=!0,e.$ast=i,e.$type||(e.$type="object"),e}var Il={enumerable:!0,configurable:!0};function xe(i,s,e){let t=ms(i,s);return new Proxy({},{ownKeys(){return Object.keys(t).filter(r=>r!==br&&!r.startsWith("$"))},getOwnPropertyDescriptor(){return Il},has(r,n){return n in t},...e,get(r,n,a){if(n in t)return t[n];if(e.get)return e.get(r,n,a)},set(r,n,a,o){return n in t?(t[n]=a,!0):e.set?e.set(r,n,a,o):!1}})}var fe=Ye,rr=new WeakMap;function Nl(i,s,e){if(rr.has(s))return rr.get(s);let t=xe(s,{get $declaration(){return i},get imported(){return s.type==="ImportDefaultSpecifier"?"default":s.type==="ImportNamespaceSpecifier"?"*":s.imported.type==="Identifier"?s.imported.name:s.imported.value},set imported(r){if(s.type!=="ImportSpecifier")throw new ne("Changing import name is not yet implemented");s.imported.type==="Identifier"?s.imported.name=r:s.imported.value=r},get local(){return s.local.name},set local(r){s.local.name=r},get from(){return i.source.value},set from(r){if(r===i.source.value)return;i.specifiers=i.specifiers.filter(a=>a!==s),i.specifiers.length===0&&(e.body=e.body.filter(a=>a!==i));let n=e.body.find(a=>a.type==="ImportDeclaration"&&a.source.value===r);n?n.specifiers.push(s):e.body.unshift(fe.importDeclaration([s],fe.stringLiteral(r)))},toJSON(){return{imported:this.imported,local:this.local,from:this.from}}},{ownKeys(){return["imported","local","from","toJSON"]}});return rr.set(s,t),t}function kl(i,s){let e=()=>{let n=[];for(let a of i.body)if(a.type==="ImportDeclaration")for(let o of a.specifiers)n.push(Nl(a,o,i));return n},t=(n,a,o)=>{let c=e(),l=c.find(d=>d.local===n),u=a.local||n;if(l)return l.imported=a.imported,l.local=u,l.from=a.from,!0;let h=a.imported==="default"?fe.importDefaultSpecifier(fe.identifier(u)):a.imported==="*"?fe.importNamespaceSpecifier(fe.identifier(u)):fe.importSpecifier(fe.identifier(a.imported),fe.identifier(u)),m=c.find(d=>d.from===a.from)?.$declaration;if(m)m.specifiers.push(h);else if(o==="prepend"||c.length===0)i.body.unshift(fe.importDeclaration([h],fe.stringLiteral(a.from)));else{let d=c.at(-1).$declaration,p=i.body.indexOf(d);i.body.splice(p+1,0,fe.importDeclaration([h],fe.stringLiteral(a.from)))}return!0},r=n=>{let a=e().find(l=>l.local===n);if(!a)return!1;let o=a.$declaration,c=a.$ast;return o.specifiers=o.specifiers.filter(l=>l!==c),o.specifiers.length===0&&(i.body=i.body.filter(l=>l!==o)),!0};return xe(i,{$type:"imports",$add(n){t(n.local||n.imported,n,"prepend")},$prepend(n){t(n.local||n.imported,n,"prepend")},$append(n){t(n.local||n.imported,n,"append")},get $items(){return e()},toJSON(){return e().reduce((n,a)=>(n[a.local]=a,n),{})}},{get(n,a){return e().find(o=>o.local===a)},set(n,a,o){return t(a,o,"prepend")},deleteProperty(n,a){return r(a)},ownKeys(){return e().map(n=>n.local)},has(n,a){return e().some(o=>o.local===a)}})}function ht(i,s,e){let t=ms(i,{$type:"array",push(r){s.push(ie(r))},pop(){return re(s.pop(),e)},unshift(r){s.unshift(ie(r))},shift(){return re(s.shift(),e)},splice(r,n,...a){return s.splice(r,n,...a.map(o=>ie(o))).map(o=>re(o,e))},toJSON(){return s.map(r=>re(r,e))}});return new Proxy([],{get(r,n,a){if(n in t)return t[n];let o=a;if(n==="map")return l=>{let u=[],h=0;for(let m of o)u.push(l(m,h,o)),h++;return u};if(n==="filter")return l=>{let u=[],h=0;for(let m of o)l(m,h,o)&&u.push(m),h++;return u};if(n==="forEach")return l=>{let u=0;for(let h of o)l(h,u,o),u++};if(n==="reduce")return(l,...u)=>{let h=[...o];if(h.length===0&&u.length===0)throw new TypeError("Reduce of empty array with no initial value");let m,d=0;u.length>0?m=u[0]:(m=h[0],d=1);for(let p=d;p<h.length;p++)m=l(m,h[p],p,h);return m};if(n==="find")return l=>{let u=0;for(let h of o){if(l(h,u,o))return h;u++}};if(n==="findIndex")return l=>{let u=0;for(let h of o){if(l(h,u,o))return u;u++}return-1};if(n==="includes")return(l,u)=>[...o].includes(l,u);if(n==="length")return s.length;if(n===Symbol.iterator)return function*(){for(let l of s)yield re(l,e)};if(typeof n=="symbol")return Reflect.get(r,n,a);let c=+n;if(!Number.isNaN(c)){let l=s[c];if(l)return re(l,e)}return Reflect.get(r,n,a)},set(r,n,a,o){if(typeof n=="symbol")return Reflect.set(r,n,a,o);let c=+n;return Number.isNaN(c)?Reflect.set(r,n,a,o):(s[c]=ie(a),!0)},deleteProperty(r,n){if(typeof n=="symbol")return Reflect.deleteProperty(r,n);let a=+n;return Number.isNaN(a)?Reflect.deleteProperty(r,n):(s[a]=ie(void 0),!0)},ownKeys(){return["length",...s.map((r,n)=>n.toString())]},getOwnPropertyDescriptor(r,n){if(n in t)return{configurable:!0,enumerable:!0,value:t[n]};if(n==="length")return{value:s.length,writable:!0,enumerable:!1,configurable:!1};if(typeof n=="symbol")return Reflect.getOwnPropertyDescriptor(r,n);let a=+n;return!Number.isNaN(a)&&a<s.length?{value:re(s[a],e),writable:!0,enumerable:!0,configurable:!0}:Reflect.getOwnPropertyDescriptor(r,n)}})}function Ll(i,s){if("elements"in i)return ht(i,i.elements,s)}function mn(i,s){if(i.type!=="CallExpression")throw new ne("Not a function call");function e(r){if(r.type==="Identifier")return r.name;if(r.type==="MemberExpression")return`${e(r.object)}.${e(r.property)}`;throw new ne("Not implemented")}let t=ht(i,i.arguments,s);return xe(i,{$type:"function-call",$callee:e(i.callee),$args:t},{})}function Ol(i,s){if(i.type!=="ArrowFunctionExpression")throw new ne("Not an arrow function expression");let e=ms(i,{$type:"arrow-function-expression",$params:ht(i,i.params,s),$body:re(i.body,s)});return new Proxy(()=>{},{get(t,r,n){return r in e?e[r]:Reflect.get(t,r,n)},apply(){throw new ne("Calling proxified functions is not supported. Use `generateCode` to get the code string.")}})}var Ke=Ye;function Dl(i,s){if(!("properties"in i))return;let e=(n,a=!1)=>{let o=n.type;if(o==="Property"||o==="ObjectProperty"||o==="ObjectMethod"){let c=n.key;if(c.type==="Identifier")return c.name;if(c.type==="StringLiteral"||c.type==="NumericLiteral"||c.type==="BooleanLiteral")return c.value.toString()}if(a)throw new ne(`Casting "${n.type}" is not supported`,{ast:n,code:s?.$code})},t=n=>{let a=String(n);for(let o of i.properties)if(e(o)===a){let c=o.type;if(c==="Property"||c==="ObjectProperty")return o.value;if(o.type==="ObjectMethod"){let l=Ke.functionExpression(null,o.params,o.body,o.generator,o.async);return l.async=o.async,l.loc=o.loc,l}}},r=(n,a)=>{let o=i.properties.find(c=>e(c)===n);if(o){let c=o.type;if(c==="Property"||c==="ObjectProperty")o.value=a;else if(o.type==="ObjectMethod"){let l=Ke.property("init",Ke.identifier(n),a),u=i.properties.indexOf(o);u!==-1&&(i.properties[u]=l)}}else{let c=Ke.property("init",Cl(n)?Ke.identifier(n):Ke.stringLiteral(n),a);i.properties.push(c)}};return xe(i,{$type:"object",toJSON(){return i.properties.reduce((n,a)=>{let o=e(a);if(o){let c=a.type;if(c==="Property"||c==="ObjectProperty")n[o]=re(a.value,s);else if(a.type==="ObjectMethod"){let l=Ke.functionExpression(null,a.params,a.body,a.generator,a.async);l.async=a.async,l.loc=a.loc,n[o]=re(l,s)}}return n},{})}},{get(n,a){let o=t(a);if(o)return re(o,s)},set(n,a,o){return typeof a!="string"&&(a=String(a)),r(a,ie(o)),!0},deleteProperty(n,a){typeof a!="string"&&(a=String(a));let o=i.properties.findIndex(c=>e(c)===a);return o!==-1&&i.properties.splice(o,1),!0},ownKeys(){return i.properties.map(n=>e(n)).filter(Boolean)},getOwnPropertyDescriptor(n,a){if(typeof a=="string"&&Array.from(this.ownKeys(n)).includes(a))return{enumerable:!0,configurable:!0}},has(n,a){return typeof a=="string"?Array.from(this.ownKeys(n)).includes(a):!1}})}function yn(i,s){if(i.type!=="NewExpression")throw new ne("Not a new expression");function e(r){if(r.type==="Identifier")return r.name;if(r.type==="MemberExpression")return`${e(r.object)}.${e(r.property)}`;throw new ne("Not implemented")}let t=ht(i,i.arguments,s);return xe(i,{$type:"new-expression",$callee:e(i.callee),$args:t},{})}function Ml(i){if(i.type!=="Identifier")throw new ne("Not an identifier");return xe(i,{$type:"identifier",$name:i.name},{})}function Fl(i){if(i.type!=="LogicalExpression")throw new ne("Not a logical expression");return xe(i,{$type:"logicalExpression"},{})}function _l(i,s){if(i.type!=="MemberExpression")throw new ne("Not a member expression");return xe(i,{$type:"member-expression",$object:re(i.object,s),$property:re(i.property,s)},{})}function gn(i,s){return xe(i,{$type:"binary-expression",$left:re(i.left,s),$right:re(i.right,s),$operator:i.operator},{})}function Bl(i,s){return xe(i,{$type:"block-statement",$body:ht(i,i.body,s)},{})}function jl(i,s){let e=ms(i,{$type:"function-expression",$params:ht(i,i.params,s),$body:re(i.body,s)});return new Proxy(()=>{},{get(t,r,n){return r in e?e[r]:Reflect.get(t,r,n)},apply(){throw new ne("Calling proxified functions is not supported. Use `generateCode` to get the code string.")}})}var ir=new WeakMap;function re(i,s){if(dn.has(typeof i))return i;if(i.type==="Identifier"&&i.name==="undefined")return;if(i.type==="RegExpLiteral"){let{pattern:t,flags:r}=i;return new RegExp(t,r)}if(vl.has(i.type))return i.value;if(ir.has(i))return ir.get(i);let e;switch(i.type){case"ObjectExpression":e=Dl(i,s);break;case"ArrayExpression":e=Ll(i,s);break;case"CallExpression":e=mn(i,s);break;case"ArrowFunctionExpression":e=Ol(i,s);break;case"FunctionExpression":e=jl(i,s);break;case"NewExpression":e=yn(i,s);break;case"Identifier":e=Ml(i);break;case"LogicalExpression":e=Fl(i);break;case"MemberExpression":e=_l(i);break;case"BinaryExpression":e=gn(i,s);break;case"BlockStatement":e=Bl(i,s);break;case"TSAsExpression":case"TSSatisfiesExpression":e=re(i.expression,s);break;default:throw new ne(`Casting "${i.type}" is not supported`,{ast:i,code:s?.$code})}return ir.set(i,e),e}var Ie=Ye;function Rl(i,s){let e=r=>{let n=r==="default"?"ExportDefaultDeclaration":"ExportNamedDeclaration";for(let a of i.body)if(a.type===n){if(r==="default")return a.declaration;if(a.declaration){if(a.declaration.type==="VariableDeclaration"){let o=a.declaration.declarations[0];if("name"in o.id&&o.id.name===r)return o.init}if(a.declaration.type==="FunctionDeclaration"&&a.declaration.id&&a.declaration.id.name===r){let o=a.declaration,c=Ie.functionExpression(o.id,o.params,o.body,o.generator,o.async);return c.async=o.async,c.loc=o.loc,c}}}},t=(r,n)=>{let a=r==="default"?"ExportDefaultDeclaration":"ExportNamedDeclaration",o=ie(n);for(let c of i.body)if(c.type===a){if(r==="default"){c.declaration=o;return}if(c.declaration){if(c.declaration.type==="VariableDeclaration"){let l=c.declaration.declarations[0];if("name"in l.id&&l.id.name===r){l.init=o;return}}if(c.declaration.type==="FunctionDeclaration"&&c.declaration.id&&c.declaration.id.name===r){let l=Ie.exportNamedDeclaration(Ie.variableDeclaration("const",[Ie.variableDeclarator(Ie.identifier(r),o)])),u=i.body.indexOf(c);u!==-1&&(i.body[u]=l);return}}}i.body.push(r==="default"?Ie.exportDefaultDeclaration(o):Ie.exportNamedDeclaration(Ie.variableDeclaration("const",[Ie.variableDeclarator(Ie.identifier(r),o)])))};return xe(i,{$type:"exports"},{get(r,n){let a=e(n);if(a)return re(a,s)},set(r,n,a){return t(n,a),!0},ownKeys(){return i.body.flatMap(r=>{if(r.type==="ExportDefaultDeclaration")return["default"];if(r.type==="ExportNamedDeclaration"&&r.declaration){if(r.declaration.type==="VariableDeclaration")return r.declaration.declarations.map(n=>"name"in n.id?n.id.name:"");if(r.declaration.type==="FunctionDeclaration")return r.declaration.id?[r.declaration.id.name]:[]}return[]}).filter(Boolean)},deleteProperty(r,n){let a=n==="default"?"ExportDefaultDeclaration":"ExportNamedDeclaration";for(let o=0;o<i.body.length;o++){let c=i.body[o];if(c.type===a){if(n==="default")return i.body.splice(o,1),!0;if(c.declaration){if(c.declaration.type==="VariableDeclaration"){let l=c.declaration.declarations[0];if("name"in l.id&&l.id.name===n)return i.body.splice(o,1),!0}if(c.declaration.type==="FunctionDeclaration"&&c.declaration.id&&c.declaration.id.name===n)return i.body.splice(o,1),!0}}}return!1}})}function Ul(i,s){let e=i.program;if(e.type!=="Program")throw new ne(`Cannot proxify ${i.type} as module`);let t={$code:s,$type:"module"},r=xe(e,t,{ownKeys(){return["imports","exports","generate"]}});return t.exports=Rl(e,r),t.imports=kl(e,r),t.generate=n=>ys(r,n),r}function Tr(i,s={}){let e={wrapColumn:s.wrapColumn===void 0,indent:s.tabWidth===void 0||s.useTabs===void 0,quote:s.quote===void 0,arrowParens:s.arrowParensAlways===void 0,trailingComma:s.trailingComma===void 0},t=2,r=0,n=0,a=0,o=0,c=/(?<doubleQuote>"[^"]+")|(?<singleQuote>'[^']+')|(?<singleParam>\([^),]+\)\s*=>)|(?<trailingComma>,\s*[\]}])/g,l={doubleQuote:0,singleQuote:0,singleParam:0,trailingComma:0},u=(i||"").split(`
|
|
108
|
-
`),h=!1;for(let m of u){let d=m.trim();if(d.length!==0){if(e.wrapColumn&&m.length>a&&(a=m.length),e.indent){let p=m.match(/^\s+/)?.[0]||"";p.length>0&&(p.length>0&&p.length<t&&(t=p.length),p[0]===" "?r++:p.length>0&&r--)}if(d.at(-1)===";"?n++:d.length>0&&n--,e.quote||e.arrowParens){let p=d.matchAll(c);for(let y of p)if(y.groups)for(let f in l)y.groups[f]&&l[f]++}e.trailingComma&&((m.startsWith("}")||m.startsWith("]"))&&(h?o++:o--),h=d.endsWith(","))}}return{wrapColumn:a,useTabs:r>0,tabWidth:t,quote:l.singleQuote>l.doubleQuote?"single":"double",arrowParensAlways:l.singleParam>0,trailingComma:o>0||l.trailingComma>0,useSemi:n>0,arrayBracketSpacing:void 0,objectCurlySpacing:void 0,...s}}var Vl=Ye;function Pr(i,s){return Ul(tn(i,{parser:s?.parser||fn(),...s}),i)}function Sr(i,s){let e=tn("("+i+")",{parser:s?.parser||fn(),...s}),t=e.program.body[0];t.type==="ExpressionStatement"&&(t=t.expression),t.extra?.parenthesized&&(t.extra.parenthesized=!1);let r={$ast:e,$code:" "+i+" ",$type:"module"};return re(t,r)}function ys(i,s={}){let e=i.$ast||i;e.type==="FunctionExpression"&&(e=Vl.expressionStatement(e));let t=s.format===!1||!("$code"in i)?{}:Tr(i.$code,s.format),{code:r,map:n}=El(e,{...s,...t});return{code:r,map:n}}var It=Ye,xn={functionCall(i,...s){return mn(It.callExpression(It.identifier(i),s.map(e=>ie(e))))},newExpression(i,...s){return yn(It.newExpression(It.identifier(i),s.map(e=>ie(e))))},binaryExpression(i,s,e){return gn(It.binaryExpression(s,ie(i),ie(e)))},literal(i){return ie(i)},raw(i){return Sr(i)}};import{promises as wr}from"node:fs";async function ql(i,s={}){let e=await wr.readFile(i,"utf8");return s.sourceFileName=s.sourceFileName??i,Pr(e,s)}async function zl(i,s,e){let{code:t,map:r}=ys("$ast"in i?i.$ast:i,e);await wr.writeFile(s,t),r&&await wr.writeFile(s+".map",r)}import*as Ve from"@sentry/node";var Wl="1.66.0
|
|
108
|
+
`),h=!1;for(let m of u){let d=m.trim();if(d.length!==0){if(e.wrapColumn&&m.length>a&&(a=m.length),e.indent){let p=m.match(/^\s+/)?.[0]||"";p.length>0&&(p.length>0&&p.length<t&&(t=p.length),p[0]===" "?r++:p.length>0&&r--)}if(d.at(-1)===";"?n++:d.length>0&&n--,e.quote||e.arrowParens){let p=d.matchAll(c);for(let y of p)if(y.groups)for(let f in l)y.groups[f]&&l[f]++}e.trailingComma&&((m.startsWith("}")||m.startsWith("]"))&&(h?o++:o--),h=d.endsWith(","))}}return{wrapColumn:a,useTabs:r>0,tabWidth:t,quote:l.singleQuote>l.doubleQuote?"single":"double",arrowParensAlways:l.singleParam>0,trailingComma:o>0||l.trailingComma>0,useSemi:n>0,arrayBracketSpacing:void 0,objectCurlySpacing:void 0,...s}}var Vl=Ye;function Pr(i,s){return Ul(tn(i,{parser:s?.parser||fn(),...s}),i)}function Sr(i,s){let e=tn("("+i+")",{parser:s?.parser||fn(),...s}),t=e.program.body[0];t.type==="ExpressionStatement"&&(t=t.expression),t.extra?.parenthesized&&(t.extra.parenthesized=!1);let r={$ast:e,$code:" "+i+" ",$type:"module"};return re(t,r)}function ys(i,s={}){let e=i.$ast||i;e.type==="FunctionExpression"&&(e=Vl.expressionStatement(e));let t=s.format===!1||!("$code"in i)?{}:Tr(i.$code,s.format),{code:r,map:n}=El(e,{...s,...t});return{code:r,map:n}}var It=Ye,xn={functionCall(i,...s){return mn(It.callExpression(It.identifier(i),s.map(e=>ie(e))))},newExpression(i,...s){return yn(It.newExpression(It.identifier(i),s.map(e=>ie(e))))},binaryExpression(i,s,e){return gn(It.binaryExpression(s,ie(i),ie(e)))},literal(i){return ie(i)},raw(i){return Sr(i)}};import{promises as wr}from"node:fs";async function ql(i,s={}){let e=await wr.readFile(i,"utf8");return s.sourceFileName=s.sourceFileName??i,Pr(e,s)}async function zl(i,s,e){let{code:t,map:r}=ys("$ast"in i?i.$ast:i,e);await wr.writeFile(s,t),r&&await wr.writeFile(s+".map",r)}import*as Ve from"@sentry/node";var Wl="1.66.0",bn=process.env.OVERRIDE_VERSION??Wl;var jt;function nc(){if(jt!==void 0)return jt;try{return jt=kn("prettier"),jt}catch{return jt=null,null}}async function wn(i,s){let e=await Sn(i,{withFileTypes:!0}),t=[];for(let r of e){let n=W.join(i,r.name);if(r.isDirectory()){if(!s.has(r.name))try{let a=await wn(n,s);t.push(...a)}catch(a){Ve.captureException(a,{tags:{errorType:"filesystem_permission",component:"readdirRecursive"},extra:{directory:n,errorCode:a.code}})}}else t.push(n)}return t}async function ac(i){let s=new Set,e=(...l)=>{if(process.env.DEBUG){let u=new Date,h=`${String(u.getMinutes()).padStart(2,"0")}:${String(u.getSeconds()).padStart(2,"0")}.${String(u.getMilliseconds()).padStart(3,"0")}`;console.debug(h,"[builder-dev-tools]",...l)}},t=async l=>{let u=Yl("md5");return u.update(l),u.digest("hex")},r=W.normalize(W.resolve(process.cwd(),i.cwd)),n=pc(W.normalize(i.cwd))??r,a=fc(W.normalize(i.cwd))??n,o={...W,getCwdDir:()=>r,getRepoRootDir:()=>n,getAppRootDir:()=>a,cwd:()=>process.cwd(),exists:async l=>{try{return await Jl(l),!0}catch{return!1}},magicast:Er,existsSync:l=>oe(l),readdir:async(l,u)=>{let h=await Sn(l);return u?h.map(m=>W.join(l,m)):h},readdirRecursive:async(l,u)=>wn(l,new Set(u)),readdirSync:l=>$l(l),readFile:async l=>{try{return await Tn(l,"utf-8")}catch(u){if(u.code==="ENOENT")return null;throw e(u,l),u}},readFileSync(l){try{return Pn(l,"utf-8")}catch(u){if(u.code==="ENOENT")return null;throw e(u,l),u}},readFileSyncBuffer(l){try{return new Uint8Array(Pn(l,{encoding:null}))}catch(u){if(u.code==="ENOENT")return null;throw e(u,l),u}},async readBinaryFile(l){try{let u=await Tn(l);return new Uint8Array(u)}catch(u){if(u.code==="ENOENT")return null;throw e(u,l),u}},spawnSync:pt,stat:async l=>await Xl(l),statSync:l=>Zl(l),unlinkSync:l=>{ec(l)},unlink:async l=>{await Gl(l)},rm:async(l,u)=>{await Kl(l,{recursive:u?.recursive,force:u?.force})},writeFile:async(l,u)=>{l=W.normalize(l);let h={path:l,basename:W.basename(l),dirname:W.dirname(l),extname:W.extname(l)};await Hl(W.dirname(l),{recursive:!0}),await Ql(l,u);for(let m of s)await m(h)},hash:t,getDeviceId:()=>t(`${sc()}:${tc()}`),formatCode:async(l,u)=>{let h=nc();if(!h)return u;let m=null;try{m=await h.resolveConfig(l)}catch{}try{return h.format(u,{...m,filepath:l})}catch{}return u},on:(l,u)=>{l==="change"&&s.add(u)},off:(l,u)=>{l==="change"&&s.delete(u)},debug:e,launchEditor:async l=>new Promise(u=>{try{let h=l.filePath;typeof l.line=="number"&&(h+=`:${l.line}`,typeof l.column=="number"&&(h+=`:${l.column}`)),ic(h,void 0,(m,d)=>{let p=new Error(`Failed to launch editor for ${d}`);u({success:!1,message:p.message})}),setTimeout(()=>{u({success:!0})},100)}catch{u({success:!1,message:"Failed to launch editor"})}}),platform:()=>({runtime:"node",os:process.platform}),getRepoInfo:async l=>{let u=W.normalize(l??i.cwd);return{hasGit:cc(u),remoteUrl:oc(u),defaultBranch:lc(u),commit:uc(u),currentBranch:hc(u)}},getFrameworks:()=>[],ts:rc,Sentry:Ve,connectionTracker:null,version:bn,sdkVersion:null,ignoreMissingConfig:i.ignoreMissingConfig,kind:null};o.connectionTracker=new Jt(o);let c=await Br(o);return o.getFrameworks=()=>c,o}function oc(i){try{return(pt("git",["config","--get","remote.origin.url"],{cwd:i}).stdout||"").toString().trim()}catch(s){return Ve.captureException(new Error("Error getting git remote URL:",{cause:s})),""}}function lc(i){let s="master";try{let e=pt("git",["branch","-r"],{cwd:i});return e.stdout&&e.stdout.toString().trim().split(`
|
|
109
109
|
`).map(r=>r.trim()).includes("origin/main")?"main":s}catch(e){return Ve.captureException(new Error("Error getting git default branch name:",{cause:e})),s}}function cc(i){try{return(pt("git",["rev-parse","--is-inside-work-tree"],{cwd:i}).stdout||"").toString().trim()==="true"}catch(s){return Ve.captureException(new Error("Error getting git commit:",{cause:s})),!1}}function uc(i){try{return(pt("git",["rev-parse","HEAD"],{cwd:i}).stdout||"").toString().trim()}catch(s){return Ve.captureException(new Error("Error getting git commit:",{cause:s})),""}}function hc(i){try{return(pt("git",["branch","--show-current"],{cwd:i}).stdout||"").toString().trim()}catch(s){return Ve.captureException(new Error("Error getting current branch name:",{cause:s})),""}}function pc(i){let s=W.resolve("/");for(let e=0;e<20;e++){let t=W.join(i,"package.json");if(oe(t))return i;if(i===s)break;i=W.dirname(i)}return null}function fc(i){let s=W.resolve("/");for(let e=0;e<20;e++){if(oe(W.join(i,"builder.config.json"))||oe(W.join(i,"fusion.config.json"))||oe(W.join(i,"package.json"))||oe(W.join(i,"remix.config.js"))||oe(W.join(i,"remix.config.mjs"))||oe(W.join(i,"remix.config.ts"))||oe(W.join(i,"vite.config.js"))||oe(W.join(i,"vite.config.ts"))||oe(W.join(i,"vite.config.mjs"))||oe(W.join(i,"next.config.js"))||oe(W.join(i,"next.config.ts"))||oe(W.join(i,"angular.json"))||oe(W.join(i,"project.json"))||oe(W.join(i,"tsconfig.json")))return i;if(i===s)break;i=W.dirname(i)}return null}export{ac as createDevToolsNodeSys};
|