@junobuild/cli 0.13.9 → 0.13.10

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -733,7 +733,7 @@ Done. The ${va(t)} ${(0,Xl.green)(r)} has been configured for your terminal. \u2
733
733
  ${(0,Gi.yellow)("--source-path")} Optional path to the TypeScript or JavaScript entry file.`,jO=`${whn}
734
734
  ${Ohn}`,nae=`${(0,Gi.yellow)("--container-url")} Override a custom container URL. If not provided, defaults to production or the local container in development mode.`,ts=`${jO}
735
735
  ${nae}
736
- ${(0,Gi.yellow)("--console-url")} Specify a custom URL to access the developer Console.`,u8=`The option ${(0,Gi.yellow)("--keep-staged")} only applies when ${(0,Gi.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var tr=e=>Lr({args:e,options:["-d","--doc"]})?"doc":"cli";var oa=rt(lt(),1);var $O="0.13.9";var Ahn=` __ __ __ __ _ ____
736
+ ${(0,Gi.yellow)("--console-url")} Specify a custom URL to access the developer Console.`,u8=`The option ${(0,Gi.yellow)("--keep-staged")} only applies when ${(0,Gi.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var tr=e=>Lr({args:e,options:["-d","--doc"]})?"doc":"cli";var oa=rt(lt(),1);var $O="0.13.10";var Ahn=` __ __ __ __ _ ____
737
737
  __) || | || \\| |/ \\
738
738
  \\___/ \\___/ |_|\\__|\\____/`,Xt=`${Ahn} CLI ${(0,oa.grey)(`v${$O}`)}`,mUe=`Juno CLI ${(0,oa.grey)(`v${$O}`)}`,VO=`
739
739
  ${Xt}
@@ -1001,7 +1001,7 @@ import {getSatelliteExtendedActor} from '@junobuild/%CORE_LIB%';
1001
1001
  import type {_SERVICE as SatelliteActor%IMPORTS%} from './satellite.did';
1002
1002
  import type { Principal } from '@icp-sdk/core/principal';`,uTn=({methods:e,imports:t,transformerOptions:{coreLib:r,outputLanguage:n}})=>{let i=n==="js"?cTn:oTn,s=e.map(a=>{let o=pTn(a),c=i;return Object.entries(o).map(([l,u])=>{c=c.replaceAll(`%${l}%`,u)}),c}).join(`
1003
1003
 
1004
- `);return aTn.replace("%CORE_LIB%",r??"core").replace("%METHODS%",s).replace("%IMPORT%",n==="js"?"":lTn.replace("%IMPORTS%",t.length===0?"":`, ${t.join(", ")}`)).trim()},pTn=({name:e,returnType:t,paramsType:r})=>{let n=(o=>o.replace(/_./g,c=>c[1].toUpperCase()))(e),i=r.map((o,c)=>({param:`value${c}`,type:o})),s=`${i.map(({param:o})=>o).join(", ")}`,a=i.map(({param:o,type:c})=>`${o}: ${c}`).join(", ");return{METHOD_NAME:n,DID_METHOD_NAME:e,METHOD_RESULT:t,PARAMS:a,CALL_PARAMS:s}},uze=async({inputFile:e,outputFile:t,transformerOptions:r})=>{let n=await iTn({inputFile:e}),i=uTn({...n,transformerOptions:r});await Qbn(t,i,"utf-8")};import{existsSync as dze}from"node:fs";import{readFile as dTn,rename as pze,rm as fTn}from"node:fs/promises";import{join as Yae}from"node:path";var Jae=e=>`${TP}/satellite.${e==="ts"?"did.d.ts":"factory.did.js"}`,fze=async()=>{if(!dze(nS)||(await dTn(nS,"utf-8")).trim()==="service : { build_version : () -> (text) query }")return;await mTn();let r=Yae(TP,"declarations");await pze(Yae(r,`${rS}.d.ts`),Jae("ts")),await pze(Yae(r,`${rS}.js`),Jae("js")),await fTn(r,{recursive:!0,force:!0})},mTn=async()=>{let e=Qu(),{valid:t}=await Wae({pm:e}),r=t!==!0,n=e==="npm"||Le(e)?"npx":e;await Oa({command:r?"icp-bindgen":n,args:[...r?[]:["icp-bindgen"],"--did-file",nS,"--out-dir",TP,"--actor-disabled","--force"],silentOut:!0})},mze=async()=>{let e=Jae("ts");if(!dze(e))return;let r=j3()?.configType==="ts"?"ts":"js",n=`${TP}/satellite.api.${r}`,s=await(async()=>{try{let{dependencies:a}=await py();return Object.keys(a??{}).includes("@junobuild/core-standalone")?"core-standalone":"core"}catch{return"core"}})();await uze({inputFile:e,outputFile:n,transformerOptions:{outputLanguage:r,coreLib:s}})};var hze=rt(lt(),1);var yze=async()=>{await bze({filename:`${UU}.gz`})},gze=async()=>{await bze({filename:VU})},bze=async({filename:e})=>{if(process.platform!=="darwin")return;let t=await Hl();if(!t.success)return;let{config:{derivedConfig:{runner:r}}}=t;if(r==="docker")return;let{result:n}=await Y1({config:t.config,request:`admin/touch?file=${encodeURIComponent(e)}`});n==="not_ok"&&console.log((0,hze.red)(`Invalid response from the emulator. Touching '${e}' did not succeed.`))};var nN=async({paths:e,target:t}={})=>{let{valid:r}=await Z8();if(r==="error"||!r)return;let{valid:n}=await sze();if(!n)return;let{valid:i}=await aze();if(!i)return;let{valid:s}=await ize();if(!s)return;let{valid:a}=t==="wasm32-wasip1"?await oze():{valid:!0};if(!a)return;let o=["-p",uy],c=t??"wasm32-unknown-unknown",l=Gae(process.cwd(),"target"),u=Gae(l,c,"release","satellite.wasm"),p=["build","--target",c,...ye(e?.cargo)?["--manifest-path",e.cargo]:o,"--release",...hTn("Cargo.lock")?["--locked"]:[],"--target-dir",l],d={...process.env,RUSTFLAGS:'--cfg getrandom_backend="custom" -A deprecated',...t==="wasm32-wasip1"&&{DEV_SCRIPT_PATH:GC}};await So({command:"cargo",args:p,env:d});let f=rn({text:"Finalizing...",discardStdin:!0}).start();try{let h=await STn({paths:e});if("error"in h){console.log((0,rN.red)(h.error));return}switch(t){case"wasm32-wasip1":{f.text="Converting WASI to IC...",await yTn(Gae(l,"wasm32-wasip1","release",`${kU}.wasm`),u),await PTn({cargoOutputWasm:u});let m=await XKe({buildType:h});if("error"in m)return console.log((0,rN.red)(m.error)),{result:"error"};break}default:await GKe({buildType:h})}f.text="Generating DID...",await xTn({cargoOutputWasm:u}),t!=="wasm32-wasip1"&&(await fze(),await mze()),f.text="Binding metadata...",await vTn({buildType:h,cargoOutputWasm:u}),f.text="Compressing...",await Gfe({source:Ya,destination:`${Ya}.tmp.gz`}),await TTn(`${Ya}.tmp.gz`,`${Ya}.gz`),await ETn(f)}finally{f.stop()}await yze()},xTn=async({cargoOutputWasm:e})=>{let t="";await Oa({command:"candid-extractor",args:[e],stdout:i=>t+=i});let r=t.replace(/(\r\n|\n|\r)/gm,"").trim()==="",n=await lze();if(r){await Hae(G8,`${X8}
1004
+ `);return aTn.replace("%CORE_LIB%",r??"core").replace("%METHODS%",s).replace("%IMPORT%",n==="js"?"":lTn.replace("%IMPORTS%",t.length===0?"":`, ${t.join(", ")}`)).trim()},pTn=({name:e,returnType:t,paramsType:r})=>{let n=(o=>o.replace(/_./g,c=>c[1].toUpperCase()))(e),i=r.map((o,c)=>({param:`value${c}`,type:o})),s=`${i.map(({param:o})=>o).join(", ")}`,a=i.map(({param:o,type:c})=>`${o}: ${c}`).join(", ");return{METHOD_NAME:n,DID_METHOD_NAME:e,METHOD_RESULT:t,PARAMS:a,CALL_PARAMS:s}},uze=async({inputFile:e,outputFile:t,transformerOptions:r})=>{let n=await iTn({inputFile:e}),i=uTn({...n,transformerOptions:r});await Qbn(t,i,"utf-8")};import{existsSync as dze}from"node:fs";import{readFile as dTn,rename as pze,rm as fTn}from"node:fs/promises";import{join as Yae}from"node:path";var Jae=e=>`${TP}/satellite.${e==="ts"?"did.d.ts":"factory.did.js"}`,fze=async()=>{if(!dze(nS)||(await dTn(nS,"utf-8")).trim()==="service : { build_version : () -> (text) query }")return;await mTn();let r=Yae(TP,"declarations");await pze(Yae(r,`${rS}.d.ts`),Jae("ts")),await pze(Yae(r,`${rS}.js`),Jae("js")),await fTn(r,{recursive:!0,force:!0})},mTn=async()=>{let e=Qu(),{valid:t}=await Wae({pm:e}),r=t!==!0,n=e==="npm"||Le(e)?"npx":e;await Oa({command:r?"icp-bindgen":n,args:[...r?[]:["icp-bindgen"],"--did-file",nS,"--out-dir",TP,"--actor-disabled","--force"],silentOut:!0})},mze=async()=>{let e=Jae("ts");if(!dze(e))return;let r=j3()?.configType==="ts"?"ts":"js",n=`${TP}/satellite.api.${r}`,s=await(async()=>{try{let{dependencies:a}=await py();return Object.keys(a??{}).includes("@junobuild/core-standalone")?"core-standalone":"core"}catch{return"core"}})();await uze({inputFile:e,outputFile:n,transformerOptions:{outputLanguage:r,coreLib:s}})};var hze=rt(lt(),1);var yze=async()=>{await bze({filename:`${UU}.gz`})},gze=async()=>{await bze({filename:VU})},bze=async({filename:e})=>{if(!["darwin","win32"].includes(process.platform))return;let t=await Hl();if(!t.success)return;let{config:{derivedConfig:{runner:r}}}=t;if(process.platform==="darwin"&&r==="docker"||process.platform==="win32"&&r==="podman")return;let{result:n}=await Y1({config:t.config,request:`admin/touch?file=${encodeURIComponent(e)}`});n==="not_ok"&&console.log((0,hze.red)(`Invalid response from the emulator. Touching '${e}' did not succeed.`))};var nN=async({paths:e,target:t}={})=>{let{valid:r}=await Z8();if(r==="error"||!r)return;let{valid:n}=await sze();if(!n)return;let{valid:i}=await aze();if(!i)return;let{valid:s}=await ize();if(!s)return;let{valid:a}=t==="wasm32-wasip1"?await oze():{valid:!0};if(!a)return;let o=["-p",uy],c=t??"wasm32-unknown-unknown",l=Gae(process.cwd(),"target"),u=Gae(l,c,"release","satellite.wasm"),p=["build","--target",c,...ye(e?.cargo)?["--manifest-path",e.cargo]:o,"--release",...hTn("Cargo.lock")?["--locked"]:[],"--target-dir",l],d={...process.env,RUSTFLAGS:'--cfg getrandom_backend="custom" -A deprecated',...t==="wasm32-wasip1"&&{DEV_SCRIPT_PATH:GC}};await So({command:"cargo",args:p,env:d});let f=rn({text:"Finalizing...",discardStdin:!0}).start();try{let h=await STn({paths:e});if("error"in h){console.log((0,rN.red)(h.error));return}switch(t){case"wasm32-wasip1":{f.text="Converting WASI to IC...",await yTn(Gae(l,"wasm32-wasip1","release",`${kU}.wasm`),u),await PTn({cargoOutputWasm:u});let m=await XKe({buildType:h});if("error"in m)return console.log((0,rN.red)(m.error)),{result:"error"};break}default:await GKe({buildType:h})}f.text="Generating DID...",await xTn({cargoOutputWasm:u}),t!=="wasm32-wasip1"&&(await fze(),await mze()),f.text="Binding metadata...",await vTn({buildType:h,cargoOutputWasm:u}),f.text="Compressing...",await Gfe({source:Ya,destination:`${Ya}.tmp.gz`}),await TTn(`${Ya}.tmp.gz`,`${Ya}.gz`),await ETn(f)}finally{f.stop()}await yze()},xTn=async({cargoOutputWasm:e})=>{let t="";await Oa({command:"candid-extractor",args:[e],stdout:i=>t+=i});let r=t.replace(/(\r\n|\n|\r)/gm,"").trim()==="",n=await lze();if(r){await Hae(G8,`${X8}
1005
1005
 
1006
1006
  ${n}`,"utf-8");return}await Hae(nS,`${X8}
1007
1007
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/cli",
3
- "version": "0.13.9",
3
+ "version": "0.13.10",
4
4
  "description": "The Juno command-line interface",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",