@junobuild/cli 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -647,7 +647,7 @@ tell application "System Events" to get value of property list item "CFBundleNam
|
|
|
647
647
|
${(0,xn.yellow)("--container-url")} Override a custom container URL. If not provided, defaults to production or the local container in development mode.
|
|
648
648
|
${(0,xn.yellow)("--console-url")} Specify a custom URL to access the developer Console.`,jP=`${(0,xn.yellow)("-l, --lang")} Specify the language for building the serverless functions: ${(0,xn.magenta)("rust")}, ${(0,xn.magenta)("typescript")} or ${(0,xn.magenta)("javascript")}.
|
|
649
649
|
${(0,xn.yellow)("--cargo-path")} Path to the Rust manifest.
|
|
650
|
-
${(0,xn.yellow)("--source-path")} Optional path to the TypeScript or JavaScript entry file.`,LP=`The option ${(0,xn.yellow)("--keep-staged")} only applies when ${(0,xn.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var jt=e=>Bt({args:e,options:["-d","--doc"]})?"doc":"cli";var zn=ae(Ye(),1);var Ax="0.5.
|
|
650
|
+
${(0,xn.yellow)("--source-path")} Optional path to the TypeScript or JavaScript entry file.`,LP=`The option ${(0,xn.yellow)("--keep-staged")} only applies when ${(0,xn.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var jt=e=>Bt({args:e,options:["-d","--doc"]})?"doc":"cli";var zn=ae(Ye(),1);var Ax="0.5.4";var XGe=` __ __ __ __ _ ____
|
|
651
651
|
__) || | || \\| |/ \\
|
|
652
652
|
\\___/ \\___/ |_|\\__|\\____/`,Rt=`${XGe} CLI ${(0,zn.grey)(`v${Ax}`)}`,Wce=`Juno CLI ${(0,zn.grey)(`v${Ax}`)}`,Cx=`
|
|
653
653
|
${Rt}
|
|
@@ -843,7 +843,7 @@ import {getSatelliteExtendedActor} from '@junobuild/%CORE_LIB%';
|
|
|
843
843
|
}`,Tqt=`
|
|
844
844
|
import type {_SERVICE as SatelliteActor%IMPORTS%} from './satellite.did';`,Sqt=({methods:e,imports:t,transformerOptions:{coreLib:r,outputLanguage:n}})=>{let i=n==="js"?wqt:_qt,s=e.map(a=>{let o=Pqt(a),c=i;return Object.entries(o).map(([u,l])=>{c=c.replaceAll(`%${u}%`,l)}),c}).join(`
|
|
845
845
|
|
|
846
|
-
`);return Eqt.replace("%CORE_LIB%",r??"core").replace("%METHODS%",s).replace("%IMPORT%",n==="js"?"":Tqt.replace("%IMPORTS%",t.length===0?"":`, ${t.join(", ")}`)).trim()},Pqt=({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}},OTe=async({inputFile:e,outputFile:t,transformerOptions:r})=>{let n=await vqt({inputFile:e}),i=Sqt({...n,transformerOptions:r});await hqt(t,i,"utf-8")};var pw=ae(Ye(),1);import{copyFile as Aqt}from"fs/promises";import{existsSync as UH}from"node:fs";import{lstat as Cqt,mkdir as LTe,readFile as jTe,rename as Dqt,writeFile as aN}from"node:fs/promises";import{join as lw,relative as Oqt}from"node:path";var Tb=ae(nl(),1);var Mm=ae(Ye(),1);var ITe=async()=>{let{valid:e}=await Jwe();return e===!1?{valid:e}:(e==="error"&&(await On(`The ${(0,Mm.magenta)("ic-wasm")} ${(0,Mm.yellow)(`v${gb}`)} tool is required to build a satellite but appears to be not available. Would you like to install it?`),await Qi({command:"cargo",args:["install",`ic-wasm@${gb}`]})),{valid:!0})},NTe=async()=>{let{valid:e}=await GI({command:"candid-extractor",args:["--version"]});return e===!1?{valid:e}:(e==="error"&&(await On(`The ${(0,Mm.magenta)("candid-extractor")} tool is required to generate the API ("did file"). Would you like to install it?`),await Qi({command:"cargo",args:["install","candid-extractor"]})),{valid:!0})},FTe=async()=>{let{valid:e}=await GI({command:"junobuild-didc",args:["--version"]});return e===!1?{valid:e}:(e==="error"&&(await On(`It seems that ${(0,Mm.magenta)("junobuild-didc")} is not installed. This is a useful tool for generating automatically JavaScript or TypeScript bindings. Would you like to install it?`),await Qi({command:"cargo",args:["install","junobuild-didc"]})),{valid:!0})},kTe=async()=>{let{valid:e}=await GI({command:"wasi2ic",args:["--version"]});return e===!1?{valid:e}:(e==="error"&&(await On(`The ${(0,Mm.magenta)("wasi2ic")} polyfill tool is required to replaces the specific function calls with their corresponding polyfill implementations for the Internet Computer. Would you like to install it?`),await Qi({command:"cargo",args:["install","wasi2ic"]})),{valid:!0})};var RTe=async e=>{await hu({template:"satellite.did",sourceFolder:yb,destinationFolder:Oi,overwrite:e})},BTe=async()=>await Cm({template:"satellite.did",sourceFolder:yb});var dw=async({paths:e,target:t}={})=>{let{valid:r}=await KI();if(r==="error"||!r)return;let{valid:n}=await ITe();if(!n)return;let{valid:i}=await NTe();if(!i)return;let{valid:s}=await FTe();if(!s)return;let{valid:a}=t==="wasm32-wasip1"?await kTe():{valid:!0};if(!a)return;let o=["-p",iw],c=t??"wasm32-unknown-unknown",u=lw(process.cwd(),"target"
|
|
846
|
+
`);return Eqt.replace("%CORE_LIB%",r??"core").replace("%METHODS%",s).replace("%IMPORT%",n==="js"?"":Tqt.replace("%IMPORTS%",t.length===0?"":`, ${t.join(", ")}`)).trim()},Pqt=({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}},OTe=async({inputFile:e,outputFile:t,transformerOptions:r})=>{let n=await vqt({inputFile:e}),i=Sqt({...n,transformerOptions:r});await hqt(t,i,"utf-8")};var pw=ae(Ye(),1);import{copyFile as Aqt}from"fs/promises";import{existsSync as UH}from"node:fs";import{lstat as Cqt,mkdir as LTe,readFile as jTe,rename as Dqt,writeFile as aN}from"node:fs/promises";import{join as lw,relative as Oqt}from"node:path";var Tb=ae(nl(),1);var Mm=ae(Ye(),1);var ITe=async()=>{let{valid:e}=await Jwe();return e===!1?{valid:e}:(e==="error"&&(await On(`The ${(0,Mm.magenta)("ic-wasm")} ${(0,Mm.yellow)(`v${gb}`)} tool is required to build a satellite but appears to be not available. Would you like to install it?`),await Qi({command:"cargo",args:["install",`ic-wasm@${gb}`]})),{valid:!0})},NTe=async()=>{let{valid:e}=await GI({command:"candid-extractor",args:["--version"]});return e===!1?{valid:e}:(e==="error"&&(await On(`The ${(0,Mm.magenta)("candid-extractor")} tool is required to generate the API ("did file"). Would you like to install it?`),await Qi({command:"cargo",args:["install","candid-extractor"]})),{valid:!0})},FTe=async()=>{let{valid:e}=await GI({command:"junobuild-didc",args:["--version"]});return e===!1?{valid:e}:(e==="error"&&(await On(`It seems that ${(0,Mm.magenta)("junobuild-didc")} is not installed. This is a useful tool for generating automatically JavaScript or TypeScript bindings. Would you like to install it?`),await Qi({command:"cargo",args:["install","junobuild-didc"]})),{valid:!0})},kTe=async()=>{let{valid:e}=await GI({command:"wasi2ic",args:["--version"]});return e===!1?{valid:e}:(e==="error"&&(await On(`The ${(0,Mm.magenta)("wasi2ic")} polyfill tool is required to replaces the specific function calls with their corresponding polyfill implementations for the Internet Computer. Would you like to install it?`),await Qi({command:"cargo",args:["install","wasi2ic"]})),{valid:!0})};var RTe=async e=>{await hu({template:"satellite.did",sourceFolder:yb,destinationFolder:Oi,overwrite:e})},BTe=async()=>await Cm({template:"satellite.did",sourceFolder:yb});var dw=async({paths:e,target:t}={})=>{let{valid:r}=await KI();if(r==="error"||!r)return;let{valid:n}=await ITe();if(!n)return;let{valid:i}=await NTe();if(!i)return;let{valid:s}=await FTe();if(!s)return;let{valid:a}=t==="wasm32-wasip1"?await kTe():{valid:!0};if(!a)return;let o=["-p",iw],c=t??"wasm32-unknown-unknown",u=lw(process.cwd(),"target"),l=lw(u,c,"release","satellite.wasm"),p=["build","--target",c,...(0,Xa.nonNullish)(e?.cargo)?["--manifest-path",e.cargo]:o,"--release",...UH("Cargo.lock")?["--locked"]:[],"--target-dir",u],d={...process.env,RUSTFLAGS:'--cfg getrandom_backend="custom"',...t==="wasm32-wasip1"&&{DEV_SCRIPT_PATH:zI}};await Qi({command:"cargo",args:p,env:d});let f=kn({text:"Finalizing...",discardStdin:!0}).start();try{let h=await kqt({paths:e});if("error"in h){console.log((0,pw.red)(h.error));return}switch(t){case"wasm32-wasip1":{f.text="Converting WASI to IC...",await Aqt(lw(u,"wasm32-wasip1","release",`${yH}.wasm`),l),await jqt({cargoOutputWasm:l});let m=await ATe({buildType:h});if("error"in m)return console.log((0,pw.red)(m.error)),{result:"error"};break}default:await PTe({buildType:h})}f.text="Generating DID...",await Iqt({cargoOutputWasm:l}),t!=="wasm32-wasip1"&&(await Nqt(),await Fqt()),f.text="Binding metadata...",await Rqt({buildType:h,cargoOutputWasm:l}),f.text="Compressing...",await r6({source:Hi,destination:`${Hi}.tmp.gz`}),await Dqt(`${Hi}.tmp.gz`,`${Hi}.gz`),await Bqt(f)}finally{f.stop()}},qH=lw(Oi,"satellite.did"),MTe="satellite_extension.did",oN=lw(Oi,MTe),cN=`// This file was automatically generated by the Juno CLI.
|
|
847
847
|
// Any modifications may be overwritten.`,Iqt=async({cargoOutputWasm:e})=>{let t="";await Fa({command:"candid-extractor",args:[e],stdout:i=>t+=i});let r=t.replace(/(\r\n|\n|\r)/gm,"").trim()==="",n=await BTe();if(r){await aN(qH,`${cN}
|
|
848
848
|
|
|
849
849
|
${n}`,"utf-8");return}await aN(oN,`${cN}
|