@shipstatic/ship 0.8.6 → 0.8.7
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/README.md +4 -0
- package/SKILL.md +173 -98
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +23 -23
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var Fe=Object.defineProperty;var T=(n,t)=>()=>(n&&(t=n(n=0)),t);var Oe=(n,t)=>{for(var e in t)Fe(n,e,{get:t[e],enumerable:!0})};function x(n){return n!==null&&typeof n=="object"&&"name"in n&&n.name==="ShipError"&&"status"in n}function L(n){let t=n.lastIndexOf(".");if(t===-1||t===n.length-1)return!1;let e=n.slice(t+1).toLowerCase();return Ne.has(e)}function fe(n){return $e.test(n)}function U(n){return n.replace(/\\/g,"/").split("/").filter(Boolean).some(e=>q.has(e))}function et(n){if(!n.startsWith(b))throw a.validation(`API key must start with "${b}"`);if(n.length!==ue)throw a.validation(`API key must be ${ue} characters total (${b} + ${V} hex chars)`);let t=n.slice(b.length);if(!/^[a-f0-9]{64}$/i.test(t))throw a.validation(`API key must contain ${V} hexadecimal characters after "${b}" prefix`)}function tt(n){if(!n.startsWith(I))throw a.validation(`Deploy token must start with "${I}"`);if(n.length!==de)throw a.validation(`Deploy token must be ${de} characters total (${I} + ${G} hex chars)`);let t=n.slice(I.length);if(!/^[a-f0-9]{64}$/i.test(t))throw a.validation(`Deploy token must contain ${G} hexadecimal characters after "${I}" prefix`)}function nt(n){try{let t=new URL(n);if(!["http:","https:"].includes(t.protocol))throw a.validation("API URL must use http:// or https:// protocol");if(t.pathname!=="/"&&t.pathname!=="")throw a.validation("API URL must not contain a path");if(t.search||t.hash)throw a.validation("API URL must not contain query parameters or fragments")}catch(t){throw x(t)?t:a.validation("API URL must be a valid URL")}}function it(n){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(n)}function me(n,t){return n.endsWith(`.${t}`)}function ot(n,t){return!me(n,t)}function rt(n,t){return me(n,t)?n.slice(0,-(t.length+1)):null}function st(n){return`https://${n}`}function at(n){return`https://${n}`}function ct(n){return!n||n.length===0?null:JSON.stringify(n)}function ut(n){if(!n)return[];try{let t=JSON.parse(n);return Array.isArray(t)?t:[]}catch{return[]}}var We,Je,Xe,f,j,a,Ne,$e,q,b,V,ue,Qe,I,G,de,Ze,Y,_,g,lt,pt,S=T(()=>{"use strict";We={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},Je={PENDING:"pending",PARTIAL:"partial",SUCCESS:"success",PAUSED:"paused"},Xe={FREE:"free",STANDARD:"standard",SPONSORED:"sponsored",ENTERPRISE:"enterprise",SUSPENDED:"suspended",TERMINATING:"terminating",TERMINATED:"terminated"};(function(n){n.Validation="validation_failed",n.NotFound="not_found",n.RateLimit="rate_limit_exceeded",n.Authentication="authentication_failed",n.Business="business_logic_error",n.Api="internal_server_error",n.Network="network_error",n.Cancelled="operation_cancelled",n.File="file_error",n.Config="config_error"})(f||(f={}));j={client:new Set([f.Business,f.Config,f.File,f.Validation]),network:new Set([f.Network]),auth:new Set([f.Authentication])},a=class n extends Error{type;status;details;constructor(t,e,i,o){super(e),this.type=t,this.status=i,this.details=o,this.name="ShipError"}toResponse(){let t=this.type===f.Authentication&&this.details?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:t}}static fromResponse(t){return new n(t.error,t.message,t.status,t.details)}static validation(t,e){return new n(f.Validation,t,400,e)}static notFound(t,e){let i=e?`${t} ${e} not found`:`${t} not found`;return new n(f.NotFound,i,404)}static rateLimit(t="Too many requests"){return new n(f.RateLimit,t,429)}static authentication(t="Authentication required",e){return new n(f.Authentication,t,401,e)}static business(t,e=400){return new n(f.Business,t,e)}static network(t,e){return new n(f.Network,t,void 0,{cause:e})}static cancelled(t){return new n(f.Cancelled,t)}static file(t,e){return new n(f.File,t,void 0,{filePath:e})}static config(t,e){return new n(f.Config,t,void 0,e)}static api(t,e=500){return new n(f.Api,t,e)}static database(t,e=500){return new n(f.Api,t,e)}static storage(t,e=500){return new n(f.Api,t,e)}get filePath(){return this.details?.filePath}isClientError(){return j.client.has(this.type)}isNetworkError(){return j.network.has(this.type)}isAuthError(){return j.auth.has(this.type)}isValidationError(){return this.type===f.Validation}isFileError(){return this.type===f.File}isConfigError(){return this.type===f.Config}isType(t){return this.type===t}};Ne=new Set(["exe","msi","dll","scr","bat","cmd","com","pif","app","deb","rpm","pkg","mpkg","dmg","iso","img","cab","cpl","chm","ps1","vbs","vbe","ws","wsf","wsc","wsh","reg","jar","jnlp","apk","crx","lnk","inf","hta"]);$e=/[\x00-\x1f\x7f#?%\\<>"]/;q=new Set(["node_modules","package.json"]);b="ship-",V=64,ue=b.length+V,Qe=4,I="token-",G=64,de=I.length+G,Ze={JWT:"jwt",API_KEY:"apiKey",TOKEN:"token",WEBHOOK:"webhook",SYSTEM:"system"},Y="ship.json";_="https://api.shipstatic.com",g={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};lt={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},pt=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/});function J(n){W=n}function O(){if(W===null)throw a.config("Platform configuration not initialized. The SDK must fetch configuration from the API before performing operations.");return W}var W,N=T(()=>{"use strict";S();W=null});function At(n){Q=n}function Ue(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function R(){return Q||Ue()}var Q,k=T(()=>{"use strict";Q=null});async function _e(n){let t=(await import("spark-md5")).default;return new Promise((e,i)=>{let r=Math.ceil(n.size/2097152),l=0,p=new t.ArrayBuffer,s=new FileReader,c=()=>{let u=l*2097152,h=Math.min(u+2097152,n.size);s.readAsArrayBuffer(n.slice(u,h))};s.onload=u=>{let h=u.target?.result;if(!h){i(a.business("Failed to read file chunk"));return}p.append(h),l++,l<r?c():e({md5:p.end()})},s.onerror=()=>{i(a.business("Failed to calculate MD5: FileReader error"))},c()})}async function Be(n){let t=await import("crypto");if(Buffer.isBuffer(n)){let i=t.createHash("md5");return i.update(n),{md5:i.digest("hex")}}let e=await import("fs");return new Promise((i,o)=>{let r=t.createHash("md5"),l=e.createReadStream(n);l.on("error",p=>o(a.business(`Failed to read file for MD5: ${p.message}`))),l.on("data",p=>r.update(p)),l.on("end",()=>i({md5:r.digest("hex")}))})}async function M(n){let t=R();if(t==="browser"){if(!(n instanceof Blob))throw a.business("Invalid input for browser MD5 calculation: Expected Blob or File.");return _e(n)}if(t==="node"){if(!(Buffer.isBuffer(n)||typeof n=="string"))throw a.business("Invalid input for Node.js MD5 calculation: Expected Buffer or file path string.");return Be(n)}throw a.business("Unknown or unsupported execution environment for MD5 calculation.")}var K=T(()=>{"use strict";k();S()});import{isJunk as He}from"junk";function ve(n,t){if(!n||n.length===0)return[];if(!t?.allowUnbuilt&&n.find(i=>i&&U(i)))throw a.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return n.filter(e=>{if(!e)return!1;let i=e.replace(/\\/g,"/").split("/").filter(Boolean);if(i.length===0)return!0;let o=i[i.length-1];if(He(o))return!1;for(let l of i)if(l!==".well-known"&&(l.startsWith(".")||l.length>255))return!1;let r=i.slice(0,-1);for(let l of r)if(je.some(p=>l.toLowerCase()===p.toLowerCase()))return!1;return!0})}var je,te=T(()=>{"use strict";S();je=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function Te(n){if(!n||n.length===0)return"";let t=n.filter(r=>r&&typeof r=="string").map(r=>r.replace(/\\/g,"/"));if(t.length===0)return"";if(t.length===1)return t[0];let e=t.map(r=>r.split("/").filter(Boolean)),i=[],o=Math.min(...e.map(r=>r.length));for(let r=0;r<o;r++){let l=e[0][r];if(e.every(p=>p[r]===l))i.push(l);else break}return i.join("/")}function H(n){return n.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var ne=T(()=>{"use strict"});function Re(n,t={}){if(t.flatten===!1)return n.map(i=>({path:H(i),name:ie(i)}));let e=Ve(n);return n.map(i=>{let o=H(i);if(e){let r=e.endsWith("/")?e:`${e}/`;o.startsWith(r)&&(o=o.substring(r.length))}return o||(o=ie(i)),{path:o,name:ie(i)}})}function Ve(n){if(!n.length)return"";let e=n.map(r=>H(r)).map(r=>r.split("/")),i=[],o=Math.min(...e.map(r=>r.length));for(let r=0;r<o-1;r++){let l=e[0][r];if(e.every(p=>p[r]===l))i.push(l);else break}return i.join("/")}function ie(n){return n.split(/[/\\]/).pop()||n}var oe=T(()=>{"use strict";ne()});function re(n,t=1){if(n===0)return"0 Bytes";let e=1024,i=["Bytes","KB","MB","GB"],o=Math.floor(Math.log(n)/Math.log(e));return parseFloat((n/Math.pow(e,o)).toFixed(t))+" "+i[o]}function se(n){if(fe(n))return{valid:!1,reason:"File name contains unsafe characters"};if(n.startsWith(" ")||n.endsWith(" "))return{valid:!1,reason:"File name cannot start/end with spaces"};if(n.endsWith("."))return{valid:!1,reason:"File name cannot end with dots"};let t=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,e=n.split("/").pop()||n;return t.test(e)?{valid:!1,reason:"File name uses a reserved system name"}:n.includes("..")?{valid:!1,reason:"File name contains path traversal pattern"}:{valid:!0}}function Zt(n,t){let e=[],i=[],o=[];if(n.length===0){let s={file:"(no files)",message:"At least one file must be provided"};return e.push(s),{files:[],validFiles:[],errors:e,warnings:[],canDeploy:!1}}for(let s of n)if(U(s.name))return e.push({file:s.name,message:"Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder"}),{files:n.map(c=>({...c,status:g.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:e,warnings:[],canDeploy:!1};if(n.length>t.maxFilesCount){let s={file:`(${n.length} files)`,message:`File count (${n.length}) exceeds limit of ${t.maxFilesCount}`};return e.push(s),{files:n.map(c=>({...c,status:g.VALIDATION_FAILED,statusMessage:s.message})),validFiles:[],errors:e,warnings:[],canDeploy:!1}}let r=0;for(let s of n){let c=g.READY,u="Ready for upload",h=s.name?se(s.name):{valid:!1,reason:"File name cannot be empty"};if(s.status===g.PROCESSING_ERROR)c=g.VALIDATION_FAILED,u=s.statusMessage||"File failed during processing",e.push({file:s.name,message:u});else if(s.size===0){c=g.EXCLUDED,u="File is empty (0 bytes) and cannot be deployed due to storage limitations",i.push({file:s.name,message:u}),o.push({...s,status:c,statusMessage:u});continue}else s.size<0?(c=g.VALIDATION_FAILED,u="File size must be positive",e.push({file:s.name,message:u})):!s.name||s.name.trim().length===0?(c=g.VALIDATION_FAILED,u="File name cannot be empty",e.push({file:s.name||"(empty)",message:u})):s.name.includes("\0")?(c=g.VALIDATION_FAILED,u="File name contains invalid characters (null byte)",e.push({file:s.name,message:u})):h.valid?L(s.name)?(c=g.VALIDATION_FAILED,u=`File extension not allowed: "${s.name}"`,e.push({file:s.name,message:u})):s.size>t.maxFileSize?(c=g.VALIDATION_FAILED,u=`File size (${re(s.size)}) exceeds limit of ${re(t.maxFileSize)}`,e.push({file:s.name,message:u})):(r+=s.size,r>t.maxTotalSize&&(c=g.VALIDATION_FAILED,u=`Total size would exceed limit of ${re(t.maxTotalSize)}`,e.push({file:s.name,message:u}))):(c=g.VALIDATION_FAILED,u=h.reason||"Invalid file name",e.push({file:s.name,message:u}));o.push({...s,status:c,statusMessage:u})}e.length>0&&(o=o.map(s=>s.status===g.EXCLUDED?s:{...s,status:g.VALIDATION_FAILED,statusMessage:s.status===g.VALIDATION_FAILED?s.statusMessage:"Deployment failed due to validation errors in bundle"}));let l=e.length===0?o.filter(s=>s.status===g.READY):[],p=e.length===0;return{files:o,validFiles:l,errors:e,warnings:i,canDeploy:p}}function Ge(n){return n.filter(t=>t.status===g.READY)}function en(n){return Ge(n).length>0}var ae=T(()=>{"use strict";S()});function we(n,t){if(n.includes("\0")||n.includes("/../")||n.startsWith("../")||n.endsWith("/.."))throw a.business(`Security error: Unsafe file path "${n}" for file: ${t}`)}function xe(n,t){let e=se(n);if(!e.valid)throw a.business(e.reason||"Invalid file name");if(L(n))throw a.business(`File extension not allowed: "${t}"`)}var le=T(()=>{"use strict";S();ae()});var Pe={};Oe(Pe,{processFilesForNode:()=>Ie});import*as E from"fs";import*as A from"path";function be(n,t=new Set){let e=[],i=E.realpathSync(n);if(t.has(i))return e;t.add(i);let o=E.readdirSync(n);for(let r of o){let l=A.join(n,r),p=E.statSync(l);if(p.isDirectory()){let s=be(l,t);e.push(...s)}else p.isFile()&&e.push(l)}return e}async function Ie(n,t={}){if(R()!=="node")throw a.business("processFilesForNode can only be called in Node.js environment.");for(let d of n){let y=A.resolve(d);try{if(E.statSync(y).isDirectory()){let C=E.readdirSync(y).find(v=>q.has(v));if(C)throw a.business(`"${C}" detected \u2014 deploy your build output (dist/, build/, out/), not the project folder`)}}catch(C){if(x(C))throw C}}let e=n.flatMap(d=>{let y=A.resolve(d);try{return E.statSync(y).isDirectory()?be(y):[y]}catch{throw a.file(`Path does not exist: ${d}`,d)}}),i=[...new Set(e)],o=n.map(d=>A.resolve(d)),r=Te(o.map(d=>{try{return E.statSync(d).isDirectory()?d:A.dirname(d)}catch{return A.dirname(d)}})),l=i.map(d=>{if(r&&r.length>0){let y=A.relative(r,d);if(y&&typeof y=="string"&&!y.startsWith(".."))return y.replace(/\\/g,"/")}return A.basename(d)}),p=new Set(ve(l));if(p.size===0)return[];let s=[],c=[];for(let d=0;d<i.length;d++)p.has(l[d])&&(s.push(i[d]),c.push(l[d]));let u=Re(c,{flatten:t.pathDetect!==!1}),h=[],D=0,w=O();for(let d=0;d<s.length;d++){let y=s[d],C=u[d].path;try{we(C,y);let v=E.statSync(y);if(v.size===0)continue;if(xe(C,y),v.size>w.maxFileSize)throw a.business(`File ${y} is too large. Maximum allowed size is ${w.maxFileSize/(1024*1024)}MB.`);if(D+=v.size,D>w.maxTotalSize)throw a.business(`Total deploy size is too large. Maximum allowed is ${w.maxTotalSize/(1024*1024)}MB.`);let F=E.readFileSync(y),{md5:ke}=await M(F);h.push({path:C,content:F,size:F.length,md5:ke})}catch(v){if(x(v))throw v;let F=v instanceof Error?v.message:String(v);throw a.file(`Failed to read file "${y}": ${F}`,y)}}if(h.length>w.maxFilesCount)throw a.business(`Too many files to deploy. Maximum allowed is ${w.maxFilesCount} files.`);return h}var pe=T(()=>{"use strict";k();K();te();le();S();N();oe();ne()});S();var B=class{constructor(){this.handlers=new Map}on(t,e){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(e)}off(t,e){let i=this.handlers.get(t);i&&(i.delete(e),i.size===0&&this.handlers.delete(t))}emit(t,...e){let i=this.handlers.get(t);if(!i)return;let o=Array.from(i);for(let r of o)try{r(...e)}catch(l){i.delete(r),t!=="error"&&setTimeout(()=>{l instanceof Error?this.emit("error",l,String(t)):this.emit("error",new Error(String(l)),String(t))},0)}}transfer(t){this.handlers.forEach((e,i)=>{e.forEach(o=>{t.on(i,o)})})}clear(){this.handlers.clear()}};var m={DEPLOYMENTS:"/deployments",DOMAINS:"/domains",TOKENS:"/tokens",ACCOUNT:"/account",CONFIG:"/config",PING:"/ping",SPA_CHECK:"/spa-check"},Le=3e4,P=class extends B{constructor(e){super();this.globalHeaders={};this.apiUrl=e.apiUrl||_,this.getAuthHeadersCallback=e.getAuthHeaders,this.useCredentials=e.useCredentials??!1,this.timeout=e.timeout??Le,this.createDeployBody=e.createDeployBody,this.deployEndpoint=e.deployEndpoint||m.DEPLOYMENTS}setGlobalHeaders(e){this.globalHeaders=e}transferEventsTo(e){this.transfer(e)}async executeRequest(e,i,o){let r=this.mergeHeaders(i.headers),{signal:l,cleanup:p}=this.createTimeoutSignal(i.signal),s={...i,headers:r,credentials:this.useCredentials&&!r.Authorization?"include":void 0,signal:l};this.emit("request",e,s);try{let c=await fetch(e,s);return p(),c.ok||await this.handleResponseError(c,o),this.emit("response",this.safeClone(c),e),{data:await this.parseResponse(this.safeClone(c)),status:c.status}}catch(c){p();let u=c instanceof Error?c:new Error(String(c));this.emit("error",u,e),this.handleFetchError(c,o)}}async request(e,i,o){let{data:r}=await this.executeRequest(e,i,o);return r}async requestWithStatus(e,i,o){return this.executeRequest(e,i,o)}mergeHeaders(e={}){return{...this.globalHeaders,...this.getAuthHeadersCallback(),...e}}createTimeoutSignal(e){let i=new AbortController,o=setTimeout(()=>i.abort(),this.timeout);if(e){let r=()=>i.abort();e.addEventListener("abort",r),e.aborted&&i.abort()}return{signal:i.signal,cleanup:()=>clearTimeout(o)}}safeClone(e){try{return e.clone()}catch{return e}}async parseResponse(e){if(!(e.headers.get("Content-Length")==="0"||e.status===204))return e.json()}async handleResponseError(e,i){let o={};try{if(e.headers.get("content-type")?.includes("application/json")){let p=await e.json();if(p&&typeof p=="object"){let s=p;typeof s.message=="string"&&(o.message=s.message),typeof s.error=="string"&&(o.error=s.error)}}else o={message:await e.text()}}catch{o={message:"Failed to parse error response"}}let r=o.message||o.error||`${i} failed`;throw e.status===401?a.authentication(r):a.api(r,e.status)}handleFetchError(e,i){throw x(e)?e:e instanceof Error&&e.name==="AbortError"?a.cancelled(`${i} was cancelled`):e instanceof TypeError&&e.message.includes("fetch")?a.network(`${i} failed: ${e.message}`,e):e instanceof Error?a.business(`${i} failed: ${e.message}`):a.business(`${i} failed: Unknown error`)}async deploy(e,i={}){if(!e.length)throw a.business("No files to deploy");for(let s of e)if(!s.md5)throw a.file(`MD5 checksum missing for file: ${s.path}`,s.path);let o=i.build||i.prerender?{build:i.build,prerender:i.prerender}:void 0,{body:r,headers:l}=await this.createDeployBody(e,i.labels,i.via,o),p={};return i.deployToken?p.Authorization=`Bearer ${i.deployToken}`:i.apiKey&&(p.Authorization=`Bearer ${i.apiKey}`),i.caller&&(p["X-Caller"]=i.caller),this.request(`${i.apiUrl||this.apiUrl}${this.deployEndpoint}`,{method:"POST",body:r,headers:{...l,...p},signal:i.signal||null},"Deploy")}async listDeployments(){return this.request(`${this.apiUrl}${m.DEPLOYMENTS}`,{method:"GET"},"List deployments")}async getDeployment(e){return this.request(`${this.apiUrl}${m.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"GET"},"Get deployment")}async updateDeploymentLabels(e,i){return this.request(`${this.apiUrl}${m.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({labels:i})},"Update deployment labels")}async removeDeployment(e){await this.request(`${this.apiUrl}${m.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove deployment")}async setDomain(e,i,o){let r={};i&&(r.deployment=i),o!==void 0&&(r.labels=o);let{data:l,status:p}=await this.requestWithStatus(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)},"Set domain");return{...l,isCreate:p===201}}async listDomains(){return this.request(`${this.apiUrl}${m.DOMAINS}`,{method:"GET"},"List domains")}async getDomain(e){return this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}`,{method:"GET"},"Get domain")}async removeDomain(e){await this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove domain")}async verifyDomain(e){return this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}/verify`,{method:"POST"},"Verify domain")}async getDomainDns(e){return this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}/dns`,{method:"GET"},"Get domain DNS")}async getDomainRecords(e){return this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}/records`,{method:"GET"},"Get domain records")}async getDomainShare(e){return this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}/share`,{method:"GET"},"Get domain share")}async validateDomain(e){return this.request(`${this.apiUrl}${m.DOMAINS}/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:e})},"Validate domain")}async createToken(e,i){let o={};return e!==void 0&&(o.ttl=e),i!==void 0&&(o.labels=i),this.request(`${this.apiUrl}${m.TOKENS}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},"Create token")}async listTokens(){return this.request(`${this.apiUrl}${m.TOKENS}`,{method:"GET"},"List tokens")}async removeToken(e){await this.request(`${this.apiUrl}${m.TOKENS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove token")}async fetchAgentToken(){return this.request(`${this.apiUrl}${m.TOKENS}/agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})},"Fetch agent token")}async getAccount(){return this.request(`${this.apiUrl}${m.ACCOUNT}`,{method:"GET"},"Get account")}async getConfig(){return this.request(`${this.apiUrl}${m.CONFIG}`,{method:"GET"},"Get config")}async ping(){return(await this.request(`${this.apiUrl}${m.PING}`,{method:"GET"},"Ping"))?.success||!1}async checkSPA(e,i={}){let o=e.find(c=>c.path==="index.html"||c.path==="/index.html");if(!o||o.size>100*1024)return!1;let r;if(typeof Buffer<"u"&&Buffer.isBuffer(o.content))r=o.content.toString("utf-8");else if(typeof Blob<"u"&&o.content instanceof Blob)r=await o.content.text();else if(typeof File<"u"&&o.content instanceof File)r=await o.content.text();else return!1;let l={"Content-Type":"application/json"};i.deployToken?l.Authorization=`Bearer ${i.deployToken}`:i.apiKey&&(l.Authorization=`Bearer ${i.apiKey}`);let p={files:e.map(c=>c.path),index:r};return(await this.request(`${this.apiUrl}${m.SPA_CHECK}`,{method:"POST",headers:l,body:JSON.stringify(p)},"SPA check")).isSPA}};S();N();S();S();function X(n={},t={}){let e={apiUrl:n.apiUrl||t.apiUrl||_,apiKey:n.apiKey!==void 0?n.apiKey:t.apiKey,deployToken:n.deployToken!==void 0?n.deployToken:t.deployToken},i={apiUrl:e.apiUrl};return e.apiKey!==void 0&&(i.apiKey=e.apiKey),e.deployToken!==void 0&&(i.deployToken=e.deployToken),i}function he(n,t){let e={...n};return e.apiUrl===void 0&&t.apiUrl!==void 0&&(e.apiUrl=t.apiUrl),e.apiKey===void 0&&t.apiKey!==void 0&&(e.apiKey=t.apiKey),e.deployToken===void 0&&t.deployToken!==void 0&&(e.deployToken=t.deployToken),e.timeout===void 0&&t.timeout!==void 0&&(e.timeout=t.timeout),e.maxConcurrency===void 0&&t.maxConcurrency!==void 0&&(e.maxConcurrency=t.maxConcurrency),e.onProgress===void 0&&t.onProgress!==void 0&&(e.onProgress=t.onProgress),e.caller===void 0&&t.caller!==void 0&&(e.caller=t.caller),e}S();K();async function Me(){let t=JSON.stringify({rewrites:[{source:"/(.*)",destination:"/index.html"}]},null,2),e;typeof Buffer<"u"?e=Buffer.from(t,"utf-8"):e=new Blob([t],{type:"application/json"});let{md5:i}=await M(e);return{path:Y,content:e,size:t.length,md5:i}}async function ye(n,t,e){if(e.spaDetect===!1||e.build||e.prerender||n.some(i=>i.path===Y))return n;try{if(await t.checkSPA(n,e)){let o=await Me();return[...n,o]}}catch{}return n}function ge(n){let{getApi:t,ensureInit:e,processInput:i,clientDefaults:o,hasAuth:r}=n;return{upload:async(l,p={})=>{await e();let s=o?he(p,o):p;if(r&&!r()&&!s.deployToken&&!s.apiKey)try{let h=t(),{secret:D}=await h.fetchAgentToken();s.deployToken=D}catch{throw a.authentication("Too many requests; try again later or configure a free API key with 'ship config'")}if(!i)throw a.config("processInput function is not provided.");let c=t(),u=await i(l,s);return u=await ye(u,c,s),c.deploy(u,s)},list:async()=>(await e(),t().listDeployments()),get:async l=>(await e(),t().getDeployment(l)),set:async(l,p)=>(await e(),t().updateDeploymentLabels(l,p.labels)),remove:async l=>{await e(),await t().removeDeployment(l)}}}function De(n){let{getApi:t,ensureInit:e}=n;return{set:async(i,o={})=>(await e(),t().setDomain(i,o.deployment,o.labels)),list:async()=>(await e(),t().listDomains()),get:async i=>(await e(),t().getDomain(i)),remove:async i=>{await e(),await t().removeDomain(i)},verify:async i=>(await e(),t().verifyDomain(i)),validate:async i=>(await e(),t().validateDomain(i)),dns:async i=>(await e(),t().getDomainDns(i)),records:async i=>(await e(),t().getDomainRecords(i)),share:async i=>(await e(),t().getDomainShare(i))}}function Se(n){let{getApi:t,ensureInit:e}=n;return{get:async()=>(await e(),t().getAccount())}}function Ee(n){let{getApi:t,ensureInit:e}=n;return{create:async(i={})=>(await e(),t().createToken(i.ttl,i.labels)),list:async()=>(await e(),t().listTokens()),remove:async i=>{await e(),await t().removeToken(i)}}}var z=class{constructor(t={}){this.initPromise=null;this._config=null;this.auth=null;this.customHeaders={};this.clientOptions=t,t.deployToken?this.auth={type:"token",value:t.deployToken}:t.apiKey&&(this.auth={type:"apiKey",value:t.apiKey}),this.authHeadersCallback=()=>this.getAuthHeaders();let e=this.resolveInitialConfig(t);this.http=new P({...t,...e,getAuthHeaders:this.authHeadersCallback,createDeployBody:this.getDeployBodyCreator()});let i={getApi:()=>this.http,ensureInit:()=>this.ensureInitialized()};this._deployments=ge({...i,processInput:(o,r)=>this.processInput(o,r),clientDefaults:this.clientOptions,hasAuth:()=>this.hasAuth()}),this._domains=De(i),this._account=Se(i),this._tokens=Ee(i)}async ensureInitialized(){return this.initPromise||(this.initPromise=this.loadFullConfig()),this.initPromise}async ping(){return await this.ensureInitialized(),this.http.ping()}async deploy(t,e){return this.deployments.upload(t,e)}async whoami(){return this.account.get()}get deployments(){return this._deployments}get domains(){return this._domains}get account(){return this._account}get tokens(){return this._tokens}async getConfig(){return this._config?this._config:(await this.ensureInitialized(),this._config=O(),this._config)}on(t,e){this.http.on(t,e)}off(t,e){this.http.off(t,e)}setHeaders(t){this.customHeaders=t,this.http.setGlobalHeaders(t)}clearHeaders(){this.customHeaders={},this.http.setGlobalHeaders({})}replaceHttpClient(t){if(this.http?.transferEventsTo)try{this.http.transferEventsTo(t)}catch(e){console.warn("Event transfer failed during client replacement:",e)}this.http=t,Object.keys(this.customHeaders).length>0&&this.http.setGlobalHeaders(this.customHeaders)}setDeployToken(t){if(!t||typeof t!="string")throw a.business("Invalid deploy token provided. Deploy token must be a non-empty string.");this.auth={type:"token",value:t}}setApiKey(t){if(!t||typeof t!="string")throw a.business("Invalid API key provided. API key must be a non-empty string.");this.auth={type:"apiKey",value:t}}getAuthHeaders(){return this.auth?{Authorization:`Bearer ${this.auth.value}`}:{}}hasAuth(){return this.clientOptions.useCredentials?!0:this.auth!==null}};S();k();S();k();import{z as $}from"zod";var Z="ship",Ke=$.object({apiUrl:$.string().url().optional(),apiKey:$.string().optional(),deployToken:$.string().optional()}).strict();function Ae(n){try{return Ke.parse(n)}catch(t){if(t instanceof $.ZodError){let e=t.issues[0],i=e.path.length>0?` at ${e.path.join(".")}`:"";throw a.config(`Configuration validation failed${i}: ${e.message}`)}throw a.config("Configuration validation failed")}}async function ze(n){try{if(R()!=="node")return{};let{cosmiconfigSync:t}=await import("cosmiconfig"),e=await import("os"),i=t(Z,{searchPlaces:[`.${Z}rc`,"package.json",`${e.homedir()}/.${Z}rc`],stopDir:e.homedir()}),o;if(n?o=i.load(n):o=i.search(),o&&o.config)return Ae(o.config)}catch(t){if(x(t))throw t}return{}}async function ee(n){if(R()!=="node")return{};let t={apiUrl:process.env.SHIP_API_URL,apiKey:process.env.SHIP_API_KEY,deployToken:process.env.SHIP_DEPLOY_TOKEN},e=await ze(n),i={apiUrl:t.apiUrl??e.apiUrl,apiKey:t.apiKey??e.apiKey,deployToken:t.deployToken??e.deployToken};return Ae(i)}N();S();async function Ce(n,t,e,i){let{FormData:o,File:r}=await import("formdata-node"),{FormDataEncoder:l}=await import("form-data-encoder"),p=new o,s=[];for(let D of n){if(!Buffer.isBuffer(D.content)&&!(typeof Blob<"u"&&D.content instanceof Blob))throw a.file(`Unsupported file.content type for Node.js: ${D.path}`,D.path);if(!D.md5)throw a.file(`File missing md5 checksum: ${D.path}`,D.path);let w=new r([D.content],D.path,{type:"application/octet-stream"});p.append("files[]",w),s.push(D.md5)}p.append("checksums",JSON.stringify(s)),t&&t.length>0&&p.append("labels",JSON.stringify(t)),e&&p.append("via",e),i?.build&&p.append("build","true"),i?.prerender&&p.append("prerender","true");let c=new l(p),u=[];for await(let D of c.encode())u.push(Buffer.from(D));let h=Buffer.concat(u);return{body:h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength),headers:{"Content-Type":c.contentType,"Content-Length":Buffer.byteLength(h).toString()}}}K();function jt(n,t,e,i=!0){let o=n===1?t:e;return i?`${n} ${o}`:o}te();oe();k();ae();le();S();N();pe();var ce=class extends z{constructor(t={}){if(R()!=="node")throw a.business("Node.js Ship class can only be used in Node.js environment.");super(t)}resolveInitialConfig(t){return X(t,{})}async loadFullConfig(){try{let t=await ee(this.clientOptions.configFile),e=X(this.clientOptions,t);e.deployToken&&!this.clientOptions.deployToken?this.setDeployToken(e.deployToken):e.apiKey&&!this.clientOptions.apiKey&&this.setApiKey(e.apiKey);let i=new P({...this.clientOptions,...e,getAuthHeaders:this.authHeadersCallback,createDeployBody:this.getDeployBodyCreator()});this.replaceHttpClient(i);let o=await this.http.getConfig();J(o)}catch(t){throw this.initPromise=null,t}}async processInput(t,e){let i=typeof t=="string"?[t]:t;if(!Array.isArray(i)||!i.every(r=>typeof r=="string"))throw a.business("Invalid input type for Node.js environment. Expected string or string[].");if(i.length===0)throw a.business("No files to deploy.");let{processFilesForNode:o}=await Promise.resolve().then(()=>(pe(),Pe));return o(i,e)}getDeployBodyCreator(){return Ce}},qe=ce;export{V as API_KEY_HEX_LENGTH,Qe as API_KEY_HINT_LENGTH,b as API_KEY_PREFIX,ue as API_KEY_TOTAL_LENGTH,Xe as AccountPlan,P as ApiHttp,Ze as AuthMethod,Ne as BLOCKED_EXTENSIONS,_ as DEFAULT_API,Y as DEPLOYMENT_CONFIG_FILENAME,G as DEPLOY_TOKEN_HEX_LENGTH,I as DEPLOY_TOKEN_PREFIX,de as DEPLOY_TOKEN_TOTAL_LENGTH,We as DeploymentStatus,Je as DomainStatus,f as ErrorType,g as FILE_VALIDATION_STATUS,g as FileValidationStatus,je as JUNK_DIRECTORIES,lt as LABEL_CONSTRAINTS,pt as LABEL_PATTERN,ce as Ship,a as ShipError,q as UNBUILT_PROJECT_MARKERS,$e as UNSAFE_FILENAME_CHARS,At as __setTestEnvironment,en as allValidFilesReady,M as calculateMD5,Se as createAccountResource,ge as createDeploymentResource,De as createDomainResource,Ee as createTokenResource,qe as default,ut as deserializeLabels,rt as extractSubdomain,ve as filterJunk,re as formatFileSize,st as generateDeploymentUrl,at as generateDomainUrl,O as getCurrentConfig,R as getENV,Ge as getValidFiles,U as hasUnbuiltMarker,fe as hasUnsafeChars,L as isBlockedExtension,ot as isCustomDomain,it as isDeployment,me as isPlatformDomain,x as isShipError,ee as loadConfig,he as mergeDeployOptions,Re as optimizeDeployPaths,jt as pluralize,Ie as processFilesForNode,X as resolveConfig,ct as serializeLabels,J as setPlatformConfig,et as validateApiKey,nt as validateApiUrl,xe as validateDeployFile,we as validateDeployPath,tt as validateDeployToken,se as validateFileName,Zt as validateFiles};
|
|
1
|
+
var Oe=Object.defineProperty;var T=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ne=(n,t)=>{for(var e in t)Oe(n,e,{get:t[e],enumerable:!0})};function w(n){return n!==null&&typeof n=="object"&&"name"in n&&n.name==="ShipError"&&"status"in n}function U(n){let t=n.lastIndexOf(".");if(t===-1||t===n.length-1)return!1;let e=n.slice(t+1).toLowerCase();return $e.has(e)}function me(n){return Le.test(n)}function _(n){return n.replace(/\\/g,"/").split("/").filter(Boolean).some(e=>Y.has(e))}function tt(n){if(!n.startsWith(b))throw a.validation(`API key must start with "${b}"`);if(n.length!==de)throw a.validation(`API key must be ${de} characters total (${b} + ${G} hex chars)`);let t=n.slice(b.length);if(!/^[a-f0-9]{64}$/i.test(t))throw a.validation(`API key must contain ${G} hexadecimal characters after "${b}" prefix`)}function nt(n){if(!n.startsWith(I))throw a.validation(`Deploy token must start with "${I}"`);if(n.length!==fe)throw a.validation(`Deploy token must be ${fe} characters total (${I} + ${q} hex chars)`);let t=n.slice(I.length);if(!/^[a-f0-9]{64}$/i.test(t))throw a.validation(`Deploy token must contain ${q} hexadecimal characters after "${I}" prefix`)}function it(n){try{let t=new URL(n);if(!["http:","https:"].includes(t.protocol))throw a.validation("API URL must use http:// or https:// protocol");if(t.pathname!=="/"&&t.pathname!=="")throw a.validation("API URL must not contain a path");if(t.search||t.hash)throw a.validation("API URL must not contain query parameters or fragments")}catch(t){throw w(t)?t:a.validation("API URL must be a valid URL")}}function ot(n){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(n)}function he(n,t){return n.endsWith(`.${t}`)}function st(n,t){return!he(n,t)}function rt(n,t){return he(n,t)?n.slice(0,-(t.length+1)):null}function at(n){return`https://${n}`}function lt(n){return`https://${n}`}function ut(n){return!n||n.length===0?null:JSON.stringify(n)}function dt(n){if(!n)return[];try{let t=JSON.parse(n);return Array.isArray(t)?t:[]}catch{return[]}}var Je,Xe,Qe,f,V,a,$e,Le,Y,b,G,de,Ze,I,q,fe,et,W,B,g,pt,ct,S=T(()=>{"use strict";Je={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},Xe={PENDING:"pending",PARTIAL:"partial",SUCCESS:"success",PAUSED:"paused"},Qe={FREE:"free",STANDARD:"standard",SPONSORED:"sponsored",ENTERPRISE:"enterprise",SUSPENDED:"suspended",TERMINATING:"terminating",TERMINATED:"terminated"};(function(n){n.Validation="validation_failed",n.NotFound="not_found",n.RateLimit="rate_limit_exceeded",n.Authentication="authentication_failed",n.Business="business_logic_error",n.Api="internal_server_error",n.Network="network_error",n.Cancelled="operation_cancelled",n.File="file_error",n.Config="config_error"})(f||(f={}));V={client:new Set([f.Business,f.Config,f.File,f.Validation]),network:new Set([f.Network]),auth:new Set([f.Authentication])},a=class n extends Error{type;status;details;constructor(t,e,i,o){super(e),this.type=t,this.status=i,this.details=o,this.name="ShipError"}toResponse(){let t=this.type===f.Authentication&&this.details?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:t}}static fromResponse(t){return new n(t.error,t.message,t.status,t.details)}static validation(t,e){return new n(f.Validation,t,400,e)}static notFound(t,e){let i=e?`${t} ${e} not found`:`${t} not found`;return new n(f.NotFound,i,404)}static rateLimit(t="Too many requests"){return new n(f.RateLimit,t,429)}static authentication(t="Authentication required",e){return new n(f.Authentication,t,401,e)}static business(t,e=400){return new n(f.Business,t,e)}static network(t,e){return new n(f.Network,t,void 0,{cause:e})}static cancelled(t){return new n(f.Cancelled,t)}static file(t,e){return new n(f.File,t,void 0,{filePath:e})}static config(t,e){return new n(f.Config,t,void 0,e)}static api(t,e=500){return new n(f.Api,t,e)}static database(t,e=500){return new n(f.Api,t,e)}static storage(t,e=500){return new n(f.Api,t,e)}get filePath(){return this.details?.filePath}isClientError(){return V.client.has(this.type)}isNetworkError(){return V.network.has(this.type)}isAuthError(){return V.auth.has(this.type)}isValidationError(){return this.type===f.Validation}isFileError(){return this.type===f.File}isConfigError(){return this.type===f.Config}isType(t){return this.type===t}};$e=new Set(["exe","msi","dll","scr","bat","cmd","com","pif","app","deb","rpm","pkg","mpkg","dmg","iso","img","cab","cpl","chm","ps1","vbs","vbe","ws","wsf","wsc","wsh","reg","jar","jnlp","apk","crx","lnk","inf","hta"]);Le=/[\x00-\x1f\x7f#?%\\<>"]/;Y=new Set(["node_modules","package.json"]);b="ship-",G=64,de=b.length+G,Ze=4,I="token-",q=64,fe=I.length+q,et={JWT:"jwt",API_KEY:"apiKey",TOKEN:"token",WEBHOOK:"webhook",SYSTEM:"system"},W="ship.json";B="https://api.shipstatic.com",g={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};pt={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},ct=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/});function X(n){J=n}function O(){if(J===null)throw a.config("Platform configuration not initialized. The SDK must fetch configuration from the API before performing operations.");return J}var J,N=T(()=>{"use strict";S();J=null});function Ct(n){Z=n}function _e(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function R(){return Z||_e()}var Z,k=T(()=>{"use strict";Z=null});async function Be(n){let t=(await import("spark-md5")).default;return new Promise((e,i)=>{let s=Math.ceil(n.size/2097152),l=0,p=new t.ArrayBuffer,r=new FileReader,c=()=>{let u=l*2097152,y=Math.min(u+2097152,n.size);r.readAsArrayBuffer(n.slice(u,y))};r.onload=u=>{let y=u.target?.result;if(!y){i(a.business("Failed to read file chunk"));return}p.append(y),l++,l<s?c():e({md5:p.end()})},r.onerror=()=>{i(a.business("Failed to calculate MD5: FileReader error"))},c()})}async function Me(n){let t=await import("crypto");if(Buffer.isBuffer(n)){let i=t.createHash("md5");return i.update(n),{md5:i.digest("hex")}}let e=await import("fs");return new Promise((i,o)=>{let s=t.createHash("md5"),l=e.createReadStream(n);l.on("error",p=>o(a.business(`Failed to read file for MD5: ${p.message}`))),l.on("data",p=>s.update(p)),l.on("end",()=>i({md5:s.digest("hex")}))})}async function K(n){let t=R();if(t==="browser"){if(!(n instanceof Blob))throw a.business("Invalid input for browser MD5 calculation: Expected Blob or File.");return Be(n)}if(t==="node"){if(!(Buffer.isBuffer(n)||typeof n=="string"))throw a.business("Invalid input for Node.js MD5 calculation: Expected Buffer or file path string.");return Me(n)}throw a.business("Unknown or unsupported execution environment for MD5 calculation.")}var z=T(()=>{"use strict";k();S()});import{isJunk as je}from"junk";function Te(n,t){if(!n||n.length===0)return[];if(!t?.allowUnbuilt&&n.find(i=>i&&_(i)))throw a.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return n.filter(e=>{if(!e)return!1;let i=e.replace(/\\/g,"/").split("/").filter(Boolean);if(i.length===0)return!0;let o=i[i.length-1];if(je(o))return!1;for(let l of i)if(l!==".well-known"&&(l.startsWith(".")||l.length>255))return!1;let s=i.slice(0,-1);for(let l of s)if(Ve.some(p=>l.toLowerCase()===p.toLowerCase()))return!1;return!0})}var Ve,ne=T(()=>{"use strict";S();Ve=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function Re(n){if(!n||n.length===0)return"";let t=n.filter(s=>s&&typeof s=="string").map(s=>s.replace(/\\/g,"/"));if(t.length===0)return"";if(t.length===1)return t[0];let e=t.map(s=>s.split("/").filter(Boolean)),i=[],o=Math.min(...e.map(s=>s.length));for(let s=0;s<o;s++){let l=e[0][s];if(e.every(p=>p[s]===l))i.push(l);else break}return i.join("/")}function j(n){return n.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var ie=T(()=>{"use strict"});function we(n,t={}){if(t.flatten===!1)return n.map(i=>({path:j(i),name:oe(i)}));let e=Ge(n);return n.map(i=>{let o=j(i);if(e){let s=e.endsWith("/")?e:`${e}/`;o.startsWith(s)&&(o=o.substring(s.length))}return o||(o=oe(i)),{path:o,name:oe(i)}})}function Ge(n){if(!n.length)return"";let e=n.map(s=>j(s)).map(s=>s.split("/")),i=[],o=Math.min(...e.map(s=>s.length));for(let s=0;s<o-1;s++){let l=e[0][s];if(e.every(p=>p[s]===l))i.push(l);else break}return i.join("/")}function oe(n){return n.split(/[/\\]/).pop()||n}var se=T(()=>{"use strict";ie()});function re(n,t=1){if(n===0)return"0 Bytes";let e=1024,i=["Bytes","KB","MB","GB"],o=Math.floor(Math.log(n)/Math.log(e));return parseFloat((n/Math.pow(e,o)).toFixed(t))+" "+i[o]}function ae(n){if(me(n))return{valid:!1,reason:"File name contains unsafe characters"};if(n.startsWith(" ")||n.endsWith(" "))return{valid:!1,reason:"File name cannot start/end with spaces"};if(n.endsWith("."))return{valid:!1,reason:"File name cannot end with dots"};let t=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,e=n.split("/").pop()||n;return t.test(e)?{valid:!1,reason:"File name uses a reserved system name"}:n.includes("..")?{valid:!1,reason:"File name contains path traversal pattern"}:{valid:!0}}function en(n,t){let e=[],i=[],o=[];if(n.length===0){let r={file:"(no files)",message:"At least one file must be provided"};return e.push(r),{files:[],validFiles:[],errors:e,warnings:[],canDeploy:!1}}for(let r of n)if(_(r.name))return e.push({file:r.name,message:"Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder"}),{files:n.map(c=>({...c,status:g.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:e,warnings:[],canDeploy:!1};if(n.length>t.maxFilesCount){let r={file:`(${n.length} files)`,message:`File count (${n.length}) exceeds limit of ${t.maxFilesCount}`};return e.push(r),{files:n.map(c=>({...c,status:g.VALIDATION_FAILED,statusMessage:r.message})),validFiles:[],errors:e,warnings:[],canDeploy:!1}}let s=0;for(let r of n){let c=g.READY,u="Ready for upload",y=r.name?ae(r.name):{valid:!1,reason:"File name cannot be empty"};if(r.status===g.PROCESSING_ERROR)c=g.VALIDATION_FAILED,u=r.statusMessage||"File failed during processing",e.push({file:r.name,message:u});else if(r.size===0){c=g.EXCLUDED,u="File is empty (0 bytes) and cannot be deployed due to storage limitations",i.push({file:r.name,message:u}),o.push({...r,status:c,statusMessage:u});continue}else r.size<0?(c=g.VALIDATION_FAILED,u="File size must be positive",e.push({file:r.name,message:u})):!r.name||r.name.trim().length===0?(c=g.VALIDATION_FAILED,u="File name cannot be empty",e.push({file:r.name||"(empty)",message:u})):r.name.includes("\0")?(c=g.VALIDATION_FAILED,u="File name contains invalid characters (null byte)",e.push({file:r.name,message:u})):y.valid?U(r.name)?(c=g.VALIDATION_FAILED,u=`File extension not allowed: "${r.name}"`,e.push({file:r.name,message:u})):r.size>t.maxFileSize?(c=g.VALIDATION_FAILED,u=`File size (${re(r.size)}) exceeds limit of ${re(t.maxFileSize)}`,e.push({file:r.name,message:u})):(s+=r.size,s>t.maxTotalSize&&(c=g.VALIDATION_FAILED,u=`Total size would exceed limit of ${re(t.maxTotalSize)}`,e.push({file:r.name,message:u}))):(c=g.VALIDATION_FAILED,u=y.reason||"Invalid file name",e.push({file:r.name,message:u}));o.push({...r,status:c,statusMessage:u})}e.length>0&&(o=o.map(r=>r.status===g.EXCLUDED?r:{...r,status:g.VALIDATION_FAILED,statusMessage:r.status===g.VALIDATION_FAILED?r.statusMessage:"Deployment failed due to validation errors in bundle"}));let l=e.length===0?o.filter(r=>r.status===g.READY):[],p=e.length===0;return{files:o,validFiles:l,errors:e,warnings:i,canDeploy:p}}function qe(n){return n.filter(t=>t.status===g.READY)}function tn(n){return qe(n).length>0}var le=T(()=>{"use strict";S()});function xe(n,t){if(n.includes("\0")||n.includes("/../")||n.startsWith("../")||n.endsWith("/.."))throw a.business(`Security error: Unsafe file path "${n}" for file: ${t}`)}function be(n,t){let e=ae(n);if(!e.valid)throw a.business(e.reason||"Invalid file name");if(U(n))throw a.business(`File extension not allowed: "${t}"`)}var pe=T(()=>{"use strict";S();le()});var ke={};Ne(ke,{processFilesForNode:()=>Pe});import*as E from"fs";import*as A from"path";function Ie(n,t=new Set){let e=[],i=E.realpathSync(n);if(t.has(i))return e;t.add(i);let o=E.readdirSync(n);for(let s of o){let l=A.join(n,s),p=E.statSync(l);if(p.isDirectory()){let r=Ie(l,t);e.push(...r)}else p.isFile()&&e.push(l)}return e}async function Pe(n,t={}){if(R()!=="node")throw a.business("processFilesForNode can only be called in Node.js environment.");for(let d of n){let h=A.resolve(d);try{if(E.statSync(h).isDirectory()){let C=E.readdirSync(h).find(v=>Y.has(v));if(C)throw a.business(`"${C}" detected \u2014 deploy your build output (dist/, build/, out/), not the project folder`)}}catch(C){if(w(C))throw C}}let e=n.flatMap(d=>{let h=A.resolve(d);try{return E.statSync(h).isDirectory()?Ie(h):[h]}catch{throw a.file(`Path does not exist: ${d}`,d)}}),i=[...new Set(e)],o=n.map(d=>A.resolve(d)),s=Re(o.map(d=>{try{return E.statSync(d).isDirectory()?d:A.dirname(d)}catch{return A.dirname(d)}})),l=i.map(d=>{if(s&&s.length>0){let h=A.relative(s,d);if(h&&typeof h=="string"&&!h.startsWith(".."))return h.replace(/\\/g,"/")}return A.basename(d)}),r=we(l,{flatten:t.pathDetect!==!1}).map(d=>d.path),c=new Set(Te(r));if(c.size===0)return[];let u=[],y=[];for(let d=0;d<i.length;d++)c.has(r[d])&&(u.push(i[d]),y.push(r[d]));let D=[],L=0,x=O();for(let d=0;d<u.length;d++){let h=u[d],C=y[d];try{xe(C,h);let v=E.statSync(h);if(v.size===0)continue;if(be(C,h),v.size>x.maxFileSize)throw a.business(`File ${h} is too large. Maximum allowed size is ${x.maxFileSize/(1024*1024)}MB.`);if(L+=v.size,L>x.maxTotalSize)throw a.business(`Total deploy size is too large. Maximum allowed is ${x.maxTotalSize/(1024*1024)}MB.`);let F=E.readFileSync(h),{md5:Fe}=await K(F);D.push({path:C,content:F,size:F.length,md5:Fe})}catch(v){if(w(v))throw v;let F=v instanceof Error?v.message:String(v);throw a.file(`Failed to read file "${h}": ${F}`,h)}}if(D.length>x.maxFilesCount)throw a.business(`Too many files to deploy. Maximum allowed is ${x.maxFilesCount} files.`);return D}var ce=T(()=>{"use strict";k();z();ne();pe();S();N();se();ie()});S();var M=class{constructor(){this.handlers=new Map}on(t,e){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(e)}off(t,e){let i=this.handlers.get(t);i&&(i.delete(e),i.size===0&&this.handlers.delete(t))}emit(t,...e){let i=this.handlers.get(t);if(!i)return;let o=Array.from(i);for(let s of o)try{s(...e)}catch(l){i.delete(s),t!=="error"&&setTimeout(()=>{l instanceof Error?this.emit("error",l,String(t)):this.emit("error",new Error(String(l)),String(t))},0)}}transfer(t){this.handlers.forEach((e,i)=>{e.forEach(o=>{t.on(i,o)})})}clear(){this.handlers.clear()}};var m={DEPLOYMENTS:"/deployments",DOMAINS:"/domains",TOKENS:"/tokens",ACCOUNT:"/account",CONFIG:"/config",PING:"/ping",SPA_CHECK:"/spa-check"},Ue=3e4,P=class extends M{constructor(e){super();this.globalHeaders={};this.apiUrl=e.apiUrl||B,this.getAuthHeadersCallback=e.getAuthHeaders,this.useCredentials=e.useCredentials??!1,this.timeout=e.timeout??Ue,this.createDeployBody=e.createDeployBody,this.deployEndpoint=e.deployEndpoint||m.DEPLOYMENTS}setGlobalHeaders(e){this.globalHeaders=e}transferEventsTo(e){this.transfer(e)}async executeRequest(e,i,o){let s=this.mergeHeaders(i.headers),{signal:l,cleanup:p}=this.createTimeoutSignal(i.signal),r={...i,headers:s,credentials:this.useCredentials&&!s.Authorization?"include":void 0,signal:l};this.emit("request",e,r);try{let c=await fetch(e,r);return p(),c.ok||await this.handleResponseError(c,o),this.emit("response",this.safeClone(c),e),{data:await this.parseResponse(this.safeClone(c)),status:c.status}}catch(c){p();let u=c instanceof Error?c:new Error(String(c));this.emit("error",u,e),this.handleFetchError(c,o)}}async request(e,i,o){let{data:s}=await this.executeRequest(e,i,o);return s}async requestWithStatus(e,i,o){return this.executeRequest(e,i,o)}mergeHeaders(e={}){return{...this.globalHeaders,...this.getAuthHeadersCallback(),...e}}createTimeoutSignal(e){let i=new AbortController,o=setTimeout(()=>i.abort(),this.timeout);if(e){let s=()=>i.abort();e.addEventListener("abort",s),e.aborted&&i.abort()}return{signal:i.signal,cleanup:()=>clearTimeout(o)}}safeClone(e){try{return e.clone()}catch{return e}}async parseResponse(e){if(!(e.headers.get("Content-Length")==="0"||e.status===204))return e.json()}async handleResponseError(e,i){let o={};try{if(e.headers.get("content-type")?.includes("application/json")){let p=await e.json();if(p&&typeof p=="object"){let r=p;typeof r.message=="string"&&(o.message=r.message),typeof r.error=="string"&&(o.error=r.error)}}else o={message:await e.text()}}catch{o={message:"Failed to parse error response"}}let s=o.message||o.error||`${i} failed`;throw e.status===401?a.authentication(s):a.api(s,e.status)}handleFetchError(e,i){throw w(e)?e:e instanceof Error&&e.name==="AbortError"?a.cancelled(`${i} was cancelled`):e instanceof TypeError&&e.message.includes("fetch")?a.network(`${i} failed: ${e.message}`,e):e instanceof Error?a.business(`${i} failed: ${e.message}`):a.business(`${i} failed: Unknown error`)}async deploy(e,i={}){if(!e.length)throw a.business("No files to deploy");for(let r of e)if(!r.md5)throw a.file(`MD5 checksum missing for file: ${r.path}`,r.path);let o=i.build||i.prerender?{build:i.build,prerender:i.prerender}:void 0,{body:s,headers:l}=await this.createDeployBody(e,i.labels,i.via,o),p={};return i.deployToken?p.Authorization=`Bearer ${i.deployToken}`:i.apiKey&&(p.Authorization=`Bearer ${i.apiKey}`),i.caller&&(p["X-Caller"]=i.caller),this.request(`${i.apiUrl||this.apiUrl}${this.deployEndpoint}`,{method:"POST",body:s,headers:{...l,...p},signal:i.signal||null},"Deploy")}async listDeployments(){return this.request(`${this.apiUrl}${m.DEPLOYMENTS}`,{method:"GET"},"List deployments")}async getDeployment(e){return this.request(`${this.apiUrl}${m.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"GET"},"Get deployment")}async updateDeploymentLabels(e,i){return this.request(`${this.apiUrl}${m.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({labels:i})},"Update deployment labels")}async removeDeployment(e){await this.request(`${this.apiUrl}${m.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove deployment")}async setDomain(e,i,o){let s={};i&&(s.deployment=i),o!==void 0&&(s.labels=o);let{data:l,status:p}=await this.requestWithStatus(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},"Set domain");return{...l,isCreate:p===201}}async listDomains(){return this.request(`${this.apiUrl}${m.DOMAINS}`,{method:"GET"},"List domains")}async getDomain(e){return this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}`,{method:"GET"},"Get domain")}async removeDomain(e){await this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove domain")}async verifyDomain(e){return this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}/verify`,{method:"POST"},"Verify domain")}async getDomainDns(e){return this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}/dns`,{method:"GET"},"Get domain DNS")}async getDomainRecords(e){return this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}/records`,{method:"GET"},"Get domain records")}async getDomainShare(e){return this.request(`${this.apiUrl}${m.DOMAINS}/${encodeURIComponent(e)}/share`,{method:"GET"},"Get domain share")}async validateDomain(e){return this.request(`${this.apiUrl}${m.DOMAINS}/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:e})},"Validate domain")}async createToken(e,i){let o={};return e!==void 0&&(o.ttl=e),i!==void 0&&(o.labels=i),this.request(`${this.apiUrl}${m.TOKENS}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},"Create token")}async listTokens(){return this.request(`${this.apiUrl}${m.TOKENS}`,{method:"GET"},"List tokens")}async removeToken(e){await this.request(`${this.apiUrl}${m.TOKENS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove token")}async fetchAgentToken(){return this.request(`${this.apiUrl}${m.TOKENS}/agent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})},"Fetch agent token")}async getAccount(){return this.request(`${this.apiUrl}${m.ACCOUNT}`,{method:"GET"},"Get account")}async getConfig(){return this.request(`${this.apiUrl}${m.CONFIG}`,{method:"GET"},"Get config")}async ping(){return(await this.request(`${this.apiUrl}${m.PING}`,{method:"GET"},"Ping"))?.success||!1}async checkSPA(e,i={}){let o=e.find(c=>c.path==="index.html"||c.path==="/index.html");if(!o||o.size>100*1024)return!1;let s;if(typeof Buffer<"u"&&Buffer.isBuffer(o.content))s=o.content.toString("utf-8");else if(typeof Blob<"u"&&o.content instanceof Blob)s=await o.content.text();else if(typeof File<"u"&&o.content instanceof File)s=await o.content.text();else return!1;let l={"Content-Type":"application/json"};i.deployToken?l.Authorization=`Bearer ${i.deployToken}`:i.apiKey&&(l.Authorization=`Bearer ${i.apiKey}`);let p={files:e.map(c=>c.path),index:s};return(await this.request(`${this.apiUrl}${m.SPA_CHECK}`,{method:"POST",headers:l,body:JSON.stringify(p)},"SPA check")).isSPA}};S();N();S();S();function Q(n={},t={}){let e={apiUrl:n.apiUrl||t.apiUrl||B,apiKey:n.apiKey!==void 0?n.apiKey:t.apiKey,deployToken:n.deployToken!==void 0?n.deployToken:t.deployToken},i={apiUrl:e.apiUrl};return e.apiKey!==void 0&&(i.apiKey=e.apiKey),e.deployToken!==void 0&&(i.deployToken=e.deployToken),i}function ye(n,t){let e={...n};return e.apiUrl===void 0&&t.apiUrl!==void 0&&(e.apiUrl=t.apiUrl),e.apiKey===void 0&&t.apiKey!==void 0&&(e.apiKey=t.apiKey),e.deployToken===void 0&&t.deployToken!==void 0&&(e.deployToken=t.deployToken),e.timeout===void 0&&t.timeout!==void 0&&(e.timeout=t.timeout),e.maxConcurrency===void 0&&t.maxConcurrency!==void 0&&(e.maxConcurrency=t.maxConcurrency),e.onProgress===void 0&&t.onProgress!==void 0&&(e.onProgress=t.onProgress),e.caller===void 0&&t.caller!==void 0&&(e.caller=t.caller),e}S();z();async function Ke(){let t=JSON.stringify({rewrites:[{source:"/(.*)",destination:"/index.html"}]},null,2),e;typeof Buffer<"u"?e=Buffer.from(t,"utf-8"):e=new Blob([t],{type:"application/json"});let{md5:i}=await K(e);return{path:W,content:e,size:t.length,md5:i}}async function ge(n,t,e){if(e.spaDetect===!1||e.build||e.prerender||n.some(i=>i.path===W))return n;try{if(await t.checkSPA(n,e)){let o=await Ke();return[...n,o]}}catch{}return n}function De(n){let{getApi:t,ensureInit:e,processInput:i,clientDefaults:o,hasAuth:s}=n;return{upload:async(l,p={})=>{await e();let r=o?ye(p,o):p;if(s&&!s()&&!r.deployToken&&!r.apiKey)try{let y=t(),{secret:D}=await y.fetchAgentToken();r.deployToken=D}catch{throw a.authentication("Too many requests; try again later or configure a free API key with 'ship config'")}if(!i)throw a.config("processInput function is not provided.");let c=t(),u=await i(l,r);return u=await ge(u,c,r),c.deploy(u,r)},list:async()=>(await e(),t().listDeployments()),get:async l=>(await e(),t().getDeployment(l)),set:async(l,p)=>(await e(),t().updateDeploymentLabels(l,p.labels)),remove:async l=>{await e(),await t().removeDeployment(l)}}}function Se(n){let{getApi:t,ensureInit:e}=n;return{set:async(i,o={})=>(await e(),t().setDomain(i,o.deployment,o.labels)),list:async()=>(await e(),t().listDomains()),get:async i=>(await e(),t().getDomain(i)),remove:async i=>{await e(),await t().removeDomain(i)},verify:async i=>(await e(),t().verifyDomain(i)),validate:async i=>(await e(),t().validateDomain(i)),dns:async i=>(await e(),t().getDomainDns(i)),records:async i=>(await e(),t().getDomainRecords(i)),share:async i=>(await e(),t().getDomainShare(i))}}function Ee(n){let{getApi:t,ensureInit:e}=n;return{get:async()=>(await e(),t().getAccount())}}function Ae(n){let{getApi:t,ensureInit:e}=n;return{create:async(i={})=>(await e(),t().createToken(i.ttl,i.labels)),list:async()=>(await e(),t().listTokens()),remove:async i=>{await e(),await t().removeToken(i)}}}var H=class{constructor(t={}){this.initPromise=null;this._config=null;this.auth=null;this.customHeaders={};this.clientOptions=t,t.deployToken?this.auth={type:"token",value:t.deployToken}:t.apiKey&&(this.auth={type:"apiKey",value:t.apiKey}),this.authHeadersCallback=()=>this.getAuthHeaders();let e=this.resolveInitialConfig(t);this.http=new P({...t,...e,getAuthHeaders:this.authHeadersCallback,createDeployBody:this.getDeployBodyCreator()});let i={getApi:()=>this.http,ensureInit:()=>this.ensureInitialized()};this._deployments=De({...i,processInput:(o,s)=>this.processInput(o,s),clientDefaults:this.clientOptions,hasAuth:()=>this.hasAuth()}),this._domains=Se(i),this._account=Ee(i),this._tokens=Ae(i)}async ensureInitialized(){return this.initPromise||(this.initPromise=this.loadFullConfig()),this.initPromise}async ping(){return await this.ensureInitialized(),this.http.ping()}async deploy(t,e){return this.deployments.upload(t,e)}async whoami(){return this.account.get()}get deployments(){return this._deployments}get domains(){return this._domains}get account(){return this._account}get tokens(){return this._tokens}async getConfig(){return this._config?this._config:(await this.ensureInitialized(),this._config=O(),this._config)}on(t,e){this.http.on(t,e)}off(t,e){this.http.off(t,e)}setHeaders(t){this.customHeaders=t,this.http.setGlobalHeaders(t)}clearHeaders(){this.customHeaders={},this.http.setGlobalHeaders({})}replaceHttpClient(t){if(this.http?.transferEventsTo)try{this.http.transferEventsTo(t)}catch(e){console.warn("Event transfer failed during client replacement:",e)}this.http=t,Object.keys(this.customHeaders).length>0&&this.http.setGlobalHeaders(this.customHeaders)}setDeployToken(t){if(!t||typeof t!="string")throw a.business("Invalid deploy token provided. Deploy token must be a non-empty string.");this.auth={type:"token",value:t}}setApiKey(t){if(!t||typeof t!="string")throw a.business("Invalid API key provided. API key must be a non-empty string.");this.auth={type:"apiKey",value:t}}getAuthHeaders(){return this.auth?{Authorization:`Bearer ${this.auth.value}`}:{}}hasAuth(){return this.clientOptions.useCredentials?!0:this.auth!==null}};S();k();S();k();import{z as $}from"zod";var ee="ship",ze=$.object({apiUrl:$.string().url().optional(),apiKey:$.string().optional(),deployToken:$.string().optional()}).strict();function Ce(n){try{return ze.parse(n)}catch(t){if(t instanceof $.ZodError){let e=t.issues[0],i=e.path.length>0?` at ${e.path.join(".")}`:"";throw a.config(`Configuration validation failed${i}: ${e.message}`)}throw a.config("Configuration validation failed")}}async function He(n){try{if(R()!=="node")return{};let{cosmiconfigSync:t}=await import("cosmiconfig"),e=await import("os"),i=t(ee,{searchPlaces:[`.${ee}rc`,"package.json",`${e.homedir()}/.${ee}rc`],stopDir:e.homedir()}),o;if(n?o=i.load(n):o=i.search(),o&&o.config)return Ce(o.config)}catch(t){if(w(t))throw t}return{}}async function te(n){if(R()!=="node")return{};let t={apiUrl:process.env.SHIP_API_URL,apiKey:process.env.SHIP_API_KEY,deployToken:process.env.SHIP_DEPLOY_TOKEN},e=await He(n),i={apiUrl:t.apiUrl??e.apiUrl,apiKey:t.apiKey??e.apiKey,deployToken:t.deployToken??e.deployToken};return Ce(i)}N();S();async function ve(n,t,e,i){let{FormData:o,File:s}=await import("formdata-node"),{FormDataEncoder:l}=await import("form-data-encoder"),p=new o,r=[];for(let D of n){if(!Buffer.isBuffer(D.content)&&!(typeof Blob<"u"&&D.content instanceof Blob))throw a.file(`Unsupported file.content type for Node.js: ${D.path}`,D.path);if(!D.md5)throw a.file(`File missing md5 checksum: ${D.path}`,D.path);let L=new s([D.content],D.path,{type:"application/octet-stream"});p.append("files[]",L),r.push(D.md5)}p.append("checksums",JSON.stringify(r)),t&&t.length>0&&p.append("labels",JSON.stringify(t)),e&&p.append("via",e),i?.build&&p.append("build","true"),i?.prerender&&p.append("prerender","true");let c=new l(p),u=[];for await(let D of c.encode())u.push(Buffer.from(D));let y=Buffer.concat(u);return{body:y.buffer.slice(y.byteOffset,y.byteOffset+y.byteLength),headers:{"Content-Type":c.contentType,"Content-Length":Buffer.byteLength(y).toString()}}}z();function Vt(n,t,e,i=!0){let o=n===1?t:e;return i?`${n} ${o}`:o}ne();se();k();le();pe();S();N();ce();var ue=class extends H{constructor(t={}){if(R()!=="node")throw a.business("Node.js Ship class can only be used in Node.js environment.");super(t)}resolveInitialConfig(t){return Q(t,{})}async loadFullConfig(){try{let t=await te(this.clientOptions.configFile),e=Q(this.clientOptions,t);e.deployToken&&!this.clientOptions.deployToken?this.setDeployToken(e.deployToken):e.apiKey&&!this.clientOptions.apiKey&&this.setApiKey(e.apiKey);let i=new P({...this.clientOptions,...e,getAuthHeaders:this.authHeadersCallback,createDeployBody:this.getDeployBodyCreator()});this.replaceHttpClient(i);let o=await this.http.getConfig();X(o)}catch(t){throw this.initPromise=null,t}}async processInput(t,e){let i=typeof t=="string"?[t]:t;if(!Array.isArray(i)||!i.every(s=>typeof s=="string"))throw a.business("Invalid input type for Node.js environment. Expected string or string[].");if(i.length===0)throw a.business("No files to deploy.");let{processFilesForNode:o}=await Promise.resolve().then(()=>(ce(),ke));return o(i,e)}getDeployBodyCreator(){return ve}},Ye=ue;export{G as API_KEY_HEX_LENGTH,Ze as API_KEY_HINT_LENGTH,b as API_KEY_PREFIX,de as API_KEY_TOTAL_LENGTH,Qe as AccountPlan,P as ApiHttp,et as AuthMethod,$e as BLOCKED_EXTENSIONS,B as DEFAULT_API,W as DEPLOYMENT_CONFIG_FILENAME,q as DEPLOY_TOKEN_HEX_LENGTH,I as DEPLOY_TOKEN_PREFIX,fe as DEPLOY_TOKEN_TOTAL_LENGTH,Je as DeploymentStatus,Xe as DomainStatus,f as ErrorType,g as FILE_VALIDATION_STATUS,g as FileValidationStatus,Ve as JUNK_DIRECTORIES,pt as LABEL_CONSTRAINTS,ct as LABEL_PATTERN,ue as Ship,a as ShipError,Y as UNBUILT_PROJECT_MARKERS,Le as UNSAFE_FILENAME_CHARS,Ct as __setTestEnvironment,tn as allValidFilesReady,K as calculateMD5,Ee as createAccountResource,De as createDeploymentResource,Se as createDomainResource,Ae as createTokenResource,Ye as default,dt as deserializeLabels,rt as extractSubdomain,Te as filterJunk,re as formatFileSize,at as generateDeploymentUrl,lt as generateDomainUrl,O as getCurrentConfig,R as getENV,qe as getValidFiles,_ as hasUnbuiltMarker,me as hasUnsafeChars,U as isBlockedExtension,st as isCustomDomain,ot as isDeployment,he as isPlatformDomain,w as isShipError,te as loadConfig,ye as mergeDeployOptions,we as optimizeDeployPaths,Vt as pluralize,Pe as processFilesForNode,Q as resolveConfig,ut as serializeLabels,X as setPlatformConfig,tt as validateApiKey,it as validateApiUrl,be as validateDeployFile,xe as validateDeployPath,nt as validateDeployToken,ae as validateFileName,en as validateFiles};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|