@upstart.gg/sdk 0.0.58 → 0.0.60
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/node/cli/api.js +1 -1
- package/dist/node/cli/commands/login/cmd-login.js +1 -1
- package/dist/node/cli/commands/publish/cmd-publish.js +18 -18
- package/dist/node/cli/commands/publish/uploader.js +1 -1
- package/dist/node/cli/program.js +15 -15
- package/dist/node/cli/store.js +1 -1
- package/dist/node/metafile-esm.json +1 -1
- package/dist/node/shared/config.js +6 -6
- package/dist/node/shared/logger.js +1 -1
- package/dist/shared/attributes.d.ts +3 -2
- package/dist/shared/attributes.js +1 -1
- package/dist/shared/datarecords/types.d.ts +1 -1
- package/dist/shared/datasources/external/facebook/posts/fetcher.d.ts +1 -1
- package/dist/shared/datasources/external/instagram/feed/fetcher.d.ts +1 -1
- package/dist/shared/datasources/external/json/fetcher.d.ts +1 -1
- package/dist/shared/datasources/external/mastodon/account/fetcher.d.ts +1 -1
- package/dist/shared/datasources/external/mastodon/status/fetcher.d.ts +1 -1
- package/dist/shared/datasources/external/meta/oauth/config.d.ts +1 -1
- package/dist/shared/datasources/external/rss/fetcher.d.ts +1 -1
- package/dist/shared/datasources/external/threads/media/fetcher.d.ts +1 -1
- package/dist/shared/datasources/external/tiktok/oauth/config.d.ts +1 -1
- package/dist/shared/datasources/external/tiktok/video/fetcher.d.ts +1 -1
- package/dist/shared/datasources/external/youtube/list/fetcher.d.ts +1 -1
- package/dist/shared/datasources/external/youtube/oauth/config.d.ts +1 -1
- package/dist/shared/datasources/samples.d.ts +1 -1
- package/dist/shared/datasources/types.d.ts +1 -1
- package/dist/shared/{datasources-DilDY3W4.d.ts → datasources-uXWaptq2.d.ts} +39 -8
- package/dist/shared/datasources.d.ts +1 -1
- package/dist/shared/manifest.d.ts +2 -1
- package/dist/shared/manifest.js +1 -1
- package/dist/shared/metafile-esm.json +1 -1
- package/dist/shared/page.d.ts +2 -2
- package/dist/shared/page.js +1 -1
- package/dist/shared/template-config.d.ts +2 -2
- package/dist/shared/theme.d.ts +3 -3
- package/dist/shared/theme.js +1 -1
- package/package.json +1 -1
package/dist/node/cli/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
-
import{createLogger as h}from"vite";var g="0.0.
|
|
2
|
+
import{createLogger as h}from"vite";var g="0.0.60";import i from"chalk";function E(e,t,o=!1){let r=h(e==="debug"?"info":e,{prefix:"[enpage]",allowClearScreen:t});return o&&r.info(i.hex("#7270c6").bold(`\u{1F680} Enpage v${g}
|
|
3
3
|
`)),{...r,success:(s,n)=>r.info(i.green(s),n),error:(s,n)=>r.error(i.red(s),n),warn:(s,n)=>r.warn(i.yellow(s),n),warnOnce:(s,n)=>r.warnOnce(i.yellow(s),n),debug:(s,n)=>{e==="debug"&&r.info(i.gray(s),n)}}}var p=E();var m="enpage-cli";var I=process.env.PUBLIC_ENPAGE_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",u=process.env.PUBLIC_ENPAGE_API_BASE_URL??"https://api.enpage.co",b=process.env.PUBLIC_ENPAGE_FRONTEND_BASE_URL??"https://enpage.co";import _ from"conf";import c from"node:path";import T from"node:crypto";import a from"node:fs";import{fileURLToPath as x}from"node:url";import M from"chalk";var L=x(new URL(".",import.meta.url)),R=O(),d=new _({projectName:m,encryptionKey:R,clearInvalidConfig:!0});function k(){let e=L;for(;e!==c.parse(e).root;){let t=c.join(e,"node_modules");if(a.existsSync(t))return t;e=c.dirname(e)}return null}function O(){let e=k();if(!e)throw new Error("Could not find nearest node_modules directory.");let t=c.join(e,".enpage-tmp");a.existsSync(t)||a.mkdirSync(t,{recursive:!0,mode:448});let o=c.join(t,".enpage-key");if(!a.existsSync(o)){let s=T.randomBytes(32).toString("hex");return a.writeFileSync(o,s,{mode:384,flush:!0}),s}return a.readFileSync(o,"utf8")}async function J(e,t,o={}){d.get("access_token")&&(o.Authorization=`Bearer ${d.get("access_token")}`);let r=await fetch(l(e),{method:"POST",headers:{"Content-Type":t instanceof URLSearchParams?"application/x-www-form-urlencoded":"application/json",...o},body:t instanceof URLSearchParams?t:JSON.stringify(t)}).catch(s=>{p.error(`Fatal Error requesting API: ${s.message} (${s.cause.code})`),p.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return y(r)}async function K(e,t={}){d.get("access_token")&&(t.Authorization=`Bearer ${d.get("access_token")}`);let o=await fetch(l(e),{headers:t,method:"GET"}).catch(r=>{p.error(`Fatal Error requesting API: ${r.message} (${r.cause.code})`),p.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return y(o)}function l(e){let t=new URL(u.endsWith("/")?u:`${u}/`);return new URL(e,t)}async function y(e){let t=e.headers.get("content-type")?.startsWith("application/json")?await e.json():await e.text();return e.ok?{isSuccess:!0,isError:!1,status:e.status,statusText:e.statusText,data:t}:{isSuccess:!1,isError:!0,status:e.status,statusText:e.statusText,data:t}}export{K as get,J as post};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
-
import I from"chalk";import{confirm as b}from"@inquirer/prompts";import A from"open";var y="enpage-cli";var g=process.env.PUBLIC_ENPAGE_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",u=process.env.PUBLIC_ENPAGE_API_BASE_URL??"https://api.enpage.co",j=process.env.PUBLIC_ENPAGE_FRONTEND_BASE_URL??"https://enpage.co";var _="oauth/devicecode",h="oauth/token";import{createLogger as x}from"vite";var E="0.0.
|
|
2
|
+
import I from"chalk";import{confirm as b}from"@inquirer/prompts";import A from"open";var y="enpage-cli";var g=process.env.PUBLIC_ENPAGE_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",u=process.env.PUBLIC_ENPAGE_API_BASE_URL??"https://api.enpage.co",j=process.env.PUBLIC_ENPAGE_FRONTEND_BASE_URL??"https://enpage.co";var _="oauth/devicecode",h="oauth/token";import{createLogger as x}from"vite";var E="0.0.60";import i from"chalk";function L(t,e,n=!1){let s=x(t==="debug"?"info":t,{prefix:"[enpage]",allowClearScreen:e});return n&&s.info(i.hex("#7270c6").bold(`\u{1F680} Enpage v${E}
|
|
3
3
|
`)),{...s,success:(r,o)=>s.info(i.green(r),o),error:(r,o)=>s.error(i.red(r),o),warn:(r,o)=>s.warn(i.yellow(r),o),warnOnce:(r,o)=>s.warnOnce(i.yellow(r),o),debug:(r,o)=>{t==="debug"&&s.info(i.gray(r),o)}}}var m=L();import v from"conf";import p from"node:path";import k from"node:crypto";import a from"node:fs";import{fileURLToPath as R}from"node:url";import Q from"chalk";var O=R(new URL(".",import.meta.url)),w=N(),c=new v({projectName:y,encryptionKey:w,clearInvalidConfig:!0});function P(){let t=O;for(;t!==p.parse(t).root;){let e=p.join(t,"node_modules");if(a.existsSync(e))return e;t=p.dirname(t)}return null}function N(){let t=P();if(!t)throw new Error("Could not find nearest node_modules directory.");let e=p.join(t,".enpage-tmp");a.existsSync(e)||a.mkdirSync(e,{recursive:!0,mode:448});let n=p.join(e,".enpage-key");if(!a.existsSync(n)){let r=k.randomBytes(32).toString("hex");return a.writeFileSync(n,r,{mode:384,flush:!0}),r}return a.readFileSync(n,"utf8")}async function l(t,e,n={}){c.get("access_token")&&(n.Authorization=`Bearer ${c.get("access_token")}`);let s=await fetch(S(t),{method:"POST",headers:{"Content-Type":e instanceof URLSearchParams?"application/x-www-form-urlencoded":"application/json",...n},body:e instanceof URLSearchParams?e:JSON.stringify(e)}).catch(r=>{m.error(`Fatal Error requesting API: ${r.message} (${r.cause.code})`),m.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return C(s)}function S(t){let e=new URL(u.endsWith("/")?u:`${u}/`);return new URL(t,e)}async function C(t){let e=t.headers.get("content-type")?.startsWith("application/json")?await t.json():await t.text();return t.ok?{isSuccess:!0,isError:!1,status:t.status,statusText:t.statusText,data:e}:{isSuccess:!1,isError:!0,status:t.status,statusText:t.statusText,data:e}}async function D(t,e){for(;;){let n=new URLSearchParams({grant_type:"device_code",device_code:t,client_id:g}),s=await l(h,n),{data:r,isSuccess:o}=s;if(o)return r;if(r.error==="authorization_pending")await new Promise(f=>setTimeout(f,5e3));else return e.error(`Error while polling for login: ${r.error_description??r.error}`),!1}}async function de({options:t,logger:e}){e.info(`Logging in to Enpage...
|
|
4
4
|
`);let{isError:n,data:s}=await l(_,{client_id:g,scope:"profile,templates:publish"});n&&(e.error("Failed to get device code. Please try again."),e.error(`Error: ${s.error_description??s.error}`),process.exit(1));let{verification_uri:r,device_code:o}=s;await b({message:"Would you like to open the login page in your browser?",default:!0}).catch(U=>{process.exit(0)})?A(r):e.info(`
|
|
5
5
|
Please visit the following URL to login:
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
-
import{resolve as S}from"node:path";import{existsSync as D,readFileSync as ot,writeFileSync as
|
|
3
|
-
`)),{...o,success:(
|
|
4
|
-
${c}`:c,
|
|
5
|
-
${u.trim()}`:
|
|
2
|
+
import{resolve as S}from"node:path";import{existsSync as D,readFileSync as ot,writeFileSync as st}from"node:fs";import O from"chalk";function I(){let e;if(process.env.npm_config_user_agent){let t=process.env.npm_config_user_agent.split(" ")[0];e=t.slice(0,t.lastIndexOf("/"))}return e||(console.log("Warning: could not detect package manager"),e="npm"),e}function B(e){return`[${e.error}]${e.error_description?`: ${e.error_description}`:""}`}var W="enpage-cli";var pt=process.env.PUBLIC_ENPAGE_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",w=process.env.PUBLIC_ENPAGE_API_BASE_URL??"https://api.enpage.co",ct=process.env.PUBLIC_ENPAGE_FRONTEND_BASE_URL??"https://enpage.co",H=10;var q="oauth/userinfo",J="v1/templates";import fe from"conf";import{createLogger as ge}from"vite";var V="0.0.60";import A from"chalk";function me(e,t,r=!1){let o=ge(e==="debug"?"info":e,{prefix:"[enpage]",allowClearScreen:t});return r&&o.info(A.hex("#7270c6").bold(`\u{1F680} Enpage v${V}
|
|
3
|
+
`)),{...o,success:(n,i)=>o.info(A.green(n),i),error:(n,i)=>o.error(A.red(n),i),warn:(n,i)=>o.warn(A.yellow(n),i),warnOnce:(n,i)=>o.warnOnce(A.yellow(n),i),debug:(n,i)=>{e==="debug"&&o.info(A.gray(n),i)}}}var g=me();async function F(e,t,r={}){P.get("access_token")&&(r.Authorization=`Bearer ${P.get("access_token")}`);let o=await fetch(K(e),{method:"POST",headers:{"Content-Type":t instanceof URLSearchParams?"application/x-www-form-urlencoded":"application/json",...r},body:t instanceof URLSearchParams?t:JSON.stringify(t)}).catch(n=>{g.error(`Fatal Error requesting API: ${n.message} (${n.cause.code})`),g.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return Y(o)}async function X(e,t={}){P.get("access_token")&&(t.Authorization=`Bearer ${P.get("access_token")}`);let r=await fetch(K(e),{headers:t,method:"GET"}).catch(o=>{g.error(`Fatal Error requesting API: ${o.message} (${o.cause.code})`),g.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return Y(r)}function K(e){let t=new URL(w.endsWith("/")?w:`${w}/`);return new URL(e,t)}async function Y(e){let t=e.headers.get("content-type")?.startsWith("application/json")?await e.json():await e.text();return e.ok?{isSuccess:!0,isError:!1,status:e.status,statusText:e.statusText,data:t}:{isSuccess:!1,isError:!0,status:e.status,statusText:e.statusText,data:t}}import U from"node:path";import ye from"node:crypto";import k from"node:fs";import{fileURLToPath as he}from"node:url";import Se from"chalk";var be=he(new URL(".",import.meta.url)),xe=Oe(),P=new fe({projectName:W,encryptionKey:xe,clearInvalidConfig:!0});async function Q(e=!1){let t=P.get("access_token"),r=P.get("expires_at");if(!t)return!1;if(r&&r<Date.now())return console.log("Seems like your token expired..."),!1;if(!e)return!0;let{isSuccess:o}=await X(q);return o}function Z(){let e=P.get("access_token");if(!e){let t=I();throw new Error(`Access token not found. Please run ${Se.cyan(`${t} run enpage:login`)} to authenticate.`)}return e}function Pe(){let e=be;for(;e!==U.parse(e).root;){let t=U.join(e,"node_modules");if(k.existsSync(t))return t;e=U.dirname(e)}return null}function Oe(){let e=Pe();if(!e)throw new Error("Could not find nearest node_modules directory.");let t=U.join(e,".enpage-tmp");k.existsSync(t)||k.mkdirSync(t,{recursive:!0,mode:448});let r=U.join(t,".enpage-key");if(!k.existsSync(r)){let n=ye.randomBytes(32).toString("hex");return k.writeFileSync(r,n,{mode:384,flush:!0}),n}return k.readFileSync(r,"utf8")}import N from"node:path";import j from"node:fs";import Ue from"node:crypto";import Ne from"fast-glob";import oe from"node:http";import je from"node:https";import{pipeline as De}from"node:stream";import re from"chalk";import Ie from"form-data";import*as M from"node:fs";var Ee=/[<>"|?*\n\r\t\f\x00-\x1F]/,we=/(?:^|\/)[*]{2}($|\/)/,Te=248,ve=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Ae=e=>typeof e=="string"&&e.length<=Te&&!Ee.test(e),ke=e=>e.split(/\r\n?|\n/);var _e=e=>ve(e)&&Array.isArray(e.patterns)&&Array.isArray(e.sections);var G=(e,t={})=>{let r=t.path;if(_e(e))return e;Ae(e)&&M.existsSync(e)&&(r=e,e=M.readFileSync(e,"utf8"));let o=ke(e),n=new Map,i={sections:[],patterns:[]},p={name:"default",patterns:[]},s=null;for(let a of o){let c=a.trim();if(c.startsWith("#")){let[,u]=/^#+\s*(.*)\s*$/.exec(c)||[];if(s){n.delete(s.name),s.comment=s.comment?`${s.comment}
|
|
4
|
+
${c}`:c,s.name=u?`${s.name.trim()}
|
|
5
|
+
${u.trim()}`:s.name.trim(),n.set(s.name.toLowerCase().trim(),s);continue}p={name:u?.trim()||"",comment:c,patterns:[]},n.set(p.name.toLowerCase(),p),i.sections.push(p),s=p;continue}c!==""&&(p.patterns.push(c),i.patterns.push(c)),s=null}return(t.dedupe===!0||t.unique===!0)&&(i=ee(i,{...t,format:!1})),i.path=r,i.input=Buffer.from(e),i.format=a=>Ce(i,{...t,...a}),i.dedupe=a=>ee(i,{...t,...a}),i.globs=a=>$e(i,{path:r,...t,...a}),i};var ee=(e,t)=>{let r=G(e,{...t,dedupe:!1}),o=new Map,n={sections:[],patterns:[]},i;for(let p of r.sections){let{name:s="",comment:a,patterns:c}=p,u=s.trim().toLowerCase();for(let f of c)n.patterns.includes(f)||n.patterns.push(f);s&&o.has(u)?(i=o.get(u),i.patterns=[...i.patterns,...c]):(i={name:s,comment:a,patterns:c},n.sections.push(i),o.set(u,i))}for(let p of n.sections)p.patterns=[...new Set(p.patterns)];return n},Le=e=>{if(we.test(e))return e;let t=!1;return e.startsWith("/")?(e=e.slice(1),t=!0):e.slice(1,e.length-1).includes("/")&&(t=!0),e+=e.endsWith("/")?"**/":"/**",t?e:`**/${e}`},$e=(e,t={})=>{let r=G(e,t),o=[],n=0,i=r.patterns.concat(t.ignore||[]).concat((t.unignore||[]).map(s=>s.startsWith("!")?s:`!${s}`)),p=(s,a)=>{let c=o[o.length-1],u=s?"unignore":"ignore";c&&c.type===u?c.patterns.includes(a)||c.patterns.push(a):(o.push({type:u,path:t.path||null,patterns:[a],index:n}),n++)};for(let s of i){let a="";s.startsWith("!")&&(s=s.slice(1),a="!"),p(a,s.startsWith("/")?s.slice(1):s),p(a,Le(s))}return o},Re=(e={name:"",patterns:[]})=>{let t=[e.comment||""];return e.patterns?.length&&(t.push(e.patterns.join(`
|
|
6
6
|
`)),t.push("")),t.join(`
|
|
7
|
-
`)},Ce=(e,t={})=>{let r=
|
|
8
|
-
`)};var te=
|
|
9
|
-
`))}async function
|
|
10
|
-
`),g.info("The following files would have been uploaded:"),
|
|
7
|
+
`)},Ce=(e,t={})=>{let r=G(e,t),o=t.formatSection||Re,n=r.sections||r,i=[];for(let p of[].concat(n))i.push(o(p));return i.join(`
|
|
8
|
+
`)};var te=G;import Fe from"p-queue";import Me from"ora";import{customAlphabet as Ge}from"nanoid";var _=class extends Error{constructor(r,o,n){super(`${r}: ${o}`);this.error=r;this.error_description=o;this.filename=n;this.name="UploadError"}},ze={maxDataSize:12*1024*1024,retryAttempts:2,retryDelay:1e3},Be=new oe.Agent({keepAlive:!0,maxSockets:10,keepAliveMsecs:3e3});async function We(e){let t=N.join(e,".gitignore"),o=j.existsSync(t)?te(j.readFileSync(t,"utf-8")).patterns:[];return Ne("**/*",{cwd:e,onlyFiles:!0,dot:!0,absolute:!0,ignore:["node_modules/**",".cache/**","**/.DS_Store",".gitignore",".env",".env.*",".git/**","dist/**",...o]})}async function He(e,t,r,o,n,i,p){let s=async a=>{try{return await qe(e,t,r,o,n,i,p)}catch(c){if(a<p.retryAttempts)return g.warn(`Retrying upload for ${t} (attempt ${a+1})`),await new Promise(u=>setTimeout(u,p.retryDelay)),s(a+1);throw c}};return s(0)}async function qe(e,t,r,o,n,i,p){return new Promise((s,a)=>{let c=j.statSync(e),u=N.basename(e),f=Date.now(),b=new Ie({maxDataSize:p.maxDataSize}),L=j.createReadStream(e),$=0,T=l=>{$+=l.length};L.on("data",T),b.append("file",L,{filename:u,knownLength:c.size});let v={agent:Be,method:"POST",headers:{authorization:`Bearer ${i}`,"x-enpage-template-file-path":t,"x-enpage-template-id":o,...b.getHeaders()}},E=(r.startsWith("https")?je:oe).request(r,v,l=>{let x="";l.on("data",R=>{x+=R}),l.on("end",()=>{let R=Date.now(),ue={fileName:u,fileSize:c.size,uploadDuration:R-f,statusCode:l.statusCode??0,serverResponse:x};if(l.statusCode&&l.statusCode>=200&&l.statusCode<300)n.text=`Uploaded ${t}`,s(ue);else{let C;if(l.headers["content-type"]?.startsWith("application/json")){let z=JSON.parse(x);C=new _(z.error||"unknown_error",z.error_description||"Unknown error occurred",t)}else C=new _("unknown_error",x||"Unknown error occurred",t);n.fail(`Failed to upload ${t} [${C.error}] ${C.error_description}`),a(C)}})});E.on("error",l=>{a(new _("request_error",l.message,t))}),De(b,E,l=>{l&&a(new _("pipeline_error",`Pipeline failed for ${u}: ${l.message}`,t))})})}function Je(e,t,r){r.length>0?(g.error(re.red(`Failed to upload ${r.length} files:`)),r.forEach(o=>{let n=o.reason;g.error(`- ${n.filename}: ${n.error_description} (${n.error})`)})):g.info(re.green(`Uploaded ${t.length} files successfully for template ${e}.
|
|
9
|
+
`))}async function se(e,t,r,o=!1,n={}){let i={...ze,...n},p=new Fe({concurrency:H}),s=await We(t),a=s.length,c={},u=Xe(),f=0;for(let d of s){let E=N.relative(t,d),l=await Ve(d);c[E]=l}o&&(g.info(`Dry run mode enabled. Skipping upload.
|
|
10
|
+
`),g.info("The following files would have been uploaded:"),s.forEach(d=>g.info(`- ${d}`)),process.exit(0));let b=Me(`Uploading ${a} files...`).start(),L=s.map(d=>{let E=N.resolve(t,d),l=N.relative(t,d),x=`${w}/v1/templates/${e}/upload/${u}`;return p.add(async()=>{let R=await He(E,l,x,e,b,r,i);return f++,R})}),$=await Promise.allSettled(L);b.stop();let T=$.filter(d=>d.status==="fulfilled"),v=$.filter(d=>d.status==="rejected");if(Je(e,T.map(d=>d.value),v),!v.length&&T.length){let d=`${w}/v1/templates/${e}/upload/${u}/finalize`,l=await F(d,{signatures:c});if(l.isError)return g.error(`Failed to finalize upload: ${l.data.error_description} (${l.data.error})`),{filesCount:a,uploadedFiles:T.map(x=>x.value),failedFiles:[],success:!1}}return{filesCount:a,uploadedFiles:T.map(d=>d.value),failedFiles:v,success:v.length===0}}async function Ve(e){let t=await Ue.subtle.digest("SHA-1",j.readFileSync(e));return Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("")}function Xe(){let e=Ge("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",5),t=new Date,r=t.getUTCFullYear(),o=(t.getUTCMonth()+1).toString().padStart(2,"0"),n=t.getUTCDate().toString().padStart(2,"0"),i=t.getUTCHours().toString().padStart(2,"0"),p=t.getUTCMinutes().toString().padStart(2,"0"),s=t.getUTCSeconds().toString().padStart(2,"0");return`${r}${o}${n}${i}${p}${s}_${e()}`}import le from"node:path";import y from"zod";var ne=y.object({id:y.string().optional(),name:y.string(),description:y.string(),readme:y.record(y.string()).optional(),tags:y.array(y.string()).optional(),author:y.string(),thumbnail:y.string().url().optional(),homepage:y.string().url().optional()});import{Type as m}from"@sinclair/typebox";import{Value as Qt}from"@sinclair/typebox/value";function ie(e){for(let t in e)if(t.startsWith("$"))throw new Error(`Attribute names starting with '$' (like "${t}") are reserved for internal use. Please rename it.`);return m.Object({...Ke,...e},{$id:"attributes"})}var h={string(e,t="",r){return m.String({title:e,default:t,...r})},number(e,t=0,r){return m.Number({title:e,default:t,...r})},boolean(e,t=!1,r){let o={"ui:field":"switch"};return m.Boolean({title:e,default:t,...o,...r})},enum(e,t,r){let o={"ui:field":"enum","ui:display":r.displayAs||"select"},{options:n,displayAs:i,...p}=r;return m.Union(n.map(s=>m.Literal(typeof s=="string"?s:s.value,{title:typeof s=="string"?s:s.title,"ui:icon":typeof s=="string"?void 0:s.icon})),{title:e,default:t,...o,...p})},file(e,t="",r={}){return m.String({title:e,default:t,...r,format:"data-url"})},url(e,t="",r={}){return m.String({title:e,default:t,...r,format:"uri"})},color(e,t="",r){let o={"ui:field":"color"};return m.String({title:e,default:t,...o,...r})},date(e,t=new Date,r={}){return m.String({title:e,default:t.toISOString(),...r,format:"date"})},datetime(e,t=new Date,r={}){return m.String({title:e,default:t.toISOString(),...r,format:"date-time"})},geolocation(e,t,r={}){return m.Object({lat:m.Number({minimum:-90,maximum:90}),lng:m.Number({minimum:-180,maximum:180}),name:m.Optional(m.String({title:"Name"}))},{title:e,default:t,...r})}},Ke={$pageLanguage:h.enum("Page language","en",{options:[{value:"ar",title:"Arabic"},{value:"zh",title:"Chinese"},{value:"cs",title:"Czech"},{value:"nl",title:"Dutch"},{value:"en",title:"English"},{value:"fr",title:"French"},{value:"de",title:"German"},{value:"he",title:"Hebrew"},{value:"hi",title:"Hindi"},{value:"it",title:"Italian"},{value:"ja",title:"Japanese"},{value:"ko",title:"Korean"},{value:"fa",title:"Persian"},{value:"pl",title:"Polish"},{value:"pt",title:"Portuguese"},{value:"ru",title:"Russian"},{value:"es",title:"Spanish"},{value:"tr",title:"Turkish"},{value:"vi",title:"Vietnamese"}],"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pagePath:h.string("Page path","/",{description:"The URL path of the page","ui:group":"location","ui:group:title":"Location","ui:group:order":1,"ui:field":"path"}),$pageTitle:h.string("Page title","Untitled",{"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pageDescription:h.string("Page description","",{"ui:widget":"textarea","ui:options":{rows:3,widget:"textarea"},"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pageKeywords:h.string("Page keywords","",{"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pageLastUpdated:h.datetime("Last updated",void 0,{"ui:hidden":!0}),$pageWidth:h.enum("Page width","max-w-screen-2xl",{options:[{value:"max-w-screen-lg",title:"M",description:"Common for text-heavy content/blog posts"},{value:"max-w-screen-xl",title:"L",description:"Usefull or some landing pages"},{value:"max-w-screen-2xl",title:"XL",description:"Common width"},{value:"max-w-full",title:"Full",description:"Takes the entire space"}],description:"The maximum width of the page. Desktop only.",displayAs:"button-group","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$pagePaddingVertical:h.enum("Page vertical spacing","20",{options:[{value:"0",title:"None"},{value:"10",title:"S"},{value:"20",title:"M"},{value:"30",title:"L"},{value:"50",title:"XL"}],description:"Vertical spacing. Desktop only.",displayAs:"button-group","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$pagePaddingHorizontal:h.enum("Page horizontal spacing","20",{options:[{value:"0",title:"None"},{value:"10",title:"S"},{value:"20",title:"M"},{value:"30",title:"L"},{value:"50",title:"XL"}],description:"Horizontal spacing. Desktop only.",displayAs:"button-group","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$backgroundColor:h.color("Page background color","#ffffff",{"ui:field":"color","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$textColor:h.color("Default text color","#222222",{"ui:field":"color","ui:group":"layout","ui:group:title":"Page Layout & Design","ui:color-type":"page-text"})};import Ye from"node:fs";import{readFile as Qe}from"node:fs/promises";import Ze from"fast-glob";import{fromError as et}from"zod-validation-error";import{basename as ae,dirname as tt,extname as rt}from"node:path";async function pe(e,t=g){Ye.existsSync(e)||(t.error(`\u{1F534} No enpage.config.js found!
|
|
11
11
|
Your project must have an enpage.config.js file in the root directory.
|
|
12
12
|
|
|
13
|
-
`),process.exit(1));let r=await import(e),o=tt(e),
|
|
13
|
+
`),process.exit(1));let r=await import(e),o=tt(e),n={},i=await Ze(["README.enpage.md","README.enpage.*.md"],{cwd:o,onlyFiles:!0,absolute:!0,caseSensitiveMatch:!1});for(let p of i){let s=ae(p,".md"),a=rt(s),c=(a===".enpage"?"en":a.substring(1)).toLowerCase();t.debug(`Found template readme file (${c}): ${ae(p)}`),n[c]=await Qe(p,"utf-8")}return r.manifest.readme=n,r}function ce(e,t){for(let o in e.datasources)!(e.datasources[o].provider||e.datasources[o].provider==="json")&&!e.datasources[o].sampleData&&(t.error(`\u{1F534} Error: Datasource "${o}" is missing sample data - nothing will be rendered during development! Please check your enpage.config.js file and add a "sampleData" key to your ${o} datasource.`),process.exit(1));e.attributes||(e.attributes=ie({}));let r=ne.safeParse(e.manifest);if(!r.success){t.error(`\u{1F534} Error: template manifest is invalid. Check your call to defineManifest().
|
|
14
14
|
`);let o=et(r.error);t.error(`Hint: ${o.toString()}
|
|
15
15
|
|
|
16
|
-
`),process.exit(1)}return e}async function br({options:e,args:t,logger:r}){if(!await Q(!0)){let f=I();r.error(` ${
|
|
16
|
+
`),process.exit(1)}return e}async function br({options:e,args:t,logger:r}){if(!await Q(!0)){let f=I();r.error(` ${O.redBright("Error")}: User token not found. Please run ${O.cyan(`${f} run enpage:login`)} to authenticate or set the ${O.cyan("ENPAGE_API_TOKEN")} environment variable.
|
|
17
17
|
`),process.exit(1)}let o=t.length?le.isAbsolute(t[0])?t[0]:S(process.cwd(),t[0]):process.cwd();D(o)||(r.error(` Template directory not found: ${o}. Aborting.
|
|
18
|
-
`),process.exit(1));let
|
|
18
|
+
`),process.exit(1));let n=t.length>1?le.isAbsolute(t[1])?t[1]:S(process.cwd(),t[1]):S(o,"dist");D(n)||(r.error(` Dist directory not found: ${n}.
|
|
19
19
|
Please run 'build' before publishing. Aborting.
|
|
20
|
-
`),process.exit(1)),D(S(o,"enpage.config.js"))||(r.error(` ${
|
|
21
|
-
`),process.exit(1));let i=await pe(S(o,"enpage.config.js"),r);ce(i,r);let p=Z(),
|
|
22
|
-
`),process.exit(1));let a=await it(
|
|
23
|
-
`),process.exit(1)),!a.enpage?.id){let{data:f,isError:b,status:L}=await F(J,{manifest:i.manifest});b&&(r.error(` ${
|
|
24
|
-
`),process.exit(1)),a.enpage??={},a.enpage.id=f.template.id;try{e.dryRun||
|
|
20
|
+
`),process.exit(1)),D(S(o,"enpage.config.js"))||(r.error(` ${O.redBright("Error")}: file enpage.config.js not found in ${o}. Aborting.
|
|
21
|
+
`),process.exit(1));let i=await pe(S(o,"enpage.config.js"),r);ce(i,r);let p=Z(),s=nt(o);s||(r.error(` ${O.redBright("Error")}: package.json file not found in ${o}. Aborting.
|
|
22
|
+
`),process.exit(1));let a=await it(s);if(a||(r.error(` ${O.redBright("Error")}: cannot read/parse package.json file in ${o}. Aborting.
|
|
23
|
+
`),process.exit(1)),!a.enpage?.id){let{data:f,isError:b,status:L}=await F(J,{manifest:i.manifest});b&&(r.error(` ${O.redBright("Error")}: Cannot register template: ${B(f)}
|
|
24
|
+
`),process.exit(1)),a.enpage??={},a.enpage.id=f.template.id;try{e.dryRun||st(s,JSON.stringify(a,null,2))}catch{r.error(` ${O.redBright("Error")}: Cannot update template id in package.json file located in ${o}. Aborting.
|
|
25
25
|
`),process.exit(1)}}let c=a.enpage.id;r.info(`Submitting template to Enpage...
|
|
26
|
-
`),(await
|
|
26
|
+
`),(await se(c,o,p,e.dryRun)).success||(r.error(`
|
|
27
27
|
Upload failed. See details above.
|
|
28
28
|
`),process.exit(1)),r.success(`Template ${c} published.
|
|
29
|
-
`)}function
|
|
29
|
+
`)}function nt(e){return D(S(e,"package.json"))?S(e,"package.json"):D(S(e,"template-package.json"))?S(e,"template-package.json"):!1}function it(e){try{return JSON.parse(ot(e,"utf-8"))}catch{return null}}export{br as publish};
|
|
30
30
|
/*!
|
|
31
31
|
* parse-gitignore <https://github.com/jonschlinkert/parse-gitignore>
|
|
32
32
|
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
-
import L from"node:path";import O from"node:fs";import ge from"node:crypto";import me from"fast-glob";var N="enpage-cli";var Ue=process.env.PUBLIC_ENPAGE_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",y=process.env.PUBLIC_ENPAGE_API_BASE_URL??"https://api.enpage.co",ke=process.env.PUBLIC_ENPAGE_FRONTEND_BASE_URL??"https://enpage.co",I=10;import B from"node:http";import fe from"node:https";import{pipeline as ye}from"node:stream";import{createLogger as q}from"vite";var D="0.0.
|
|
2
|
+
import L from"node:path";import O from"node:fs";import ge from"node:crypto";import me from"fast-glob";var N="enpage-cli";var Ue=process.env.PUBLIC_ENPAGE_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",y=process.env.PUBLIC_ENPAGE_API_BASE_URL??"https://api.enpage.co",ke=process.env.PUBLIC_ENPAGE_FRONTEND_BASE_URL??"https://enpage.co",I=10;import B from"node:http";import fe from"node:https";import{pipeline as ye}from"node:stream";import{createLogger as q}from"vite";var D="0.0.60";import _ from"chalk";function H(e,t,n=!1){let i=q(e==="debug"?"info":e,{prefix:"[enpage]",allowClearScreen:t});return n&&i.info(_.hex("#7270c6").bold(`\u{1F680} Enpage v${D}
|
|
3
3
|
`)),{...i,success:(s,r)=>i.info(_.green(s),r),error:(s,r)=>i.error(_.red(s),r),warn:(s,r)=>i.warn(_.yellow(s),r),warnOnce:(s,r)=>i.warnOnce(_.yellow(s),r),debug:(s,r)=>{e==="debug"&&i.info(_.gray(s),r)}}}var g=H();import z from"chalk";import he from"form-data";import*as A from"node:fs";var X=/[<>"|?*\n\r\t\f\x00-\x1F]/,J=/(?:^|\/)[*]{2}($|\/)/,V=248,K=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Y=e=>typeof e=="string"&&e.length<=V&&!X.test(e),Q=e=>e.split(/\r\n?|\n/);var Z=e=>K(e)&&Array.isArray(e.patterns)&&Array.isArray(e.sections);var C=(e,t={})=>{let n=t.path;if(Z(e))return e;Y(e)&&A.existsSync(e)&&(n=e,e=A.readFileSync(e,"utf8"));let i=Q(e),s=new Map,r={sections:[],patterns:[]},c={name:"default",patterns:[]},o=null;for(let a of i){let p=a.trim();if(p.startsWith("#")){let[,u]=/^#+\s*(.*)\s*$/.exec(p)||[];if(o){s.delete(o.name),o.comment=o.comment?`${o.comment}
|
|
4
4
|
${p}`:p,o.name=u?`${o.name.trim()}
|
|
5
5
|
${u.trim()}`:o.name.trim(),s.set(o.name.toLowerCase().trim(),o);continue}c={name:u?.trim()||"",comment:p,patterns:[]},s.set(c.name.toLowerCase(),c),r.sections.push(c),o=c;continue}p!==""&&(c.patterns.push(p),r.patterns.push(p)),o=null}return(t.dedupe===!0||t.unique===!0)&&(r=G(r,{...t,format:!1})),r.path=n,r.input=Buffer.from(e),r.format=a=>re(r,{...t,...a}),r.dedupe=a=>G(r,{...t,...a}),r.globs=a=>te(r,{path:n,...t,...a}),r};var G=(e,t)=>{let n=C(e,{...t,dedupe:!1}),i=new Map,s={sections:[],patterns:[]},r;for(let c of n.sections){let{name:o="",comment:a,patterns:p}=c,u=o.trim().toLowerCase();for(let h of p)s.patterns.includes(h)||s.patterns.push(h);o&&i.has(u)?(r=i.get(u),r.patterns=[...r.patterns,...p]):(r={name:o,comment:a,patterns:p},s.sections.push(r),i.set(u,r))}for(let c of s.sections)c.patterns=[...new Set(c.patterns)];return s},ee=e=>{if(J.test(e))return e;let t=!1;return e.startsWith("/")?(e=e.slice(1),t=!0):e.slice(1,e.length-1).includes("/")&&(t=!0),e+=e.endsWith("/")?"**/":"/**",t?e:`**/${e}`},te=(e,t={})=>{let n=C(e,t),i=[],s=0,r=n.patterns.concat(t.ignore||[]).concat((t.unignore||[]).map(o=>o.startsWith("!")?o:`!${o}`)),c=(o,a)=>{let p=i[i.length-1],u=o?"unignore":"ignore";p&&p.type===u?p.patterns.includes(a)||p.patterns.push(a):(i.push({type:u,path:t.path||null,patterns:[a],index:s}),s++)};for(let o of r){let a="";o.startsWith("!")&&(o=o.slice(1),a="!"),c(a,o.startsWith("/")?o.slice(1):o),c(a,ee(o))}return i},se=(e={name:"",patterns:[]})=>{let t=[e.comment||""];return e.patterns?.length&&(t.push(e.patterns.join(`
|
package/dist/node/cli/program.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
3
|
-
import{program as C}from"commander";import{resolve as S}from"node:path";import{existsSync as F,readFileSync as ht,writeFileSync as bt}from"node:fs";import
|
|
3
|
+
import{program as C}from"commander";import{resolve as S}from"node:path";import{existsSync as F,readFileSync as ht,writeFileSync as bt}from"node:fs";import x from"chalk";function G(){let e;if(process.env.npm_config_user_agent){let t=process.env.npm_config_user_agent.split(" ")[0];e=t.slice(0,t.lastIndexOf("/"))}return e||(console.log("Warning: could not detect package manager"),e="npm"),e}function K(e){return`[${e.error}]${e.error_description?`: ${e.error_description}`:""}`}var Y="enpage-cli";var W=process.env.PUBLIC_ENPAGE_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",w=process.env.PUBLIC_ENPAGE_API_BASE_URL??"https://api.enpage.co",kt=process.env.PUBLIC_ENPAGE_FRONTEND_BASE_URL??"https://enpage.co",Q=10,Z="oauth/devicecode",ee="oauth/token",te="oauth/userinfo",re="v1/templates";import Ae from"conf";import{createLogger as Le}from"vite";var oe="0.0.60";import L from"chalk";function H(e,t,r=!1){let o=Le(e==="debug"?"info":e,{prefix:"[enpage]",allowClearScreen:t});return r&&o.info(L.hex("#7270c6").bold(`\u{1F680} Enpage v${oe}
|
|
4
4
|
`)),{...o,success:(s,i)=>o.info(L.green(s),i),error:(s,i)=>o.error(L.red(s),i),warn:(s,i)=>o.warn(L.yellow(s),i),warnOnce:(s,i)=>o.warnOnce(L.yellow(s),i),debug:(s,i)=>{e==="debug"&&o.info(L.gray(s),i)}}}var m=H();async function P(e,t,r={}){f.get("access_token")&&(r.Authorization=`Bearer ${f.get("access_token")}`);let o=await fetch(se(e),{method:"POST",headers:{"Content-Type":t instanceof URLSearchParams?"application/x-www-form-urlencoded":"application/json",...r},body:t instanceof URLSearchParams?t:JSON.stringify(t)}).catch(s=>{m.error(`Fatal Error requesting API: ${s.message} (${s.cause.code})`),m.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return ie(o)}async function ne(e,t={}){f.get("access_token")&&(t.Authorization=`Bearer ${f.get("access_token")}`);let r=await fetch(se(e),{headers:t,method:"GET"}).catch(o=>{m.error(`Fatal Error requesting API: ${o.message} (${o.cause.code})`),m.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return ie(r)}function se(e){let t=new URL(w.endsWith("/")?w:`${w}/`);return new URL(e,t)}async function ie(e){let t=e.headers.get("content-type")?.startsWith("application/json")?await e.json():await e.text();return e.ok?{isSuccess:!0,isError:!1,status:e.status,statusText:e.statusText,data:t}:{isSuccess:!1,isError:!0,status:e.status,statusText:e.statusText,data:t}}import N from"node:path";import ke from"node:crypto";import A from"node:fs";import{fileURLToPath as Ce}from"node:url";import Re from"chalk";var $e=Ce(new URL(".",import.meta.url)),Ue=Ne(),f=new Ae({projectName:Y,encryptionKey:Ue,clearInvalidConfig:!0});async function ae(e=!1){let t=f.get("access_token"),r=f.get("expires_at");if(!t)return!1;if(r&&r<Date.now())return console.log("Seems like your token expired..."),!1;if(!e)return!0;let{isSuccess:o}=await ne(te);return o}function pe(){let e=f.get("access_token");if(!e){let t=G();throw new Error(`Access token not found. Please run ${Re.cyan(`${t} run enpage:login`)} to authenticate.`)}return e}function De(){let e=$e;for(;e!==N.parse(e).root;){let t=N.join(e,"node_modules");if(A.existsSync(t))return t;e=N.dirname(e)}return null}function Ne(){let e=De();if(!e)throw new Error("Could not find nearest node_modules directory.");let t=N.join(e,".enpage-tmp");A.existsSync(t)||A.mkdirSync(t,{recursive:!0,mode:448});let r=N.join(t,".enpage-key");if(!A.existsSync(r)){let s=ke.randomBytes(32).toString("hex");return A.writeFileSync(r,s,{mode:384,flush:!0}),s}return A.readFileSync(r,"utf8")}import j from"node:path";import I from"node:fs";import Je from"node:crypto";import Xe from"fast-glob";import de from"node:http";import Ke from"node:https";import{pipeline as Ye}from"node:stream";import ue from"chalk";import Qe from"form-data";import*as M from"node:fs";var je=/[<>"|?*\n\r\t\f\x00-\x1F]/,Ie=/(?:^|\/)[*]{2}($|\/)/,Fe=248,Ge=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Me=e=>typeof e=="string"&&e.length<=Fe&&!je.test(e),Be=e=>e.split(/\r\n?|\n/);var ze=e=>Ge(e)&&Array.isArray(e.patterns)&&Array.isArray(e.sections);var B=(e,t={})=>{let r=t.path;if(ze(e))return e;Me(e)&&M.existsSync(e)&&(r=e,e=M.readFileSync(e,"utf8"));let o=Be(e),s=new Map,i={sections:[],patterns:[]},p={name:"default",patterns:[]},n=null;for(let a of o){let c=a.trim();if(c.startsWith("#")){let[,u]=/^#+\s*(.*)\s*$/.exec(c)||[];if(n){s.delete(n.name),n.comment=n.comment?`${n.comment}
|
|
5
5
|
${c}`:c,n.name=u?`${n.name.trim()}
|
|
6
6
|
${u.trim()}`:n.name.trim(),s.set(n.name.toLowerCase().trim(),n);continue}p={name:u?.trim()||"",comment:c,patterns:[]},s.set(p.name.toLowerCase(),p),i.sections.push(p),n=p;continue}c!==""&&(p.patterns.push(c),i.patterns.push(c)),n=null}return(t.dedupe===!0||t.unique===!0)&&(i=ce(i,{...t,format:!1})),i.path=r,i.input=Buffer.from(e),i.format=a=>Ve(i,{...t,...a}),i.dedupe=a=>ce(i,{...t,...a}),i.globs=a=>He(i,{path:r,...t,...a}),i};var ce=(e,t)=>{let r=B(e,{...t,dedupe:!1}),o=new Map,s={sections:[],patterns:[]},i;for(let p of r.sections){let{name:n="",comment:a,patterns:c}=p,u=n.trim().toLowerCase();for(let y of c)s.patterns.includes(y)||s.patterns.push(y);n&&o.has(u)?(i=o.get(u),i.patterns=[...i.patterns,...c]):(i={name:n,comment:a,patterns:c},s.sections.push(i),o.set(u,i))}for(let p of s.sections)p.patterns=[...new Set(p.patterns)];return s},We=e=>{if(Ie.test(e))return e;let t=!1;return e.startsWith("/")?(e=e.slice(1),t=!0):e.slice(1,e.length-1).includes("/")&&(t=!0),e+=e.endsWith("/")?"**/":"/**",t?e:`**/${e}`},He=(e,t={})=>{let r=B(e,t),o=[],s=0,i=r.patterns.concat(t.ignore||[]).concat((t.unignore||[]).map(n=>n.startsWith("!")?n:`!${n}`)),p=(n,a)=>{let c=o[o.length-1],u=n?"unignore":"ignore";c&&c.type===u?c.patterns.includes(a)||c.patterns.push(a):(o.push({type:u,path:t.path||null,patterns:[a],index:s}),s++)};for(let n of i){let a="";n.startsWith("!")&&(n=n.slice(1),a="!"),p(a,n.startsWith("/")?n.slice(1):n),p(a,We(n))}return o},qe=(e={name:"",patterns:[]})=>{let t=[e.comment||""];return e.patterns?.length&&(t.push(e.patterns.join(`
|
|
7
7
|
`)),t.push("")),t.join(`
|
|
8
8
|
`)},Ve=(e,t={})=>{let r=B(e,t),o=t.formatSection||qe,s=r.sections||r,i=[];for(let p of[].concat(s))i.push(o(p));return i.join(`
|
|
9
|
-
`)};var le=B;import Ze from"p-queue";import et from"ora";import{customAlphabet as tt}from"nanoid";var k=class extends Error{constructor(r,o,s){super(`${r}: ${o}`);this.error=r;this.error_description=o;this.filename=s;this.name="UploadError"}},rt={maxDataSize:12*1024*1024,retryAttempts:2,retryDelay:1e3},ot=new de.Agent({keepAlive:!0,maxSockets:10,keepAliveMsecs:3e3});async function nt(e){let t=j.join(e,".gitignore"),o=I.existsSync(t)?le(I.readFileSync(t,"utf-8")).patterns:[];return Xe("**/*",{cwd:e,onlyFiles:!0,dot:!0,absolute:!0,ignore:["node_modules/**",".cache/**","**/.DS_Store",".gitignore",".env",".env.*",".git/**","dist/**",...o]})}async function st(e,t,r,o,s,i,p){let n=async a=>{try{return await it(e,t,r,o,s,i,p)}catch(c){if(a<p.retryAttempts)return m.warn(`Retrying upload for ${t} (attempt ${a+1})`),await new Promise(u=>setTimeout(u,p.retryDelay)),n(a+1);throw c}};return n(0)}async function it(e,t,r,o,s,i,p){return new Promise((n,a)=>{let c=I.statSync(e),u=j.basename(e),y=Date.now(),O=new Qe({maxDataSize:p.maxDataSize}),R=I.createReadStream(e),$=0,_=l=>{$+=l.length};R.on("data",_),O.append("file",R,{filename:u,knownLength:c.size});let T={agent:ot,method:"POST",headers:{authorization:`Bearer ${i}`,"x-enpage-template-file-path":t,"x-enpage-template-id":o,...O.getHeaders()}},
|
|
10
|
-
`))}async function me(e,t,r,o=!1,s={}){let i={...rt,...s},p=new Ze({concurrency:Q}),n=await nt(t),a=n.length,c={},u=ct(),y=0;for(let d of n){let
|
|
11
|
-
`),m.info("The following files would have been uploaded:"),n.forEach(d=>m.info(`- ${d}`)),process.exit(0));let O=et(`Uploading ${a} files...`).start(),R=n.map(d=>{let
|
|
9
|
+
`)};var le=B;import Ze from"p-queue";import et from"ora";import{customAlphabet as tt}from"nanoid";var k=class extends Error{constructor(r,o,s){super(`${r}: ${o}`);this.error=r;this.error_description=o;this.filename=s;this.name="UploadError"}},rt={maxDataSize:12*1024*1024,retryAttempts:2,retryDelay:1e3},ot=new de.Agent({keepAlive:!0,maxSockets:10,keepAliveMsecs:3e3});async function nt(e){let t=j.join(e,".gitignore"),o=I.existsSync(t)?le(I.readFileSync(t,"utf-8")).patterns:[];return Xe("**/*",{cwd:e,onlyFiles:!0,dot:!0,absolute:!0,ignore:["node_modules/**",".cache/**","**/.DS_Store",".gitignore",".env",".env.*",".git/**","dist/**",...o]})}async function st(e,t,r,o,s,i,p){let n=async a=>{try{return await it(e,t,r,o,s,i,p)}catch(c){if(a<p.retryAttempts)return m.warn(`Retrying upload for ${t} (attempt ${a+1})`),await new Promise(u=>setTimeout(u,p.retryDelay)),n(a+1);throw c}};return n(0)}async function it(e,t,r,o,s,i,p){return new Promise((n,a)=>{let c=I.statSync(e),u=j.basename(e),y=Date.now(),O=new Qe({maxDataSize:p.maxDataSize}),R=I.createReadStream(e),$=0,_=l=>{$+=l.length};R.on("data",_),O.append("file",R,{filename:u,knownLength:c.size});let T={agent:ot,method:"POST",headers:{authorization:`Bearer ${i}`,"x-enpage-template-file-path":t,"x-enpage-template-id":o,...O.getHeaders()}},E=(r.startsWith("https")?Ke:de).request(r,T,l=>{let v="";l.on("data",U=>{v+=U}),l.on("end",()=>{let U=Date.now(),_e={fileName:u,fileSize:c.size,uploadDuration:U-y,statusCode:l.statusCode??0,serverResponse:v};if(l.statusCode&&l.statusCode>=200&&l.statusCode<300)s.text=`Uploaded ${t}`,n(_e);else{let D;if(l.headers["content-type"]?.startsWith("application/json")){let X=JSON.parse(v);D=new k(X.error||"unknown_error",X.error_description||"Unknown error occurred",t)}else D=new k("unknown_error",v||"Unknown error occurred",t);s.fail(`Failed to upload ${t} [${D.error}] ${D.error_description}`),a(D)}})});E.on("error",l=>{a(new k("request_error",l.message,t))}),Ye(O,E,l=>{l&&a(new k("pipeline_error",`Pipeline failed for ${u}: ${l.message}`,t))})})}function at(e,t,r){r.length>0?(m.error(ue.red(`Failed to upload ${r.length} files:`)),r.forEach(o=>{let s=o.reason;m.error(`- ${s.filename}: ${s.error_description} (${s.error})`)})):m.info(ue.green(`Uploaded ${t.length} files successfully for template ${e}.
|
|
10
|
+
`))}async function me(e,t,r,o=!1,s={}){let i={...rt,...s},p=new Ze({concurrency:Q}),n=await nt(t),a=n.length,c={},u=ct(),y=0;for(let d of n){let E=j.relative(t,d),l=await pt(d);c[E]=l}o&&(m.info(`Dry run mode enabled. Skipping upload.
|
|
11
|
+
`),m.info("The following files would have been uploaded:"),n.forEach(d=>m.info(`- ${d}`)),process.exit(0));let O=et(`Uploading ${a} files...`).start(),R=n.map(d=>{let E=j.resolve(t,d),l=j.relative(t,d),v=`${w}/v1/templates/${e}/upload/${u}`;return p.add(async()=>{let U=await st(E,l,v,e,O,r,i);return y++,U})}),$=await Promise.allSettled(R);O.stop();let _=$.filter(d=>d.status==="fulfilled"),T=$.filter(d=>d.status==="rejected");if(at(e,_.map(d=>d.value),T),!T.length&&_.length){let d=`${w}/v1/templates/${e}/upload/${u}/finalize`,l=await P(d,{signatures:c});if(l.isError)return m.error(`Failed to finalize upload: ${l.data.error_description} (${l.data.error})`),{filesCount:a,uploadedFiles:_.map(v=>v.value),failedFiles:[],success:!1}}return{filesCount:a,uploadedFiles:_.map(d=>d.value),failedFiles:T,success:T.length===0}}async function pt(e){let t=await Je.subtle.digest("SHA-1",I.readFileSync(e));return Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("")}function ct(){let e=tt("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",5),t=new Date,r=t.getUTCFullYear(),o=(t.getUTCMonth()+1).toString().padStart(2,"0"),s=t.getUTCDate().toString().padStart(2,"0"),i=t.getUTCHours().toString().padStart(2,"0"),p=t.getUTCMinutes().toString().padStart(2,"0"),n=t.getUTCSeconds().toString().padStart(2,"0");return`${r}${o}${s}${i}${p}${n}_${e()}`}import Se from"node:path";import h from"zod";var ge=h.object({id:h.string().optional(),name:h.string(),description:h.string(),readme:h.record(h.string()).optional(),tags:h.array(h.string()).optional(),author:h.string(),thumbnail:h.string().url().optional(),homepage:h.string().url().optional()});import{Type as g}from"@sinclair/typebox";import{Value as Sr}from"@sinclair/typebox/value";function fe(e){for(let t in e)if(t.startsWith("$"))throw new Error(`Attribute names starting with '$' (like "${t}") are reserved for internal use. Please rename it.`);return g.Object({...lt,...e},{$id:"attributes"})}var b={string(e,t="",r){return g.String({title:e,default:t,...r})},number(e,t=0,r){return g.Number({title:e,default:t,...r})},boolean(e,t=!1,r){let o={"ui:field":"switch"};return g.Boolean({title:e,default:t,...o,...r})},enum(e,t,r){let o={"ui:field":"enum","ui:display":r.displayAs||"select"},{options:s,displayAs:i,...p}=r;return g.Union(s.map(n=>g.Literal(typeof n=="string"?n:n.value,{title:typeof n=="string"?n:n.title,"ui:icon":typeof n=="string"?void 0:n.icon})),{title:e,default:t,...o,...p})},file(e,t="",r={}){return g.String({title:e,default:t,...r,format:"data-url"})},url(e,t="",r={}){return g.String({title:e,default:t,...r,format:"uri"})},color(e,t="",r){let o={"ui:field":"color"};return g.String({title:e,default:t,...o,...r})},date(e,t=new Date,r={}){return g.String({title:e,default:t.toISOString(),...r,format:"date"})},datetime(e,t=new Date,r={}){return g.String({title:e,default:t.toISOString(),...r,format:"date-time"})},geolocation(e,t,r={}){return g.Object({lat:g.Number({minimum:-90,maximum:90}),lng:g.Number({minimum:-180,maximum:180}),name:g.Optional(g.String({title:"Name"}))},{title:e,default:t,...r})}},lt={$pageLanguage:b.enum("Page language","en",{options:[{value:"ar",title:"Arabic"},{value:"zh",title:"Chinese"},{value:"cs",title:"Czech"},{value:"nl",title:"Dutch"},{value:"en",title:"English"},{value:"fr",title:"French"},{value:"de",title:"German"},{value:"he",title:"Hebrew"},{value:"hi",title:"Hindi"},{value:"it",title:"Italian"},{value:"ja",title:"Japanese"},{value:"ko",title:"Korean"},{value:"fa",title:"Persian"},{value:"pl",title:"Polish"},{value:"pt",title:"Portuguese"},{value:"ru",title:"Russian"},{value:"es",title:"Spanish"},{value:"tr",title:"Turkish"},{value:"vi",title:"Vietnamese"}],"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pagePath:b.string("Page path","/",{description:"The URL path of the page","ui:group":"location","ui:group:title":"Location","ui:group:order":1,"ui:field":"path"}),$pageTitle:b.string("Page title","Untitled",{"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pageDescription:b.string("Page description","",{"ui:widget":"textarea","ui:options":{rows:3,widget:"textarea"},"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pageKeywords:b.string("Page keywords","",{"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pageLastUpdated:b.datetime("Last updated",void 0,{"ui:hidden":!0}),$pageWidth:b.enum("Page width","max-w-screen-2xl",{options:[{value:"max-w-screen-lg",title:"M",description:"Common for text-heavy content/blog posts"},{value:"max-w-screen-xl",title:"L",description:"Usefull or some landing pages"},{value:"max-w-screen-2xl",title:"XL",description:"Common width"},{value:"max-w-full",title:"Full",description:"Takes the entire space"}],description:"The maximum width of the page. Desktop only.",displayAs:"button-group","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$pagePaddingVertical:b.enum("Page vertical spacing","20",{options:[{value:"0",title:"None"},{value:"10",title:"S"},{value:"20",title:"M"},{value:"30",title:"L"},{value:"50",title:"XL"}],description:"Vertical spacing. Desktop only.",displayAs:"button-group","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$pagePaddingHorizontal:b.enum("Page horizontal spacing","20",{options:[{value:"0",title:"None"},{value:"10",title:"S"},{value:"20",title:"M"},{value:"30",title:"L"},{value:"50",title:"XL"}],description:"Horizontal spacing. Desktop only.",displayAs:"button-group","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$backgroundColor:b.color("Page background color","#ffffff",{"ui:field":"color","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$textColor:b.color("Default text color","#222222",{"ui:field":"color","ui:group":"layout","ui:group:title":"Page Layout & Design","ui:color-type":"page-text"})};import ut from"node:fs";import{readFile as dt}from"node:fs/promises";import mt from"fast-glob";import{fromError as gt}from"zod-validation-error";import{basename as ye,dirname as ft,extname as yt}from"node:path";async function he(e,t=m){ut.existsSync(e)||(t.error(`\u{1F534} No enpage.config.js found!
|
|
12
12
|
Your project must have an enpage.config.js file in the root directory.
|
|
13
13
|
|
|
14
14
|
`),process.exit(1));let r=await import(e),o=ft(e),s={},i=await mt(["README.enpage.md","README.enpage.*.md"],{cwd:o,onlyFiles:!0,absolute:!0,caseSensitiveMatch:!1});for(let p of i){let n=ye(p,".md"),a=yt(n),c=(a===".enpage"?"en":a.substring(1)).toLowerCase();t.debug(`Found template readme file (${c}): ${ye(p)}`),s[c]=await dt(p,"utf-8")}return r.manifest.readme=s,r}function be(e,t){for(let o in e.datasources)!(e.datasources[o].provider||e.datasources[o].provider==="json")&&!e.datasources[o].sampleData&&(t.error(`\u{1F534} Error: Datasource "${o}" is missing sample data - nothing will be rendered during development! Please check your enpage.config.js file and add a "sampleData" key to your ${o} datasource.`),process.exit(1));e.attributes||(e.attributes=fe({}));let r=ge.safeParse(e.manifest);if(!r.success){t.error(`\u{1F534} Error: template manifest is invalid. Check your call to defineManifest().
|
|
15
15
|
`);let o=gt(r.error);t.error(`Hint: ${o.toString()}
|
|
16
16
|
|
|
17
|
-
`),process.exit(1)}return e}async function Oe({options:e,args:t,logger:r}){if(!await ae(!0)){let y=G();r.error(` ${
|
|
17
|
+
`),process.exit(1)}return e}async function Oe({options:e,args:t,logger:r}){if(!await ae(!0)){let y=G();r.error(` ${x.redBright("Error")}: User token not found. Please run ${x.cyan(`${y} run enpage:login`)} to authenticate or set the ${x.cyan("ENPAGE_API_TOKEN")} environment variable.
|
|
18
18
|
`),process.exit(1)}let o=t.length?Se.isAbsolute(t[0])?t[0]:S(process.cwd(),t[0]):process.cwd();F(o)||(r.error(` Template directory not found: ${o}. Aborting.
|
|
19
19
|
`),process.exit(1));let s=t.length>1?Se.isAbsolute(t[1])?t[1]:S(process.cwd(),t[1]):S(o,"dist");F(s)||(r.error(` Dist directory not found: ${s}.
|
|
20
20
|
Please run 'build' before publishing. Aborting.
|
|
21
|
-
`),process.exit(1)),F(S(o,"enpage.config.js"))||(r.error(` ${
|
|
22
|
-
`),process.exit(1));let i=await he(S(o,"enpage.config.js"),r);be(i,r);let p=pe(),n=St(o);n||(r.error(` ${
|
|
23
|
-
`),process.exit(1));let a=await Ot(n);if(a||(r.error(` ${
|
|
24
|
-
`),process.exit(1)),!a.enpage?.id){let{data:y,isError:O,status:R}=await P(re,{manifest:i.manifest});O&&(r.error(` ${
|
|
25
|
-
`),process.exit(1)),a.enpage??={},a.enpage.id=y.template.id;try{e.dryRun||bt(n,JSON.stringify(a,null,2))}catch{r.error(` ${
|
|
21
|
+
`),process.exit(1)),F(S(o,"enpage.config.js"))||(r.error(` ${x.redBright("Error")}: file enpage.config.js not found in ${o}. Aborting.
|
|
22
|
+
`),process.exit(1));let i=await he(S(o,"enpage.config.js"),r);be(i,r);let p=pe(),n=St(o);n||(r.error(` ${x.redBright("Error")}: package.json file not found in ${o}. Aborting.
|
|
23
|
+
`),process.exit(1));let a=await Ot(n);if(a||(r.error(` ${x.redBright("Error")}: cannot read/parse package.json file in ${o}. Aborting.
|
|
24
|
+
`),process.exit(1)),!a.enpage?.id){let{data:y,isError:O,status:R}=await P(re,{manifest:i.manifest});O&&(r.error(` ${x.redBright("Error")}: Cannot register template: ${K(y)}
|
|
25
|
+
`),process.exit(1)),a.enpage??={},a.enpage.id=y.template.id;try{e.dryRun||bt(n,JSON.stringify(a,null,2))}catch{r.error(` ${x.redBright("Error")}: Cannot update template id in package.json file located in ${o}. Aborting.
|
|
26
26
|
`),process.exit(1)}}let c=a.enpage.id;r.info(`Submitting template to Enpage...
|
|
27
27
|
`),(await me(c,o,p,e.dryRun)).success||(r.error(`
|
|
28
28
|
Upload failed. See details above.
|
|
29
29
|
`),process.exit(1)),r.success(`Template ${c} published.
|
|
30
|
-
`)}function St(e){return F(S(e,"package.json"))?S(e,"package.json"):F(S(e,"template-package.json"))?S(e,"template-package.json"):!1}function Ot(e){try{return JSON.parse(ht(e,"utf-8"))}catch{return null}}import
|
|
31
|
-
`);let{isError:r,data:o}=await P(Z,{client_id:W,scope:"profile,templates:publish"});r&&(t.error("Failed to get device code. Please try again."),t.error(`Error: ${o.error_description??o.error}`),process.exit(1));let{verification_uri:s,device_code:i}=o;await
|
|
30
|
+
`)}function St(e){return F(S(e,"package.json"))?S(e,"package.json"):F(S(e,"template-package.json"))?S(e,"template-package.json"):!1}function Ot(e){try{return JSON.parse(ht(e,"utf-8"))}catch{return null}}import vt from"chalk";import{confirm as xt}from"@inquirer/prompts";import Et from"open";async function wt(e,t){for(;;){let r=new URLSearchParams({grant_type:"device_code",device_code:e,client_id:W}),o=await P(ee,r),{data:s,isSuccess:i}=o;if(i)return s;if(s.error==="authorization_pending")await new Promise(p=>setTimeout(p,5e3));else return t.error(`Error while polling for login: ${s.error_description??s.error}`),!1}}async function ve({options:e,logger:t}){t.info(`Logging in to Enpage...
|
|
31
|
+
`);let{isError:r,data:o}=await P(Z,{client_id:W,scope:"profile,templates:publish"});r&&(t.error("Failed to get device code. Please try again."),t.error(`Error: ${o.error_description??o.error}`),process.exit(1));let{verification_uri:s,device_code:i}=o;await xt({message:"Would you like to open the login page in your browser?",default:!0}).catch(a=>{process.exit(0)})?Et(s):t.info(`
|
|
32
32
|
Please visit the following URL to login:
|
|
33
33
|
${s}
|
|
34
|
-
`),t.info(
|
|
34
|
+
`),t.info(vt.gray(`
|
|
35
35
|
Waiting for login...
|
|
36
36
|
`));let n=await wt(i,t);n||(t.error("Login failed. Please try again."),process.exit(1)),f.set({...n,...n.expires_in?{expires_at:Date.now()+n.expires_in*1e3}:{}}),t.info(`Login successful!
|
|
37
|
-
`),process.exitCode=0}import{build as q}from"vite";import Pt,{resolve as
|
|
37
|
+
`),process.exitCode=0}import{build as q}from"vite";import Pt,{resolve as xe}from"node:path";import{fileURLToPath as _t}from"node:url";import{sync as Tt}from"rimraf";var Ee=_t(new URL(".",import.meta.url)),V=xe(Ee,"../builder/vite-config.js"),Lt=xe(Ee,"../builder/vite-entry-server.js");async function we({options:e,logger:t}){t.info(`Building template...
|
|
38
38
|
`),e.clean&&Tt(Pt.join(process.cwd(),"dist"));let r="production";e.ssr==="local"&&(r="development",process.env.NODE_ENV=r),e.ssr?(await q({configFile:V,customLogger:t,mode:r,logLevel:e.logLevel,clearScreen:e.clearScreen,build:{ssrManifest:!0,emptyOutDir:!0}}),await q({configFile:V,customLogger:t,mode:r,logLevel:e.logLevel,clearScreen:e.clearScreen,ssr:{target:"webworker"},build:{ssr:Lt}})):await q({configFile:V,customLogger:t,logLevel:e.logLevel,clearScreen:e.clearScreen,build:{emptyOutDir:!0}})}async function Pe({options:e,logger:t}){t.info("Logging out fom Enpage..."),f.clear(),t.info(`Done.
|
|
39
39
|
`),process.exit(0)}var J;C.name("enpage").option("-l, --logLevel <level>","[string] info | warn | error | silent | debug").option("--clearScreen","[boolean] allow/disable clear screen when logging").option("--dry-run","[boolean] run command without making changes").hook("preAction",e=>{J=H(e.optsWithGlobals().logLevel,e.optsWithGlobals().clearScreen,!0),process.removeAllListeners("warning"),process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("util.isArray")||J.warnOnce(`Warning: ${t.name} - ${t.message}`)})});C.command("build").description("Build template").option("--ssr [type]",`Enable server side rendering.
|
|
40
40
|
Pass --ssr to generate a SSR-enabled build.
|
|
41
|
-
Pass --ssr=local to generate a SSR-enabled build that can be tested locally.`,Boolean,!1).option("--no-clean","Don't clean directory before buidling").action(function(){we(z(this))});C.command("publish").description("Publish a template to Enpage").argument("[directory]","Directory to publish").option("--no-check","Don't check for required files").action(function(){Oe(z(this))});C.command("login").description("Login to Enpage").action(function(){
|
|
41
|
+
Pass --ssr=local to generate a SSR-enabled build that can be tested locally.`,Boolean,!1).option("--no-clean","Don't clean directory before buidling").action(function(){we(z(this))});C.command("publish").description("Publish a template to Enpage").argument("[directory]","Directory to publish").option("--no-check","Don't check for required files").action(function(){Oe(z(this))});C.command("login").description("Login to Enpage").action(function(){ve(z(this))});C.command("logout").description("Logout from Enpage").action(function(){Pe(z(this))});C.parse();function z(e){return{options:e.optsWithGlobals(),args:e.args,logger:J}}
|
|
42
42
|
/*!
|
|
43
43
|
* parse-gitignore <https://github.com/jonschlinkert/parse-gitignore>
|
|
44
44
|
* Copyright (c) 2015-present, Jon Schlinkert.
|
package/dist/node/cli/store.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
-
var g="enpage-cli";var w=process.env.PUBLIC_ENPAGE_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",d=process.env.PUBLIC_ENPAGE_API_BASE_URL??"https://api.enpage.co",I=process.env.PUBLIC_ENPAGE_FRONTEND_BASE_URL??"https://enpage.co";var m="oauth/userinfo";import L from"conf";import{createLogger as E}from"vite";var l="0.0.
|
|
2
|
+
var g="enpage-cli";var w=process.env.PUBLIC_ENPAGE_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",d=process.env.PUBLIC_ENPAGE_API_BASE_URL??"https://api.enpage.co",I=process.env.PUBLIC_ENPAGE_FRONTEND_BASE_URL??"https://enpage.co";var m="oauth/userinfo";import L from"conf";import{createLogger as E}from"vite";var l="0.0.60";import i from"chalk";function _(e,t,o=!1){let s=E(e==="debug"?"info":e,{prefix:"[enpage]",allowClearScreen:t});return o&&s.info(i.hex("#7270c6").bold(`\u{1F680} Enpage v${l}
|
|
3
3
|
`)),{...s,success:(r,n)=>s.info(i.green(r),n),error:(r,n)=>s.error(i.red(r),n),warn:(r,n)=>s.warn(i.yellow(r),n),warnOnce:(r,n)=>s.warnOnce(i.yellow(r),n),debug:(r,n)=>{e==="debug"&&s.info(i.gray(r),n)}}}var u=_();async function f(e,t={}){a.get("access_token")&&(t.Authorization=`Bearer ${a.get("access_token")}`);let o=await fetch(x(e),{headers:t,method:"GET"}).catch(s=>{u.error(`Fatal Error requesting API: ${s.message} (${s.cause.code})`),u.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return T(o)}function x(e){let t=new URL(d.endsWith("/")?d:`${d}/`);return new URL(e,t)}async function T(e){let t=e.headers.get("content-type")?.startsWith("application/json")?await e.json():await e.text();return e.ok?{isSuccess:!0,isError:!1,status:e.status,statusText:e.statusText,data:t}:{isSuccess:!1,isError:!0,status:e.status,statusText:e.statusText,data:t}}import c from"node:path";import k from"node:crypto";import p from"node:fs";import{fileURLToPath as R}from"node:url";function y(){let e;if(process.env.npm_config_user_agent){let t=process.env.npm_config_user_agent.split(" ")[0];e=t.slice(0,t.lastIndexOf("/"))}return e||(console.log("Warning: could not detect package manager"),e="npm"),e}import O from"chalk";var v=R(new URL(".",import.meta.url)),P=N(),a=new L({projectName:g,encryptionKey:P,clearInvalidConfig:!0});async function Q(e=!1){let t=a.get("access_token"),o=a.get("expires_at");if(!t)return!1;if(o&&o<Date.now())return console.log("Seems like your token expired..."),!1;if(!e)return!0;let{isSuccess:s}=await f(m);return s}function Z(){let e=a.get("access_token");if(!e){let t=y();throw new Error(`Access token not found. Please run ${O.cyan(`${t} run enpage:login`)} to authenticate.`)}return e}function S(){let e=v;for(;e!==c.parse(e).root;){let t=c.join(e,"node_modules");if(p.existsSync(t))return t;e=c.dirname(e)}return null}function N(){let e=S();if(!e)throw new Error("Could not find nearest node_modules directory.");let t=c.join(e,".enpage-tmp");p.existsSync(t)||p.mkdirSync(t,{recursive:!0,mode:448});let o=c.join(t,".enpage-key");if(!p.existsSync(o)){let r=k.randomBytes(32).toString("hex");return p.writeFileSync(o,r,{mode:384,flush:!0}),r}return p.readFileSync(o,"utf8")}export{a as accessStore,Z as getTokenOrThrow,Q as isLoggedIn};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"package.json":{"bytes":4663,"imports":[]},"src/node/shared/logger.ts":{"bytes":1411,"imports":[{"path":"vite","kind":"import-statement","external":true},{"path":"package.json","kind":"import-statement","original":"../../../package.json"},{"path":"chalk","kind":"import-statement","external":true}],"format":"esm"},"src/node/cli/constants.ts":{"bytes":705,"imports":[],"format":"esm"},"src/node/cli/utils.ts":{"bytes":638,"imports":[],"format":"esm"},"src/node/cli/store.ts":{"bytes":2489,"imports":[{"path":"src/node/cli/constants.ts","kind":"import-statement","original":"./constants"},{"path":"conf","kind":"import-statement","external":true},{"path":"src/node/cli/api.ts","kind":"import-statement","original":"./api"},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"src/node/cli/utils.ts","kind":"import-statement","original":"./utils"},{"path":"chalk","kind":"import-statement","external":true}],"format":"esm"},"src/node/cli/api.ts":{"bytes":3038,"imports":[{"path":"src/node/shared/logger.ts","kind":"import-statement","original":"../shared/logger"},{"path":"src/node/cli/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/node/cli/store.ts","kind":"import-statement","original":"./store"}],"format":"esm"},"src/node/cli/commands/publish/parse-gitignore.ts":{"bytes":8164,"imports":[{"path":"node:fs","kind":"import-statement","external":true}],"format":"esm"},"src/node/cli/commands/publish/uploader.ts":{"bytes":9822,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"src/node/cli/constants.ts","kind":"import-statement","original":"../../constants"},{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:stream","kind":"import-statement","external":true},{"path":"src/node/shared/logger.ts","kind":"import-statement","original":"~/node/shared/logger"},{"path":"chalk","kind":"import-statement","external":true},{"path":"form-data","kind":"import-statement","external":true},{"path":"src/node/cli/commands/publish/parse-gitignore.ts","kind":"import-statement","original":"./parse-gitignore"},{"path":"p-queue","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"nanoid","kind":"import-statement","external":true},{"path":"src/node/cli/api.ts","kind":"import-statement","original":"../../api"}],"format":"esm"},"src/shared/manifest.ts":{"bytes":605,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"src/shared/attributes.ts":{"bytes":8687,"imports":[{"path":"@sinclair/typebox","kind":"import-statement","external":true},{"path":"@sinclair/typebox/value","kind":"import-statement","external":true}],"format":"esm"},"src/node/shared/config.ts":{"bytes":2877,"imports":[{"path":"src/shared/manifest.ts","kind":"import-statement","original":"~/shared/manifest"},{"path":"src/shared/attributes.ts","kind":"import-statement","original":"~/shared/attributes"},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"src/node/shared/logger.ts","kind":"import-statement","original":"./logger"},{"path":"zod-validation-error","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/node/cli/commands/publish/cmd-publish.ts":{"bytes":4446,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"src/node/cli/utils.ts","kind":"import-statement","original":"../../utils"},{"path":"src/node/cli/store.ts","kind":"import-statement","original":"../../store"},{"path":"src/node/cli/commands/publish/uploader.ts","kind":"import-statement","original":"./uploader"},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/node/cli/api.ts","kind":"import-statement","original":"../../api"},{"path":"src/node/cli/constants.ts","kind":"import-statement","original":"../../constants"},{"path":"src/node/shared/config.ts","kind":"import-statement","original":"~/node/shared/config"}],"format":"esm"},"src/node/cli/commands/login/cmd-login.ts":{"bytes":3162,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"@inquirer/prompts","kind":"import-statement","external":true},{"path":"open","kind":"import-statement","external":true},{"path":"src/node/cli/constants.ts","kind":"import-statement","original":"../../constants"},{"path":"src/node/cli/api.ts","kind":"import-statement","original":"../../api"},{"path":"src/node/cli/store.ts","kind":"import-statement","original":"../../store"}],"format":"esm"},"src/node/cli/commands/build/cmd-build.ts":{"bytes":1576,"imports":[{"path":"vite","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"rimraf","kind":"import-statement","external":true}],"format":"esm"},"src/node/cli/commands/logout/cmd-logout.ts":{"bytes":309,"imports":[{"path":"src/node/cli/store.ts","kind":"import-statement","original":"../../store"}],"format":"esm"},"src/node/cli/program.ts":{"bytes":2449,"imports":[{"path":"commander","kind":"import-statement","external":true},{"path":"src/node/cli/commands/publish/cmd-publish.ts","kind":"import-statement","original":"./commands/publish/cmd-publish"},{"path":"src/node/cli/commands/login/cmd-login.ts","kind":"import-statement","original":"./commands/login/cmd-login"},{"path":"src/node/cli/commands/build/cmd-build.ts","kind":"import-statement","original":"./commands/build/cmd-build"},{"path":"src/node/shared/logger.ts","kind":"import-statement","original":"../shared/logger"},{"path":"src/node/cli/commands/logout/cmd-logout.ts","kind":"import-statement","original":"./commands/logout/cmd-logout"}],"format":"esm"},"src/node/cli/types.ts":{"bytes":740,"imports":[],"format":"esm"}},"outputs":{"dist/node/cli/api.js":{"imports":[{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"conf","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["get","post"],"entryPoint":"src/node/cli/api.ts","inputs":{"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15},"src/node/cli/constants.ts":{"bytesInOutput":240},"src/node/cli/store.ts":{"bytesInOutput":752},"src/node/cli/api.ts":{"bytesInOutput":1190}},"bytes":2747},"dist/node/cli/constants.js":{"imports":[],"exports":["API_BASE_URL","API_ENDPOINT_REGISTER_TEMPLATE","CLI_LOGIN_CLIENT_ID","CLI_LOGIN_POLL_INTERVAL","CLI_PROJECT_NAME","DEFAULT_UPLOAD_MAX_CONCURRENCY","FRONTEND_BASE_URL","OAUTH_ENDPOINT_DEVICE_CODE","OAUTH_ENDPOINT_TOKEN","OAUTH_ENDPOINT_USER_INFO"],"entryPoint":"src/node/cli/constants.ts","inputs":{"src/node/cli/constants.ts":{"bytesInOutput":320}},"bytes":704},"dist/node/cli/program.js":{"imports":[{"path":"commander","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"conf","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:stream","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"form-data","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"p-queue","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"nanoid","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"@sinclair/typebox","kind":"import-statement","external":true},{"path":"@sinclair/typebox/value","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"zod-validation-error","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"@inquirer/prompts","kind":"import-statement","external":true},{"path":"open","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"rimraf","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/node/cli/program.ts","inputs":{"src/node/cli/program.ts":{"bytesInOutput":1331},"src/node/cli/commands/publish/cmd-publish.ts":{"bytesInOutput":2037},"src/node/cli/utils.ts":{"bytesInOutput":309},"src/node/cli/constants.ts":{"bytesInOutput":322},"src/node/cli/store.ts":{"bytesInOutput":1162},"src/node/shared/logger.ts":{"bytesInOutput":427},"package.json":{"bytesInOutput":16},"src/node/cli/api.ts":{"bytesInOutput":1197},"src/node/cli/commands/publish/uploader.ts":{"bytesInOutput":4152},"src/node/cli/commands/publish/parse-gitignore.ts":{"bytesInOutput":2395},"src/shared/manifest.ts":{"bytesInOutput":270},"src/shared/attributes.ts":{"bytesInOutput":4155},"src/node/shared/config.ts":{"bytesInOutput":1362},"src/node/cli/commands/login/cmd-login.ts":{"bytesInOutput":1172},"src/node/cli/commands/build/cmd-build.ts":{"bytesInOutput":834},"src/node/cli/commands/logout/cmd-logout.ts":{"bytesInOutput":119}},"bytes":21605},"dist/node/cli/store.js":{"imports":[{"path":"conf","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["accessStore","getTokenOrThrow","isLoggedIn"],"entryPoint":"src/node/cli/store.ts","inputs":{"src/node/cli/constants.ts":{"bytesInOutput":263},"src/node/cli/store.ts":{"bytesInOutput":1142},"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15},"src/node/cli/api.ts":{"bytesInOutput":690},"src/node/cli/utils.ts":{"bytesInOutput":222}},"bytes":2917},"dist/node/cli/types.js":{"imports":[],"exports":[],"entryPoint":"src/node/cli/types.ts","inputs":{"src/node/cli/types.ts":{"bytesInOutput":0}},"bytes":98},"dist/node/cli/utils.js":{"imports":[],"exports":["formatAPIError","getPackageManager"],"entryPoint":"src/node/cli/utils.ts","inputs":{"src/node/cli/utils.ts":{"bytesInOutput":309}},"bytes":459},"dist/node/shared/config.js":{"imports":[{"path":"zod","kind":"import-statement","external":true},{"path":"@sinclair/typebox","kind":"import-statement","external":true},{"path":"@sinclair/typebox/value","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"zod-validation-error","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["loadConfigFromJsFile","loadConfigFromManifestFile","validateTemplateConfig"],"entryPoint":"src/node/shared/config.ts","inputs":{"src/shared/manifest.ts":{"bytesInOutput":269},"src/shared/attributes.ts":{"bytesInOutput":4151},"src/node/shared/config.ts":{"bytesInOutput":1532},"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15}},"bytes":6584},"dist/node/shared/logger.js":{"imports":[{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["createLogger","logger"],"entryPoint":"src/node/shared/logger.ts","inputs":{"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15}},"bytes":576},"dist/node/cli/commands/build/cmd-build.js":{"imports":[{"path":"vite","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"rimraf","kind":"import-statement","external":true}],"exports":["buildTemplate"],"entryPoint":"src/node/cli/commands/build/cmd-build.ts","inputs":{"src/node/cli/commands/build/cmd-build.ts":{"bytesInOutput":819}},"bytes":945},"dist/node/cli/commands/login/cmd-login.js":{"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"@inquirer/prompts","kind":"import-statement","external":true},{"path":"open","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"conf","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["login","pollForLogin"],"entryPoint":"src/node/cli/commands/login/cmd-login.ts","inputs":{"src/node/cli/commands/login/cmd-login.ts":{"bytesInOutput":1163},"src/node/cli/constants.ts":{"bytesInOutput":281},"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15},"src/node/cli/store.ts":{"bytesInOutput":752},"src/node/cli/api.ts":{"bytesInOutput":851}},"bytes":3623},"dist/node/cli/commands/logout/cmd-logout.js":{"imports":[{"path":"conf","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["logout"],"entryPoint":"src/node/cli/commands/logout/cmd-logout.ts","inputs":{"src/node/cli/constants.ts":{"bytesInOutput":240},"src/node/cli/store.ts":{"bytesInOutput":752},"src/node/cli/commands/logout/cmd-logout.ts":{"bytesInOutput":118}},"bytes":1229},"dist/node/cli/commands/publish/cmd-publish.js":{"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"conf","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:stream","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"form-data","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"p-queue","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"nanoid","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"@sinclair/typebox","kind":"import-statement","external":true},{"path":"@sinclair/typebox/value","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"zod-validation-error","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["publish"],"entryPoint":"src/node/cli/commands/publish/cmd-publish.ts","inputs":{"src/node/cli/commands/publish/cmd-publish.ts":{"bytesInOutput":2034},"src/node/cli/utils.ts":{"bytesInOutput":309},"src/node/cli/constants.ts":{"bytesInOutput":287},"src/node/cli/store.ts":{"bytesInOutput":1158},"src/node/shared/logger.ts":{"bytesInOutput":428},"package.json":{"bytesInOutput":15},"src/node/cli/api.ts":{"bytesInOutput":1190},"src/node/cli/commands/publish/uploader.ts":{"bytesInOutput":4152},"src/node/cli/commands/publish/parse-gitignore.ts":{"bytesInOutput":2395},"src/shared/manifest.ts":{"bytesInOutput":270},"src/shared/attributes.ts":{"bytesInOutput":4155},"src/node/shared/config.ts":{"bytesInOutput":1362}},"bytes":18102},"dist/node/cli/commands/publish/parse-gitignore.js":{"imports":[{"path":"node:fs","kind":"import-statement","external":true}],"exports":["dedupe","default","format","formatSection","globs","parse","parseFile","patterns"],"entryPoint":"src/node/cli/commands/publish/parse-gitignore.ts","inputs":{"src/node/cli/commands/publish/parse-gitignore.ts":{"bytesInOutput":2471}},"bytes":2911},"dist/node/cli/commands/publish/uploader.js":{"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:stream","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"form-data","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"p-queue","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"nanoid","kind":"import-statement","external":true},{"path":"conf","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["uploadTemplate"],"entryPoint":"src/node/cli/commands/publish/uploader.ts","inputs":{"src/node/cli/commands/publish/uploader.ts":{"bytesInOutput":4143},"src/node/cli/constants.ts":{"bytesInOutput":247},"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15},"src/node/cli/commands/publish/parse-gitignore.ts":{"bytesInOutput":2377},"src/node/cli/store.ts":{"bytesInOutput":767},"src/node/cli/api.ts":{"bytesInOutput":855}},"bytes":9182}}}
|
|
1
|
+
{"inputs":{"package.json":{"bytes":4663,"imports":[]},"src/node/shared/logger.ts":{"bytes":1411,"imports":[{"path":"vite","kind":"import-statement","external":true},{"path":"package.json","kind":"import-statement","original":"../../../package.json"},{"path":"chalk","kind":"import-statement","external":true}],"format":"esm"},"src/node/cli/constants.ts":{"bytes":705,"imports":[],"format":"esm"},"src/node/cli/utils.ts":{"bytes":638,"imports":[],"format":"esm"},"src/node/cli/store.ts":{"bytes":2489,"imports":[{"path":"src/node/cli/constants.ts","kind":"import-statement","original":"./constants"},{"path":"conf","kind":"import-statement","external":true},{"path":"src/node/cli/api.ts","kind":"import-statement","original":"./api"},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"src/node/cli/utils.ts","kind":"import-statement","original":"./utils"},{"path":"chalk","kind":"import-statement","external":true}],"format":"esm"},"src/node/cli/api.ts":{"bytes":3038,"imports":[{"path":"src/node/shared/logger.ts","kind":"import-statement","original":"../shared/logger"},{"path":"src/node/cli/constants.ts","kind":"import-statement","original":"./constants"},{"path":"src/node/cli/store.ts","kind":"import-statement","original":"./store"}],"format":"esm"},"src/node/cli/commands/publish/parse-gitignore.ts":{"bytes":8164,"imports":[{"path":"node:fs","kind":"import-statement","external":true}],"format":"esm"},"src/node/cli/commands/publish/uploader.ts":{"bytes":9822,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"src/node/cli/constants.ts","kind":"import-statement","original":"../../constants"},{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:stream","kind":"import-statement","external":true},{"path":"src/node/shared/logger.ts","kind":"import-statement","original":"~/node/shared/logger"},{"path":"chalk","kind":"import-statement","external":true},{"path":"form-data","kind":"import-statement","external":true},{"path":"src/node/cli/commands/publish/parse-gitignore.ts","kind":"import-statement","original":"./parse-gitignore"},{"path":"p-queue","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"nanoid","kind":"import-statement","external":true},{"path":"src/node/cli/api.ts","kind":"import-statement","original":"../../api"}],"format":"esm"},"src/shared/manifest.ts":{"bytes":734,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"src/shared/attributes.ts":{"bytes":8712,"imports":[{"path":"@sinclair/typebox","kind":"import-statement","external":true},{"path":"@sinclair/typebox/value","kind":"import-statement","external":true}],"format":"esm"},"src/node/shared/config.ts":{"bytes":2847,"imports":[{"path":"src/shared/manifest.ts","kind":"import-statement","original":"~/shared/manifest"},{"path":"src/shared/attributes.ts","kind":"import-statement","original":"~/shared/attributes"},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"src/node/shared/logger.ts","kind":"import-statement","original":"./logger"},{"path":"zod-validation-error","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/node/cli/commands/publish/cmd-publish.ts":{"bytes":4446,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"src/node/cli/utils.ts","kind":"import-statement","original":"../../utils"},{"path":"src/node/cli/store.ts","kind":"import-statement","original":"../../store"},{"path":"src/node/cli/commands/publish/uploader.ts","kind":"import-statement","original":"./uploader"},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/node/cli/api.ts","kind":"import-statement","original":"../../api"},{"path":"src/node/cli/constants.ts","kind":"import-statement","original":"../../constants"},{"path":"src/node/shared/config.ts","kind":"import-statement","original":"~/node/shared/config"}],"format":"esm"},"src/node/cli/commands/login/cmd-login.ts":{"bytes":3162,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"@inquirer/prompts","kind":"import-statement","external":true},{"path":"open","kind":"import-statement","external":true},{"path":"src/node/cli/constants.ts","kind":"import-statement","original":"../../constants"},{"path":"src/node/cli/api.ts","kind":"import-statement","original":"../../api"},{"path":"src/node/cli/store.ts","kind":"import-statement","original":"../../store"}],"format":"esm"},"src/node/cli/commands/build/cmd-build.ts":{"bytes":1576,"imports":[{"path":"vite","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"rimraf","kind":"import-statement","external":true}],"format":"esm"},"src/node/cli/commands/logout/cmd-logout.ts":{"bytes":309,"imports":[{"path":"src/node/cli/store.ts","kind":"import-statement","original":"../../store"}],"format":"esm"},"src/node/cli/program.ts":{"bytes":2449,"imports":[{"path":"commander","kind":"import-statement","external":true},{"path":"src/node/cli/commands/publish/cmd-publish.ts","kind":"import-statement","original":"./commands/publish/cmd-publish"},{"path":"src/node/cli/commands/login/cmd-login.ts","kind":"import-statement","original":"./commands/login/cmd-login"},{"path":"src/node/cli/commands/build/cmd-build.ts","kind":"import-statement","original":"./commands/build/cmd-build"},{"path":"src/node/shared/logger.ts","kind":"import-statement","original":"../shared/logger"},{"path":"src/node/cli/commands/logout/cmd-logout.ts","kind":"import-statement","original":"./commands/logout/cmd-logout"}],"format":"esm"},"src/node/cli/types.ts":{"bytes":740,"imports":[],"format":"esm"}},"outputs":{"dist/node/cli/api.js":{"imports":[{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"conf","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["get","post"],"entryPoint":"src/node/cli/api.ts","inputs":{"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15},"src/node/cli/constants.ts":{"bytesInOutput":240},"src/node/cli/store.ts":{"bytesInOutput":752},"src/node/cli/api.ts":{"bytesInOutput":1190}},"bytes":2747},"dist/node/cli/constants.js":{"imports":[],"exports":["API_BASE_URL","API_ENDPOINT_REGISTER_TEMPLATE","CLI_LOGIN_CLIENT_ID","CLI_LOGIN_POLL_INTERVAL","CLI_PROJECT_NAME","DEFAULT_UPLOAD_MAX_CONCURRENCY","FRONTEND_BASE_URL","OAUTH_ENDPOINT_DEVICE_CODE","OAUTH_ENDPOINT_TOKEN","OAUTH_ENDPOINT_USER_INFO"],"entryPoint":"src/node/cli/constants.ts","inputs":{"src/node/cli/constants.ts":{"bytesInOutput":320}},"bytes":704},"dist/node/cli/program.js":{"imports":[{"path":"commander","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"conf","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:stream","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"form-data","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"p-queue","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"nanoid","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"@sinclair/typebox","kind":"import-statement","external":true},{"path":"@sinclair/typebox/value","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"zod-validation-error","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"@inquirer/prompts","kind":"import-statement","external":true},{"path":"open","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"rimraf","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/node/cli/program.ts","inputs":{"src/node/cli/program.ts":{"bytesInOutput":1331},"src/node/cli/commands/publish/cmd-publish.ts":{"bytesInOutput":2037},"src/node/cli/utils.ts":{"bytesInOutput":309},"src/node/cli/constants.ts":{"bytesInOutput":322},"src/node/cli/store.ts":{"bytesInOutput":1162},"src/node/shared/logger.ts":{"bytesInOutput":427},"package.json":{"bytesInOutput":16},"src/node/cli/api.ts":{"bytesInOutput":1197},"src/node/cli/commands/publish/uploader.ts":{"bytesInOutput":4152},"src/node/cli/commands/publish/parse-gitignore.ts":{"bytesInOutput":2395},"src/shared/manifest.ts":{"bytesInOutput":270},"src/shared/attributes.ts":{"bytesInOutput":4155},"src/node/shared/config.ts":{"bytesInOutput":1362},"src/node/cli/commands/login/cmd-login.ts":{"bytesInOutput":1172},"src/node/cli/commands/build/cmd-build.ts":{"bytesInOutput":834},"src/node/cli/commands/logout/cmd-logout.ts":{"bytesInOutput":119}},"bytes":21605},"dist/node/cli/store.js":{"imports":[{"path":"conf","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["accessStore","getTokenOrThrow","isLoggedIn"],"entryPoint":"src/node/cli/store.ts","inputs":{"src/node/cli/constants.ts":{"bytesInOutput":263},"src/node/cli/store.ts":{"bytesInOutput":1142},"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15},"src/node/cli/api.ts":{"bytesInOutput":690},"src/node/cli/utils.ts":{"bytesInOutput":222}},"bytes":2917},"dist/node/cli/types.js":{"imports":[],"exports":[],"entryPoint":"src/node/cli/types.ts","inputs":{"src/node/cli/types.ts":{"bytesInOutput":0}},"bytes":98},"dist/node/cli/utils.js":{"imports":[],"exports":["formatAPIError","getPackageManager"],"entryPoint":"src/node/cli/utils.ts","inputs":{"src/node/cli/utils.ts":{"bytesInOutput":309}},"bytes":459},"dist/node/shared/config.js":{"imports":[{"path":"zod","kind":"import-statement","external":true},{"path":"@sinclair/typebox","kind":"import-statement","external":true},{"path":"@sinclair/typebox/value","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"zod-validation-error","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["loadConfigFromJsFile","loadConfigFromManifestFile","validateTemplateConfig"],"entryPoint":"src/node/shared/config.ts","inputs":{"src/shared/manifest.ts":{"bytesInOutput":269},"src/shared/attributes.ts":{"bytesInOutput":4151},"src/node/shared/config.ts":{"bytesInOutput":1532},"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15}},"bytes":6584},"dist/node/shared/logger.js":{"imports":[{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["createLogger","logger"],"entryPoint":"src/node/shared/logger.ts","inputs":{"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15}},"bytes":576},"dist/node/cli/commands/build/cmd-build.js":{"imports":[{"path":"vite","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"rimraf","kind":"import-statement","external":true}],"exports":["buildTemplate"],"entryPoint":"src/node/cli/commands/build/cmd-build.ts","inputs":{"src/node/cli/commands/build/cmd-build.ts":{"bytesInOutput":819}},"bytes":945},"dist/node/cli/commands/login/cmd-login.js":{"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"@inquirer/prompts","kind":"import-statement","external":true},{"path":"open","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"conf","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["login","pollForLogin"],"entryPoint":"src/node/cli/commands/login/cmd-login.ts","inputs":{"src/node/cli/commands/login/cmd-login.ts":{"bytesInOutput":1163},"src/node/cli/constants.ts":{"bytesInOutput":281},"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15},"src/node/cli/store.ts":{"bytesInOutput":752},"src/node/cli/api.ts":{"bytesInOutput":851}},"bytes":3623},"dist/node/cli/commands/logout/cmd-logout.js":{"imports":[{"path":"conf","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["logout"],"entryPoint":"src/node/cli/commands/logout/cmd-logout.ts","inputs":{"src/node/cli/constants.ts":{"bytesInOutput":240},"src/node/cli/store.ts":{"bytesInOutput":752},"src/node/cli/commands/logout/cmd-logout.ts":{"bytesInOutput":118}},"bytes":1229},"dist/node/cli/commands/publish/cmd-publish.js":{"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"conf","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:stream","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"form-data","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"p-queue","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"nanoid","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"@sinclair/typebox","kind":"import-statement","external":true},{"path":"@sinclair/typebox/value","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"zod-validation-error","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"exports":["publish"],"entryPoint":"src/node/cli/commands/publish/cmd-publish.ts","inputs":{"src/node/cli/commands/publish/cmd-publish.ts":{"bytesInOutput":2034},"src/node/cli/utils.ts":{"bytesInOutput":309},"src/node/cli/constants.ts":{"bytesInOutput":287},"src/node/cli/store.ts":{"bytesInOutput":1158},"src/node/shared/logger.ts":{"bytesInOutput":428},"package.json":{"bytesInOutput":15},"src/node/cli/api.ts":{"bytesInOutput":1190},"src/node/cli/commands/publish/uploader.ts":{"bytesInOutput":4152},"src/node/cli/commands/publish/parse-gitignore.ts":{"bytesInOutput":2395},"src/shared/manifest.ts":{"bytesInOutput":270},"src/shared/attributes.ts":{"bytesInOutput":4155},"src/node/shared/config.ts":{"bytesInOutput":1362}},"bytes":18102},"dist/node/cli/commands/publish/parse-gitignore.js":{"imports":[{"path":"node:fs","kind":"import-statement","external":true}],"exports":["dedupe","default","format","formatSection","globs","parse","parseFile","patterns"],"entryPoint":"src/node/cli/commands/publish/parse-gitignore.ts","inputs":{"src/node/cli/commands/publish/parse-gitignore.ts":{"bytesInOutput":2471}},"bytes":2911},"dist/node/cli/commands/publish/uploader.js":{"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"fast-glob","kind":"import-statement","external":true},{"path":"node:http","kind":"import-statement","external":true},{"path":"node:https","kind":"import-statement","external":true},{"path":"node:stream","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"form-data","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"p-queue","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"nanoid","kind":"import-statement","external":true},{"path":"conf","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["uploadTemplate"],"entryPoint":"src/node/cli/commands/publish/uploader.ts","inputs":{"src/node/cli/commands/publish/uploader.ts":{"bytesInOutput":4143},"src/node/cli/constants.ts":{"bytesInOutput":247},"src/node/shared/logger.ts":{"bytesInOutput":424},"package.json":{"bytesInOutput":15},"src/node/cli/commands/publish/parse-gitignore.ts":{"bytesInOutput":2377},"src/node/cli/store.ts":{"bytesInOutput":767},"src/node/cli/api.ts":{"bytesInOutput":855}},"bytes":9182}}}
|