@shipstatic/ship 2.0.0-beta.13 → 2.0.0-beta.15
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 +9 -1
- package/dist/browser.d.ts +25 -2
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +42 -43
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.d.cts
CHANGED
|
@@ -668,7 +668,8 @@ declare class ShipError extends Error {
|
|
|
668
668
|
* Routing:
|
|
669
669
|
* - Already a `ShipError` → returned as-is (caller's intent preserved)
|
|
670
670
|
* - `AbortError` → `ShipError.cancelled(...)`
|
|
671
|
-
* -
|
|
671
|
+
* - A transport failure → `ShipError.network(...)` — see `isTransportFailure`
|
|
672
|
+
* for what each runtime offers as evidence
|
|
672
673
|
* - Any other `Error` → `ShipError(Api, ...)` (no HTTP status — fetch never reached the server)
|
|
673
674
|
* - Anything else (string, undefined, etc.) → `ShipError(Api, ...)`
|
|
674
675
|
*
|
|
@@ -775,6 +776,28 @@ declare const BLOCKED_EXTENSIONS: ReadonlySet<string>;
|
|
|
775
776
|
* isBlockedExtension('README') // false
|
|
776
777
|
*/
|
|
777
778
|
declare function isBlockedExtension(filename: string): boolean;
|
|
779
|
+
/**
|
|
780
|
+
* The `accept` attribute value for a browser file picker offering web files.
|
|
781
|
+
*
|
|
782
|
+
* **This is a hint, never a rule.** `BLOCKED_EXTENSIONS` is the platform's
|
|
783
|
+
* gate and the only thing that decides what may be hosted; this constant
|
|
784
|
+
* decides what a *file dialog* shows first. The two are not two halves of one
|
|
785
|
+
* policy, and this one must never be consulted to accept or reject a file.
|
|
786
|
+
*
|
|
787
|
+
* The distinction is structural, not stylistic. `accept` can express only an
|
|
788
|
+
* allowlist, while the platform's rule is a blocklist — so this list is
|
|
789
|
+
* necessarily *narrower* than what the platform hosts, and reading it as
|
|
790
|
+
* authority would reject files the platform serves happily. It is also not
|
|
791
|
+
* enforcement in the browser's own terms: every file dialog offers an
|
|
792
|
+
* all-files escape, and **drag-and-drop ignores `accept` entirely**. The
|
|
793
|
+
* dropzone and the picker must reach the same verdict on the same files, and
|
|
794
|
+
* they do — because the verdict is `validateFiles`, downstream of both.
|
|
795
|
+
*
|
|
796
|
+
* Kept beside `BLOCKED_EXTENSIONS` so one file holds both, which is what lets
|
|
797
|
+
* `tests/validation-constants.test.ts` fence the invariant that matters: the
|
|
798
|
+
* picker must never offer a file the platform will refuse.
|
|
799
|
+
*/
|
|
800
|
+
declare const WEB_FILE_ACCEPT: string;
|
|
778
801
|
/**
|
|
779
802
|
* Characters that are unsafe in filenames for static hosting.
|
|
780
803
|
*
|
|
@@ -2240,6 +2263,6 @@ declare class Ship extends Ship$1 {
|
|
|
2240
2263
|
}
|
|
2241
2264
|
|
|
2242
2265
|
declare namespace Ship {
|
|
2243
|
-
export { API_KEY, API_PATHS, AUTH_BASE_PATH, Account, AccountDeleteResponse, AccountGetResponse, AccountKeyResponse, AccountOverrides, AccountPlan, AccountPlanType, AccountResource, AccountUsage, Activity, ActivityEvent, ActivityListResponse, ActivityMeta, ApiDeployOptions, ApiHttp, ApiHttpOptions, AuthMethod, AuthMethodType, BLOCKED_EXTENSIONS, BillingCancelResponse, BillingStatus, CALLER, CheckoutSession, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_TOKEN, DeployBody, DeployBodyContext, DeployBodyCreator, DeployFile, DeployInput, Deployment, DeploymentCreateResponse, DeploymentDeleteResponse, DeploymentListResponse, DeploymentOptions, DeploymentResource, DeploymentResourceContext, DeploymentSetOptions, DeploymentStatus, DeploymentStatusType, DeploymentUploadOptions, DnsLookup, DnsProvider, DnsRecord, DnsRecordType, Domain, DomainDeleteResponse, DomainDnsResponse, DomainListResponse, DomainRecordsResponse, DomainResource, DomainSetOptions, DomainSetResult, DomainShareResponse, DomainStatus, DomainStatusType, DomainValidateResponse, DomainVerifyResponse, ErrorResponse, ErrorType, ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, Fetch, FileValidationResult, FileValidationStatus, FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, LabelsResponse, ListOptions, ListResponse, MD5Result, OAuthScope, OAuthScopeType, PASSWORD_CONSTRAINTS, PingResponse, PlatformLimits, ResourceContext, SPACheckDebug, SPACheckRequest, SPACheckResponse, SPA_DEFAULT_CONFIG, SetupInstructionsResponse, ShipClientOptions, ShipError, ShipEvents, StaticFile, Token, TokenCreateOptions, TokenCreateResponse, TokenDeleteResponse, TokenKind, TokenKindType, TokenListResponse, TokenProvider, TokenResource, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, UploadedFile, UserVisibleActivityEvent, ValidatableFile, ValidationIssue, __setTestEnvironment, allValidFilesReady, assertShipJsonSyntax, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, deserializeLabels, extractSubdomain, filterJunk, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, optimizeDeployPaths, pluralize, processFilesForNode, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validatePassword, validateToken };
|
|
2266
|
+
export { API_KEY, API_PATHS, AUTH_BASE_PATH, Account, AccountDeleteResponse, AccountGetResponse, AccountKeyResponse, AccountOverrides, AccountPlan, AccountPlanType, AccountResource, AccountUsage, Activity, ActivityEvent, ActivityListResponse, ActivityMeta, ApiDeployOptions, ApiHttp, ApiHttpOptions, AuthMethod, AuthMethodType, BLOCKED_EXTENSIONS, BillingCancelResponse, BillingStatus, CALLER, CheckoutSession, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_TOKEN, DeployBody, DeployBodyContext, DeployBodyCreator, DeployFile, DeployInput, Deployment, DeploymentCreateResponse, DeploymentDeleteResponse, DeploymentListResponse, DeploymentOptions, DeploymentResource, DeploymentResourceContext, DeploymentSetOptions, DeploymentStatus, DeploymentStatusType, DeploymentUploadOptions, DnsLookup, DnsProvider, DnsRecord, DnsRecordType, Domain, DomainDeleteResponse, DomainDnsResponse, DomainListResponse, DomainRecordsResponse, DomainResource, DomainSetOptions, DomainSetResult, DomainShareResponse, DomainStatus, DomainStatusType, DomainValidateResponse, DomainVerifyResponse, ErrorResponse, ErrorType, ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, Fetch, FileValidationResult, FileValidationStatus, FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, LabelsResponse, ListOptions, ListResponse, MD5Result, OAuthScope, OAuthScopeType, PASSWORD_CONSTRAINTS, PingResponse, PlatformLimits, ResourceContext, SPACheckDebug, SPACheckRequest, SPACheckResponse, SPA_DEFAULT_CONFIG, SetupInstructionsResponse, ShipClientOptions, ShipError, ShipEvents, StaticFile, Token, TokenCreateOptions, TokenCreateResponse, TokenDeleteResponse, TokenKind, TokenKindType, TokenListResponse, TokenProvider, TokenResource, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, UploadedFile, UserVisibleActivityEvent, ValidatableFile, ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, allValidFilesReady, assertShipJsonSyntax, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, deserializeLabels, extractSubdomain, filterJunk, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, optimizeDeployPaths, pluralize, processFilesForNode, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validatePassword, validateToken };
|
|
2244
2267
|
}
|
|
2245
2268
|
export = Ship;
|
package/dist/index.d.ts
CHANGED
|
@@ -668,7 +668,8 @@ declare class ShipError extends Error {
|
|
|
668
668
|
* Routing:
|
|
669
669
|
* - Already a `ShipError` → returned as-is (caller's intent preserved)
|
|
670
670
|
* - `AbortError` → `ShipError.cancelled(...)`
|
|
671
|
-
* -
|
|
671
|
+
* - A transport failure → `ShipError.network(...)` — see `isTransportFailure`
|
|
672
|
+
* for what each runtime offers as evidence
|
|
672
673
|
* - Any other `Error` → `ShipError(Api, ...)` (no HTTP status — fetch never reached the server)
|
|
673
674
|
* - Anything else (string, undefined, etc.) → `ShipError(Api, ...)`
|
|
674
675
|
*
|
|
@@ -775,6 +776,28 @@ declare const BLOCKED_EXTENSIONS: ReadonlySet<string>;
|
|
|
775
776
|
* isBlockedExtension('README') // false
|
|
776
777
|
*/
|
|
777
778
|
declare function isBlockedExtension(filename: string): boolean;
|
|
779
|
+
/**
|
|
780
|
+
* The `accept` attribute value for a browser file picker offering web files.
|
|
781
|
+
*
|
|
782
|
+
* **This is a hint, never a rule.** `BLOCKED_EXTENSIONS` is the platform's
|
|
783
|
+
* gate and the only thing that decides what may be hosted; this constant
|
|
784
|
+
* decides what a *file dialog* shows first. The two are not two halves of one
|
|
785
|
+
* policy, and this one must never be consulted to accept or reject a file.
|
|
786
|
+
*
|
|
787
|
+
* The distinction is structural, not stylistic. `accept` can express only an
|
|
788
|
+
* allowlist, while the platform's rule is a blocklist — so this list is
|
|
789
|
+
* necessarily *narrower* than what the platform hosts, and reading it as
|
|
790
|
+
* authority would reject files the platform serves happily. It is also not
|
|
791
|
+
* enforcement in the browser's own terms: every file dialog offers an
|
|
792
|
+
* all-files escape, and **drag-and-drop ignores `accept` entirely**. The
|
|
793
|
+
* dropzone and the picker must reach the same verdict on the same files, and
|
|
794
|
+
* they do — because the verdict is `validateFiles`, downstream of both.
|
|
795
|
+
*
|
|
796
|
+
* Kept beside `BLOCKED_EXTENSIONS` so one file holds both, which is what lets
|
|
797
|
+
* `tests/validation-constants.test.ts` fence the invariant that matters: the
|
|
798
|
+
* picker must never offer a file the platform will refuse.
|
|
799
|
+
*/
|
|
800
|
+
declare const WEB_FILE_ACCEPT: string;
|
|
778
801
|
/**
|
|
779
802
|
* Characters that are unsafe in filenames for static hosting.
|
|
780
803
|
*
|
|
@@ -2239,4 +2262,4 @@ declare class Ship extends Ship$1 {
|
|
|
2239
2262
|
protected getDeployBodyCreator(): DeployBodyCreator;
|
|
2240
2263
|
}
|
|
2241
2264
|
|
|
2242
|
-
export { API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountDeleteResponse, type AccountGetResponse, type AccountKeyResponse, type AccountOverrides, AccountPlan, type AccountPlanType, type AccountResource, type AccountUsage, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BLOCKED_EXTENSIONS, type BillingCancelResponse, type BillingStatus, CALLER, type CheckoutSession, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_TOKEN, type DeployBody, type DeployBodyContext, type DeployBodyCreator, type DeployFile, type DeployInput, type Deployment, type DeploymentCreateResponse, type DeploymentDeleteResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, type DeploymentSetOptions, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, type DnsLookup, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDeleteResponse, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetOptions, type DomainSetResult, type DomainShareResponse, DomainStatus, type DomainStatusType, type DomainValidateResponse, type DomainVerifyResponse, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type LabelsResponse, type ListOptions, type ListResponse, type MD5Result, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, type PingResponse, type PlatformLimits, type ResourceContext, type SPACheckDebug, type SPACheckRequest, type SPACheckResponse, SPA_DEFAULT_CONFIG, type SetupInstructionsResponse, Ship, type ShipClientOptions, ShipError, type ShipEvents, type StaticFile, type Token, type TokenCreateOptions, type TokenCreateResponse, type TokenDeleteResponse, TokenKind, type TokenKindType, type TokenListResponse, type TokenProvider, type TokenResource, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, __setTestEnvironment, allValidFilesReady, assertShipJsonSyntax, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, extractSubdomain, filterJunk, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, optimizeDeployPaths, pluralize, processFilesForNode, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validatePassword, validateToken };
|
|
2265
|
+
export { API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountDeleteResponse, type AccountGetResponse, type AccountKeyResponse, type AccountOverrides, AccountPlan, type AccountPlanType, type AccountResource, type AccountUsage, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BLOCKED_EXTENSIONS, type BillingCancelResponse, type BillingStatus, CALLER, type CheckoutSession, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_TOKEN, type DeployBody, type DeployBodyContext, type DeployBodyCreator, type DeployFile, type DeployInput, type Deployment, type DeploymentCreateResponse, type DeploymentDeleteResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, type DeploymentSetOptions, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, type DnsLookup, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDeleteResponse, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetOptions, type DomainSetResult, type DomainShareResponse, DomainStatus, type DomainStatusType, type DomainValidateResponse, type DomainVerifyResponse, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type LabelsResponse, type ListOptions, type ListResponse, type MD5Result, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, type PingResponse, type PlatformLimits, type ResourceContext, type SPACheckDebug, type SPACheckRequest, type SPACheckResponse, SPA_DEFAULT_CONFIG, type SetupInstructionsResponse, Ship, type ShipClientOptions, ShipError, type ShipEvents, type StaticFile, type Token, type TokenCreateOptions, type TokenCreateResponse, type TokenDeleteResponse, TokenKind, type TokenKindType, type TokenListResponse, type TokenProvider, type TokenResource, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, allValidFilesReady, assertShipJsonSyntax, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, extractSubdomain, filterJunk, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, optimizeDeployPaths, pluralize, processFilesForNode, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validatePassword, validateToken };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var He=Object.defineProperty;var R=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ge=(n,t)=>{for(var e in t)He(n,e,{get:t[e],enumerable:!0})};function ce(n){if(n==null)return;if(typeof n!="string")throw a.validation("Idempotency key must be a string.");let t=n.trim();if(!t)throw a.validation("Idempotency key must not be empty.");if(t.length>le.MAX_LENGTH)throw a.validation(`Idempotency key must be at most ${le.MAX_LENGTH} characters.`);return t}function v(n){return n!==null&&typeof n=="object"&&"name"in n&&n.name==="ShipError"&&"status"in n}function $(n){let t=n.lastIndexOf(".");if(t===-1||t===n.length-1)return!1;let e=n.slice(t+1).toLowerCase();return je.has(e)}function ue(n){return qe.test(n)}function k(n){return n.replace(/\\/g,"/").split("/").filter(Boolean).some(e=>j.has(e))}function Ye(n){return n.startsWith(de.PREFIX)?L.API_KEY:n.startsWith(me.PREFIX)?L.DEPLOY_TOKEN:L.OPAQUE}function he(n){let t=n.charCodeAt(0)===65279?n.slice(1):n,e;try{e=JSON.parse(t)}catch(i){throw a.config(`invalid JSON format in config: ${i.message}`,{filePath:I})}if(e===null||typeof e!="object"||Array.isArray(e))throw a.config(`${I} must contain a JSON object`,{filePath:I})}function ye(n,t,e){if(!n.startsWith(t.PREFIX))throw a.validation(`${e} must start with "${t.PREFIX}"`);if(n.length!==t.TOTAL_LENGTH)throw a.validation(`${e} must be ${t.TOTAL_LENGTH} characters total (${t.PREFIX} + ${t.HEX_LENGTH} hex chars)`);let i=n.slice(t.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${t.HEX_LENGTH}}$`,"i").test(i))throw a.validation(`${e} must contain ${t.HEX_LENGTH} hexadecimal characters after "${t.PREFIX}" prefix`)}function Xe(n){ye(n,de,"API key")}function We(n){ye(n,me,"Deploy token")}function q(n){switch(Ye(n)){case L.API_KEY:Xe(n);return;case L.DEPLOY_TOKEN:We(n);return;case L.OPAQUE:if(!n)throw a.validation("Token must be a non-empty string")}}function ge(n){if(!n||n.length>K.MAX_LENGTH||!K.PATTERN.test(n))throw a.validation(`Caller must be 1-${K.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function Dt(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 v(t)?t:a.validation("API URL must be a valid URL")}}function Tt(n){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(n)}function Ee(n,t){return n.endsWith(`.${t}`)}function At(n,t){return!Ee(n,t)}function St(n,t){return Ee(n,t)?n.slice(0,-(t.length+1)):null}function Rt(n){return`https://${n}`}function It(n){return`https://${n}`}function Pt(n){return!n||n.length===0?null:JSON.stringify(n)}function wt(n){if(!n)return[];try{let t=JSON.parse(n);return Array.isArray(t)?t:[]}catch{return[]}}function X(n){if(n==null)return;if(typeof n!="string")throw a.validation("Password must be a string");let t=n.trim();if(t.length<_.MIN_LENGTH||t.length>_.MAX_LENGTH)throw a.validation(`Password must be between ${_.MIN_LENGTH} and ${_.MAX_LENGTH} characters`);return t}var ft,f,ht,le,yt,m,ze,V,Ve,Ke,a,je,qe,j,gt,pe,de,me,K,L,Et,I,fe,Y,y,w,De,_,g=R(()=>{"use strict";ft={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},f={DEPLOYMENTS:"/deployments",DEPLOYMENT:n=>`/deployments/${n}`,DEPLOYMENT_CONFIG:n=>`/deployments/${n}/config`,DOMAINS:"/domains",DOMAIN:n=>`/domains/${n}`,DOMAIN_VERIFY:n=>`/domains/${n}/verify`,DOMAIN_DNS:n=>`/domains/${n}/dns`,DOMAIN_RECORDS:n=>`/domains/${n}/records`,DOMAIN_SHARE:n=>`/domains/${n}/share`,DOMAIN_PROPAGATION:n=>`/domains/${n}/propagation`,DOMAINS_VALIDATE:"/domains/validate",TOKENS:"/tokens",TOKEN:n=>`/tokens/${n}`,ACCOUNT:"/account",ACCOUNT_KEY:"/account/key",ACCOUNT_CLAIM:"/account/claim",ACTIVITIES:"/activities",LABELS:"/labels",LIMITS:"/limits",PING:"/ping",SETUP:"/setup",SPA_CHECK:"/spa-check",UPLOAD:"/upload"},ht={PENDING:"pending",PARTIAL:"partial",SUCCESS:"success",PAUSED:"paused"},le={MAX_LENGTH:256,WINDOW_SECONDS:1440*60};yt={FREE:"free",STANDARD:"standard",SPONSORED:"sponsored",ENTERPRISE:"enterprise",SUSPENDED:"suspended",TERMINATING:"terminating",TERMINATED:"terminated"},m={Validation:"validation_failed",NotFound:"not_found",Forbidden:"forbidden",RateLimit:"rate_limit_exceeded",Authentication:"authentication_failed",Business:"business_logic_error",Api:"internal_server_error",Network:"network_error",Cancelled:"operation_cancelled",File:"file_error",Config:"config_error"},ze=new Set([m.Network,m.Cancelled,m.File,m.Config]),V={client:new Set([m.Business,m.Cancelled,m.Config,m.File,m.Forbidden,m.NotFound,m.RateLimit,m.Validation]),network:new Set([m.Network]),auth:new Set([m.Authentication])},Ve=new Set(Object.values(m).filter(n=>!ze.has(n))),Ke=200,a=class n extends Error{type;status;details;constructor(t,e,i,r){super(e),this.type=t,this.status=i,this.details=r,this.name="ShipError"}toResponse(){let t=this.details,e=this.type===m.Authentication&&t?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:e}}static async fromHttpResponse(t,e){let i,r,s;try{if(t.headers.get("content-type")?.includes("application/json")){let c=await t.json();if(c&&typeof c=="object"){let p=c;typeof p.message=="string"?i=p.message:typeof p.error=="string"&&(i=p.error),r=p.details,typeof p.error=="string"&&Ve.has(p.error)&&(s=p.error)}}else{let c=(await t.text()).trim();c&&!c.startsWith("<")&&c.length<=Ke&&(i=c)}}catch{}let l=t.headers.get("retry-after");if(l!==null){let o=l.trim(),c=/^\d+$/.test(o)?Number(o):Math.ceil((Date.parse(o)-Date.now())/1e3);if(Number.isFinite(c)&&c>=0){let p=r&&typeof r=="object"?r:{};p.retryAfter===void 0&&(r={...p,retryAfter:c})}}i=i||`${e||"Request"} failed with status ${t.status}`;let d=s??(t.status===401?m.Authentication:t.status===403?m.Forbidden:t.status===429?m.RateLimit:m.Api);return new n(d,i,t.status,r)}static fromFetchError(t,e){if(v(t))return t;let i=e||"Request";return t instanceof Error?t.name==="AbortError"?n.cancelled(`${i} was cancelled`):t instanceof TypeError&&t.message.includes("fetch")?n.network(`${i} failed: ${t.message}`,{cause:t}):new n(m.Api,`${i} failed: ${t.message}`):new n(m.Api,`${i} failed: Unknown error`)}static validation(t,e){return new n(m.Validation,t,400,e)}static notFound(t,e){let i=e?`${t} ${e} not found`:`${t} not found`;return new n(m.NotFound,i,404)}static forbidden(t,e){return new n(m.Forbidden,t,403,e)}static rateLimit(t="Too many requests",e){return new n(m.RateLimit,t,429,e)}static authentication(t="Authentication required",e){return new n(m.Authentication,t,401,e)}static business(t,e=400,i){return new n(m.Business,t,e,i)}static network(t,e){return new n(m.Network,t,void 0,e)}static cancelled(t,e){return new n(m.Cancelled,t,void 0,e)}static file(t,e){return new n(m.File,t,void 0,e)}static config(t,e){return new n(m.Config,t,void 0,e)}static api(t,e=500,i){return new n(m.Api,t,e,i)}isClientError(){return V.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return V.network.has(this.type)}isAuthError(){return V.auth.has(this.type)}isType(t){return this.type===t}};je=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"]);qe=/[\x00-\x1f\x7f#?%\\<>"]/;j=new Set(["node_modules","package.json"]);gt="/auth",pe={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",WEBHOOK:"webhook",SYSTEM:"system"},de={PREFIX:"ship-",HEX_LENGTH:64,TOTAL_LENGTH:69,HINT_LENGTH:4},me={PREFIX:"deploy-",HEX_LENGTH:64,TOTAL_LENGTH:71},K={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},L={API_KEY:pe.API_KEY,DEPLOY_TOKEN:pe.TOKEN,OPAQUE:"opaque"};Et={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},I="ship.json",fe={rewrites:[{source:"/(.*)",destination:"/index.html"}]};Y="https://api.shipstatic.com",y={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};w={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},De=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;_={MIN_LENGTH:6,MAX_LENGTH:128}});async function tt(n){let t=(await import("spark-md5")).default,e=new t.ArrayBuffer,i=2097152;for(let r=0;r<n.size;r+=i){let s=Math.min(r+i,n.size);e.append(await n.slice(r,s).arrayBuffer())}return{md5:e.end()}}async function nt(n){let{createHash:t}=await import("crypto"),e=t("md5");return e.update(n),{md5:e.digest("hex")}}async function it(n){let{createHash:t}=await import("crypto"),{createReadStream:e}=await import("fs");return new Promise((i,r)=>{let s=t("md5"),l=e(n);l.on("error",d=>r(a.file(`Failed to read file for MD5: ${d.message}`,{filePath:n}))),l.on("data",d=>s.update(d)),l.on("end",()=>i({md5:s.digest("hex")}))})}async function B(n){if(n instanceof Blob)return tt(n);if(typeof Buffer<"u"&&Buffer.isBuffer(n))return nt(n);if(typeof n=="string")return it(n);throw a.business("Invalid input for MD5 calculation")}var H=R(()=>{"use strict";g()});function Yt(n){J=n}function st(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function b(){return J||st()}var J,F=R(()=>{"use strict";J=null});function ve(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=[],r=Math.min(...e.map(s=>s.length));for(let s=0;s<r;s++){let l=e[0][s];if(e.every(d=>d[s]===l))i.push(l);else break}return i.join("/")}function z(n){return n.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var Q=R(()=>{"use strict"});function Ce(n,t={}){if(t.flatten===!1)return n.map(i=>({path:z(i),name:Z(i)}));let e=lt(n);return n.map(i=>{let r=z(i);if(e){let s=e.endsWith("/")?e:`${e}/`;r.startsWith(s)&&(r=r.substring(s.length))}return r||(r=Z(i)),{path:r,name:Z(i)}})}function lt(n){if(!n.length)return"";let e=n.map(s=>z(s)).map(s=>s.split("/")),i=[],r=Math.min(...e.map(s=>s.length));for(let s=0;s<r-1;s++){let l=e[0][s];if(e.every(d=>d[s]===l))i.push(l);else break}return i.join("/")}function Z(n){return n.split(/[/\\]/).pop()||n}var ee=R(()=>{"use strict";Q()});function te(n,t=1){if(n===0)return"0 Bytes";let e=1024,i=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(n)/Math.log(e));return`${parseFloat((n/e**r).toFixed(t))} ${i[r]}`}function ne(n){if(ue(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 dn(n,t){let e=[],i=[],r=[];if(n.length===0){let o={file:"(no files)",message:"At least one file must be provided"};return e.push(o),{files:[],validFiles:[],errors:e,warnings:[],canDeploy:!1}}for(let o of n)if(k(o.name))return e.push({file:o.name,message:"Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder"}),{files:n.map(c=>({...c,status:y.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:e,warnings:[],canDeploy:!1};if(n.length>t.maxFilesCount){let o={file:`(${n.length} files)`,message:`File count (${n.length}) exceeds limit of ${t.maxFilesCount}`};return e.push(o),{files:n.map(c=>({...c,status:y.VALIDATION_FAILED,statusMessage:o.message})),validFiles:[],errors:e,warnings:[],canDeploy:!1}}let s=0;for(let o of n){let c=y.READY,p="Ready for upload",S=o.name?ne(o.name):{valid:!1,reason:"File name cannot be empty"};if(o.status===y.PROCESSING_ERROR)c=y.VALIDATION_FAILED,p=o.statusMessage||"File failed during processing",e.push({file:o.name,message:p});else if(o.size===0){c=y.EXCLUDED,p="File is empty (0 bytes) and cannot be deployed due to storage limitations",i.push({file:o.name,message:p}),r.push({...o,status:c,statusMessage:p});continue}else o.size<0?(c=y.VALIDATION_FAILED,p="File size must be positive",e.push({file:o.name,message:p})):!o.name||o.name.trim().length===0?(c=y.VALIDATION_FAILED,p="File name cannot be empty",e.push({file:o.name||"(empty)",message:p})):o.name.includes("\0")?(c=y.VALIDATION_FAILED,p="File name contains invalid characters (null byte)",e.push({file:o.name,message:p})):S.valid?$(o.name)?(c=y.VALIDATION_FAILED,p=`File extension not allowed: "${o.name}"`,e.push({file:o.name,message:p})):o.size>t.maxFileSize?(c=y.VALIDATION_FAILED,p=`File size (${te(o.size)}) exceeds limit of ${te(t.maxFileSize)}`,e.push({file:o.name,message:p})):(s+=o.size,s>t.maxTotalSize&&(c=y.VALIDATION_FAILED,p=`Total size would exceed limit of ${te(t.maxTotalSize)}`,e.push({file:o.name,message:p}))):(c=y.VALIDATION_FAILED,p=S.reason||"Invalid file name",e.push({file:o.name,message:p}));r.push({...o,status:c,statusMessage:p})}e.length>0&&(r=r.map(o=>o.status===y.EXCLUDED?o:{...o,status:y.VALIDATION_FAILED,statusMessage:o.status===y.VALIDATION_FAILED?o.statusMessage:"Deployment failed due to validation errors in bundle"}));let l=e.length===0?r.filter(o=>o.status===y.READY):[],d=e.length===0;return{files:r,validFiles:l,errors:e,warnings:i,canDeploy:d}}function pt(n){return n.filter(t=>t.status===y.READY)}function mn(n){return pt(n).length>0}var ie=R(()=>{"use strict";g()});import{isJunk as ct}from"junk";function Fe(n,t){if(!n||n.length===0)return[];if(!t?.allowUnbuilt&&n.find(i=>i&&k(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 r=i[i.length-1];if(ct(r))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(ut.some(d=>l.toLowerCase()===d.toLowerCase()))return!1;return!0})}var ut,re=R(()=>{"use strict";g();ut=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function _e(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 $e(n,t){let e=ne(n);if(!e.valid)throw a.business(e.reason||"Invalid file name");if($(n))throw a.business(`File extension not allowed: "${t}"`)}var se=R(()=>{"use strict";g();ie()});var Me={};Ge(Me,{processFilesForNode:()=>Ue});import*as E from"fs";import*as D from"path";function ke(n,t=new Set){let e=[],i=E.realpathSync(n);if(t.has(i))return e;t.add(i);let r=E.readdirSync(n);for(let s of r){let l=D.join(n,s),d=E.statSync(l);if(d.isDirectory()){let o=ke(l,t);e.push(...o)}else d.isFile()&&e.push(l)}return e}async function Ue(n,t={},e){if(b()!=="node")throw a.business("processFilesForNode can only be called in Node.js environment.");for(let u of n){let h=D.resolve(u);try{if(E.statSync(h).isDirectory()){let T=E.readdirSync(h).find(A=>j.has(A));if(T)throw a.business(`"${T}" detected \u2014 deploy your build output (dist/, build/, out/), not the project folder`)}}catch(T){if(v(T))throw T}}let i=n.flatMap(u=>{let h=D.resolve(u);try{return E.statSync(h).isDirectory()?ke(h):[h]}catch{throw a.file(`Path does not exist: ${u}`,{filePath:u})}}),r=[...new Set(i)],s=n.map(u=>D.resolve(u)),l=ve(s.map(u=>{try{return E.statSync(u).isDirectory()?u:D.dirname(u)}catch{return D.dirname(u)}})),d=r.map(u=>{if(l&&l.length>0){let h=D.relative(l,u);if(h&&typeof h=="string"&&!h.startsWith(".."))return h.replace(/\\/g,"/")}return D.basename(u)}),c=Ce(d,{flatten:t.pathDetect!==!1}).map(u=>u.path),p=new Set(Fe(c));if(p.size===0)return[];let S=[],x=[];for(let u=0;u<r.length;u++)p.has(c[u])&&(S.push(r[u]),x.push(c[u]));let N=[],P=0;if(!e)throw a.config("Platform limits not provided. processFilesForNode requires the limits argument \u2014 pass `ship.getLimits()` result.");for(let u=0;u<S.length;u++){let h=S[u],T=x[u];try{_e(T,h);let A=E.statSync(h);if(A.size===0)continue;if($e(T,h),A.size>e.maxFileSize)throw a.business(`File ${h} is too large. Maximum allowed size is ${e.maxFileSize/(1024*1024)}MB.`);if(P+=A.size,P>e.maxTotalSize)throw a.business(`Total deploy size is too large. Maximum allowed is ${e.maxTotalSize/(1024*1024)}MB.`);let O=E.readFileSync(h),{md5:Be}=await B(O);N.push({path:T,content:O,size:O.length,md5:Be})}catch(A){if(v(A))throw A;let O=A instanceof Error?A.message:String(A);throw a.file(`Failed to read file "${h}": ${O}`,{filePath:h})}}if(N.length>e.maxFilesCount)throw a.business(`Too many files to deploy. Maximum allowed is ${e.maxFilesCount} files.`);return N}var oe=R(()=>{"use strict";g();ee();F();re();H();Q();se()});g();g();g();var U=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 r=Array.from(i);for(let s of r)try{s(...e)}catch(l){i.delete(s),t!=="error"&&setTimeout(()=>{let d=l instanceof Error?l:new Error(String(l));this.emit("error",d,String(t))},0)}}};g();g();function C(n){if(n==null)return;if(n.length===0)return n;if(n.length>w.MAX_COUNT)throw a.validation(`Maximum ${w.MAX_COUNT} labels allowed`);let t=n.map((i,r)=>{if(typeof i!="string")throw a.validation(`Label at index ${r} must be a string`);let s=i.trim().toLowerCase();if(s.length<w.MIN_LENGTH)throw a.validation(`Labels must be at least ${w.MIN_LENGTH} characters long`);if(s.length>w.MAX_LENGTH)throw a.validation(`Labels must be no more than ${w.MAX_LENGTH} characters long`);if(!De.test(s))throw a.validation(`Labels must start and end with alphanumeric characters, with optional separators (${w.SEPARATORS}) between segments`);return s}),e=[...new Set(t)];if(e.length!==t.length)throw a.validation("Duplicate labels are not allowed");return e}async function Te(n){let t=n.find(r=>r.path===I||r.path===`/${I}`);if(!t)return;let e=t.content,i=typeof e.text=="function"?await e.text():t.content.toString("utf8");he(i)}var Je=3e4,Ae=3e5,Qe=3e5,Ze=Ae+Qe,et="sdk";function W(n){let t=new URLSearchParams;n?.limit!==void 0&&t.set("limit",String(n.limit)),n?.cursor!==void 0&&t.set("cursor",n.cursor);let e=t.toString();return e?`?${e}`:""}var M=class extends U{constructor(e){super();this.globalHeaders={};this.apiUrl=e.apiUrl||Y,this.getAuthHeadersCallback=e.getAuthHeaders,this.session=e.session??!1,this.caller=e.caller,this.timeout=e.timeout??Je,this.deployTimeout=e.timeout??Ae,this.deployBuildTimeout=e.timeout??Ze,this.fetch=e.fetch??globalThis.fetch.bind(globalThis),this.createDeployBody=e.createDeployBody,this.deployEndpoint=e.deployEndpoint||f.DEPLOYMENTS}setGlobalHeaders(e){this.globalHeaders=e}async executeRequest(e,i,r,s=this.timeout){let l=()=>{};try{let d=await this.mergeHeaders(i.headers),o=this.createTimeoutSignal(i.signal,s);l=o.cleanup;let c={...i,headers:d,credentials:this.session&&!d.Authorization?"include":void 0,signal:o.signal};this.emit("request",e,c);let p=await this.fetch(e,c);if(l(),!p.ok)throw await a.fromHttpResponse(p,r);return this.emit("response",this.safeClone(p),e),{data:await this.parseResponse(this.safeClone(p)),status:p.status}}catch(d){l();let o=a.fromFetchError(d,r);throw this.emit("error",o,e),o}}async request(e,i,r,s){let{data:l}=await this.executeRequest(e,i,r,s);return l}async requestWithStatus(e,i,r){return this.executeRequest(e,i,r)}async mergeHeaders(e={}){return{...this.globalHeaders,...this.caller?{"X-Caller":this.caller}:{},...await this.getAuthHeadersCallback(),...e}}createTimeoutSignal(e,i=this.timeout){let r=new AbortController,s=setTimeout(()=>r.abort(),i);if(e){let l=()=>r.abort();e.addEventListener("abort",l),e.aborted&&r.abort()}return{signal:r.signal,cleanup:()=>clearTimeout(s)}}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 deploy(e,i={}){if(!e.length)throw a.business("No files to deploy");for(let c of e)if(!c.md5)throw a.file(`MD5 checksum missing for file: ${c.path}`,{filePath:c.path});X(i.password);let r=ce(i.idempotencyKey),s=C(i.labels);await Te(e);let l=i.build||i.prerender||i.spa?{build:i.build,prerender:i.prerender,spa:i.spa}:void 0,{body:d,headers:o}=await this.createDeployBody(e,{labels:s,via:i.via??et,password:i.password,flags:l,captcha:i.captcha});return this.request(`${this.apiUrl}${this.deployEndpoint}`,{method:"POST",body:d,headers:r?{...o,"Idempotency-Key":r}:o,signal:i.signal||null},"Deploy",i.build||i.prerender?this.deployBuildTimeout:this.deployTimeout)}async listDeployments(e){return this.request(`${this.apiUrl}${f.DEPLOYMENTS}${W(e)}`,{method:"GET"},"List deployments")}async getDeployment(e){return this.request(`${this.apiUrl}${f.DEPLOYMENT(encodeURIComponent(e))}`,{method:"GET"},"Get deployment")}async updateDeploymentLabels(e,i){let r=C(i);return this.request(`${this.apiUrl}${f.DEPLOYMENT(encodeURIComponent(e))}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({labels:r})},"Update deployment labels")}async deleteDeployment(e){return this.request(`${this.apiUrl}${f.DEPLOYMENT(encodeURIComponent(e))}`,{method:"DELETE"},"Delete deployment")}async setDomain(e,i,r){let s=C(r),l={};i&&(l.deployment=i),s!==void 0&&(l.labels=s);let{data:d,status:o}=await this.requestWithStatus(`${this.apiUrl}${f.DOMAIN(encodeURIComponent(e))}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)},"Set domain");return{...d,isCreate:o===201}}async listDomains(e){return this.request(`${this.apiUrl}${f.DOMAINS}${W(e)}`,{method:"GET"},"List domains")}async getDomain(e){return this.request(`${this.apiUrl}${f.DOMAIN(encodeURIComponent(e))}`,{method:"GET"},"Get domain")}async deleteDomain(e){return this.request(`${this.apiUrl}${f.DOMAIN(encodeURIComponent(e))}`,{method:"DELETE"},"Delete domain")}async verifyDomain(e){return this.request(`${this.apiUrl}${f.DOMAIN_VERIFY(encodeURIComponent(e))}`,{method:"POST"},"Verify domain")}async getDomainDns(e){return this.request(`${this.apiUrl}${f.DOMAIN_DNS(encodeURIComponent(e))}`,{method:"GET"},"Get domain DNS")}async getDomainRecords(e){return this.request(`${this.apiUrl}${f.DOMAIN_RECORDS(encodeURIComponent(e))}`,{method:"GET"},"Get domain records")}async getDomainShare(e){return this.request(`${this.apiUrl}${f.DOMAIN_SHARE(encodeURIComponent(e))}`,{method:"GET"},"Get domain share")}async validateDomain(e){return this.request(`${this.apiUrl}${f.DOMAINS_VALIDATE}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:e})},"Validate domain")}async createToken(e,i){let r=C(i),s={};return e!==void 0&&(s.ttl=e),r!==void 0&&(s.labels=r),this.request(`${this.apiUrl}${f.TOKENS}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},"Create token")}async listTokens(e){return this.request(`${this.apiUrl}${f.TOKENS}${W(e)}`,{method:"GET"},"List tokens")}async deleteToken(e){return this.request(`${this.apiUrl}${f.TOKEN(encodeURIComponent(e))}`,{method:"DELETE"},"Delete token")}async getToken(e){return this.request(`${this.apiUrl}${f.TOKEN(encodeURIComponent(e))}`,{method:"GET"},"Get token")}async getAccount(){return this.request(`${this.apiUrl}${f.ACCOUNT}`,{method:"GET"},"Get account")}async getLimits(){return this.request(`${this.apiUrl}${f.LIMITS}`,{method:"GET"},"Get limits")}async ping(){return this.request(`${this.apiUrl}${f.PING}`,{method:"GET"},"Ping")}async checkSPA(e,i={}){let r=e.find(o=>o.path==="index.html"||o.path==="/index.html");if(!r||r.size>100*1024)return!1;let s;if(typeof Buffer<"u"&&Buffer.isBuffer(r.content))s=r.content.toString("utf-8");else if(typeof Blob<"u"&&r.content instanceof Blob)s=await r.content.text();else if(typeof File<"u"&&r.content instanceof File)s=await r.content.text();else return!1;let l={files:e.map(o=>o.path),index:s};return(await this.request(`${this.apiUrl}${f.SPA_CHECK}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)},"SPA check")).isSPA}};g();g();H();async function rt(){let n=JSON.stringify(fe,null,2),t;typeof Buffer<"u"?t=Buffer.from(n,"utf-8"):t=new Blob([n],{type:"application/json"});let{md5:e}=await B(t);return{path:I,content:t,size:n.length,md5:e}}async function Se(n,t,e){if(e.spaDetect===!1||e.spa||e.build||e.prerender||n.some(i=>i.path===I))return n;try{if(await t.checkSPA(n,e)){let r=await rt();return[...n,r]}}catch{}return n}function Re(n){let{getApi:t,ensureInit:e,processInput:i}=n;return{upload:async(r,s={})=>{if(await e(),!i)throw a.config("processInput function is not provided.");let l=t(),d=await i(r,s);return d=await Se(d,l,s),l.deploy(d,s)},list:async r=>(await e(),t().listDeployments(r)),get:async r=>(await e(),t().getDeployment(r)),set:async(r,s)=>(await e(),t().updateDeploymentLabels(r,s.labels)),delete:async r=>(await e(),t().deleteDeployment(r))}}function Ie(n){let{getApi:t,ensureInit:e}=n;return{set:async(i,r={})=>(await e(),t().setDomain(i,r.deployment,r.labels)),list:async i=>(await e(),t().listDomains(i)),get:async i=>(await e(),t().getDomain(i)),delete:async i=>(await e(),t().deleteDomain(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 Pe(n){let{getApi:t,ensureInit:e}=n;return{get:async()=>(await e(),t().getAccount())}}function we(n){let{getApi:t,ensureInit:e}=n;return{create:async(i={})=>(await e(),t().createToken(i.ttl,i.labels)),list:async i=>(await e(),t().listTokens(i)),get:async i=>(await e(),t().getToken(i)),delete:async i=>(await e(),t().deleteToken(i))}}var G=class{constructor(t={}){this.initPromise=null;this.platformLimits=null;this.credential=null;if(t={...t,apiUrl:t.apiUrl||void 0,token:t.token||void 0,caller:t.caller||void 0},this.clientOptions=t,t.caller!==void 0&&ge(t.caller),t.token&&t.session)throw a.config("Provide either `token` or `session`, not both.");typeof t.token=="string"?(q(t.token),this.credential=t.token):t.token&&(this.credential=t.token),this.http=new M({...t,getAuthHeaders:()=>this.getAuthHeaders(),createDeployBody:this.getDeployBodyCreator()});let e={getApi:()=>this.http,ensureInit:()=>this.ensureInitialized()};this.deployments=Re({...e,processInput:(i,r)=>this.processInput(i,r)}),this.domains=Ie(e),this.account=Pe(e),this.tokens=we(e)}async ensureInitialized(){return this.initPromise||(this.initPromise=this.fetchPlatformLimits()),this.initPromise}async fetchPlatformLimits(){try{this.platformLimits=await this.http.getLimits()}catch(t){throw this.initPromise=null,t}}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()}async getLimits(){return this.platformLimits?this.platformLimits:(await this.ensureInitialized(),this.platformLimits)}on(t,e){this.http.on(t,e)}off(t,e){this.http.off(t,e)}setHeaders(t){this.http.setGlobalHeaders(t)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(t){if(this.clientOptions.session)throw a.config("Provide either `token` or `session`, not both.");if(typeof t=="string"){if(!t)throw a.business("Invalid token provided. Token must be a non-empty string.");q(t),this.credential=t;return}if(typeof t!="function")throw a.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=t}async getAuthHeaders(){if(this.credential===null)return{};let t=typeof this.credential=="function"?await this.credential():this.credential;if(!t)throw a.authentication("Token provider returned no token.");if(typeof t!="string")throw a.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${t}`}}};F();g();import{z as be}from"zod";import{z as Ne}from"zod";var Le={apiUrl:Ne.string().url().optional(),token:Ne.string().min(1).optional()};F();var ot=be.object(Le).strict(),at={apiUrl:"SHIP_API_URL",token:"SHIP_TOKEN"};function xe(){if(b()!=="node")return{};let n={apiUrl:process.env.SHIP_API_URL||void 0,token:process.env.SHIP_TOKEN||void 0};try{return ot.parse(n)}catch(t){if(t instanceof be.ZodError){let e=t.issues[0],i=e.path[0],r=(i&&at[i])??"SHIP environment configuration";throw a.config(`Invalid ${r}: ${e.message}`)}throw a.config("Invalid environment configuration")}}g();async function Oe(n,t={}){let{FormData:e,File:i}=await import("formdata-node"),{FormDataEncoder:r}=await import("form-data-encoder"),{labels:s,via:l,password:d,flags:o,captcha:c}=t,p=new e,S=[];for(let u of n){if(!Buffer.isBuffer(u.content)&&!(typeof Blob<"u"&&u.content instanceof Blob))throw a.file(`Unsupported file.content type for Node.js: ${u.path}`,{filePath:u.path});if(!u.md5)throw a.file(`File missing md5 checksum: ${u.path}`,{filePath:u.path});let h=new i([u.content],u.path,{type:"application/octet-stream"});p.append("files[]",h),S.push(u.md5)}p.append("checksums",JSON.stringify(S)),s&&s.length>0&&p.append("labels",JSON.stringify(s)),l&&p.append("via",l),d&&p.append("password",d),o?.build&&p.append("build","true"),o?.prerender&&p.append("prerender","true"),o?.spa&&p.append("spa","true"),c&&p.append("captcha",c);let x=new r(p),N=[];for await(let u of x.encode())N.push(Buffer.from(u));let P=Buffer.concat(N);return{body:P.buffer.slice(P.byteOffset,P.byteOffset+P.byteLength),headers:{"Content-Type":x.contentType,"Content-Length":Buffer.byteLength(P).toString()}}}g();g();ee();F();ie();re();H();se();function An(n,t,e,i=!0){let r=n===1?t:e;return i?`${n} ${r}`:r}oe();var ae=class extends G{constructor(t={}){if(b()!=="node")throw a.business("Node.js Ship class can only be used in Node.js environment.");let e=xe();super({...t,apiUrl:t.apiUrl||e.apiUrl,token:t.token||(t.session?void 0:e.token)})}async deploy(t,e){return super.deploy(t,e)}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:r}=await Promise.resolve().then(()=>(oe(),Me));return r(i,e,this.platformLimits??void 0)}getDeployBodyCreator(){return Oe}},dt=ae;export{de as API_KEY,f as API_PATHS,gt as AUTH_BASE_PATH,yt as AccountPlan,M as ApiHttp,pe as AuthMethod,je as BLOCKED_EXTENSIONS,K as CALLER,Y as DEFAULT_API,I as DEPLOYMENT_CONFIG_FILENAME,me as DEPLOY_TOKEN,ft as DeploymentStatus,ht as DomainStatus,m as ErrorType,y as FILE_VALIDATION_STATUS,y as FileValidationStatus,le as IDEMPOTENCY_KEY_CONSTRAINTS,ut as JUNK_DIRECTORIES,w as LABEL_CONSTRAINTS,De as LABEL_PATTERN,Et as OAuthScope,_ as PASSWORD_CONSTRAINTS,fe as SPA_DEFAULT_CONFIG,ae as Ship,a as ShipError,L as TokenKind,j as UNBUILT_PROJECT_MARKERS,qe as UNSAFE_FILENAME_CHARS,Yt as __setTestEnvironment,mn as allValidFilesReady,he as assertShipJsonSyntax,B as calculateMD5,Ye as classifyToken,Pe as createAccountResource,Re as createDeploymentResource,Ie as createDomainResource,we as createTokenResource,dt as default,wt as deserializeLabels,St as extractSubdomain,Fe as filterJunk,te as formatFileSize,Rt as generateDeploymentUrl,It as generateDomainUrl,b as getENV,pt as getValidFiles,k as hasUnbuiltMarker,ue as hasUnsafeChars,$ as isBlockedExtension,At as isCustomDomain,Tt as isDeployment,Ee as isPlatformDomain,v as isShipError,Ce as optimizeDeployPaths,An as pluralize,Ue as processFilesForNode,Pt as serializeLabels,Xe as validateApiKey,Dt as validateApiUrl,ge as validateCaller,$e as validateDeployFile,_e as validateDeployPath,We as validateDeployToken,ne as validateFileName,dn as validateFiles,ce as validateIdempotencyKey,X as validatePassword,q as validateToken};
|
|
1
|
+
var He=Object.defineProperty;var R=(n,t)=>()=>(n&&(t=n(n=0)),t);var Ge=(n,t)=>{for(var e in t)He(n,e,{get:t[e],enumerable:!0})};function ce(n){if(n==null)return;if(typeof n!="string")throw a.validation("Idempotency key must be a string.");let t=n.trim();if(!t)throw a.validation("Idempotency key must not be empty.");if(t.length>le.MAX_LENGTH)throw a.validation(`Idempotency key must be at most ${le.MAX_LENGTH} characters.`);return t}function Ke(n){return typeof n.code=="string"?!0:n instanceof TypeError&&n.message.includes("fetch")}function O(n){return n!==null&&typeof n=="object"&&"name"in n&&n.name==="ShipError"&&"status"in n}function $(n){let t=n.lastIndexOf(".");if(t===-1||t===n.length-1)return!1;let e=n.slice(t+1).toLowerCase();return qe.has(e)}function ue(n){return Xe.test(n)}function k(n){return n.replace(/\\/g,"/").split("/").filter(Boolean).some(e=>K.has(e))}function We(n){return n.startsWith(de.PREFIX)?b.API_KEY:n.startsWith(me.PREFIX)?b.DEPLOY_TOKEN:b.OPAQUE}function he(n){let t=n.charCodeAt(0)===65279?n.slice(1):n,e;try{e=JSON.parse(t)}catch(i){throw a.config(`invalid JSON format in config: ${i.message}`,{filePath:I})}if(e===null||typeof e!="object"||Array.isArray(e))throw a.config(`${I} must contain a JSON object`,{filePath:I})}function ye(n,t,e){if(!n.startsWith(t.PREFIX))throw a.validation(`${e} must start with "${t.PREFIX}"`);if(n.length!==t.TOTAL_LENGTH)throw a.validation(`${e} must be ${t.TOTAL_LENGTH} characters total (${t.PREFIX} + ${t.HEX_LENGTH} hex chars)`);let i=n.slice(t.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${t.HEX_LENGTH}}$`,"i").test(i))throw a.validation(`${e} must contain ${t.HEX_LENGTH} hexadecimal characters after "${t.PREFIX}" prefix`)}function Je(n){ye(n,de,"API key")}function Qe(n){ye(n,me,"Deploy token")}function q(n){switch(We(n)){case b.API_KEY:Je(n);return;case b.DEPLOY_TOKEN:Qe(n);return;case b.OPAQUE:if(!n)throw a.validation("Token must be a non-empty string")}}function ge(n){if(!n||n.length>j.MAX_LENGTH||!j.PATTERN.test(n))throw a.validation(`Caller must be 1-${j.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function St(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 O(t)?t:a.validation("API URL must be a valid URL")}}function Rt(n){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(n)}function Ee(n,t){return n.endsWith(`.${t}`)}function It(n,t){return!Ee(n,t)}function wt(n,t){return Ee(n,t)?n.slice(0,-(t.length+1)):null}function Pt(n){return`https://${n}`}function Nt(n){return`https://${n}`}function bt(n){return!n||n.length===0?null:JSON.stringify(n)}function xt(n){if(!n)return[];try{let t=JSON.parse(n);return Array.isArray(t)?t:[]}catch{return[]}}function X(n){if(n==null)return;if(typeof n!="string")throw a.validation("Password must be a string");let t=n.trim();if(t.length<_.MIN_LENGTH||t.length>_.MAX_LENGTH)throw a.validation(`Password must be between ${_.MIN_LENGTH} and ${_.MAX_LENGTH} characters`);return t}var yt,f,gt,le,Et,m,ze,V,Ve,je,a,qe,Ye,Dt,Xe,K,Tt,pe,de,me,j,b,At,I,fe,Y,y,P,De,_,g=R(()=>{"use strict";yt={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},f={DEPLOYMENTS:"/deployments",DEPLOYMENT:n=>`/deployments/${n}`,DEPLOYMENT_CONFIG:n=>`/deployments/${n}/config`,DOMAINS:"/domains",DOMAIN:n=>`/domains/${n}`,DOMAIN_VERIFY:n=>`/domains/${n}/verify`,DOMAIN_DNS:n=>`/domains/${n}/dns`,DOMAIN_RECORDS:n=>`/domains/${n}/records`,DOMAIN_SHARE:n=>`/domains/${n}/share`,DOMAIN_PROPAGATION:n=>`/domains/${n}/propagation`,DOMAINS_VALIDATE:"/domains/validate",TOKENS:"/tokens",TOKEN:n=>`/tokens/${n}`,ACCOUNT:"/account",ACCOUNT_KEY:"/account/key",ACCOUNT_CLAIM:"/account/claim",ACTIVITIES:"/activities",LABELS:"/labels",LIMITS:"/limits",PING:"/ping",SETUP:"/setup",SPA_CHECK:"/spa-check",UPLOAD:"/upload"},gt={PENDING:"pending",PARTIAL:"partial",SUCCESS:"success",PAUSED:"paused"},le={MAX_LENGTH:256,WINDOW_SECONDS:1440*60};Et={FREE:"free",STANDARD:"standard",SPONSORED:"sponsored",ENTERPRISE:"enterprise",SUSPENDED:"suspended",TERMINATING:"terminating",TERMINATED:"terminated"},m={Validation:"validation_failed",NotFound:"not_found",Forbidden:"forbidden",RateLimit:"rate_limit_exceeded",Authentication:"authentication_failed",Business:"business_logic_error",Api:"internal_server_error",Network:"network_error",Cancelled:"operation_cancelled",File:"file_error",Config:"config_error"},ze=new Set([m.Network,m.Cancelled,m.File,m.Config]),V={client:new Set([m.Business,m.Cancelled,m.Config,m.File,m.Forbidden,m.NotFound,m.RateLimit,m.Validation]),network:new Set([m.Network]),auth:new Set([m.Authentication])},Ve=new Set(Object.values(m).filter(n=>!ze.has(n))),je=200;a=class n extends Error{type;status;details;constructor(t,e,i,s){super(e),this.type=t,this.status=i,this.details=s,this.name="ShipError"}toResponse(){let t=this.details,e=this.type===m.Authentication&&t?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:e}}static async fromHttpResponse(t,e){let i,s,r;try{if(t.headers.get("content-type")?.includes("application/json")){let c=await t.json();if(c&&typeof c=="object"){let p=c;typeof p.message=="string"?i=p.message:typeof p.error=="string"&&(i=p.error),s=p.details,typeof p.error=="string"&&Ve.has(p.error)&&(r=p.error)}}else{let c=(await t.text()).trim();c&&!c.startsWith("<")&&c.length<=je&&(i=c)}}catch{}let l=t.headers.get("retry-after");if(l!==null){let o=l.trim(),c=/^\d+$/.test(o)?Number(o):Math.ceil((Date.parse(o)-Date.now())/1e3);if(Number.isFinite(c)&&c>=0){let p=s&&typeof s=="object"?s:{};p.retryAfter===void 0&&(s={...p,retryAfter:c})}}i=i||`${e||"Request"} failed with status ${t.status}`;let d=r??(t.status===401?m.Authentication:t.status===403?m.Forbidden:t.status===429?m.RateLimit:m.Api);return new n(d,i,t.status,s)}static fromFetchError(t,e){if(O(t))return t;let i=e||"Request";return t instanceof Error?t.name==="AbortError"?n.cancelled(`${i} was cancelled`):Ke(t)?n.network(`${i} failed: ${t.message}`,{cause:t}):new n(m.Api,`${i} failed: ${t.message}`):new n(m.Api,`${i} failed: Unknown error`)}static validation(t,e){return new n(m.Validation,t,400,e)}static notFound(t,e){let i=e?`${t} ${e} not found`:`${t} not found`;return new n(m.NotFound,i,404)}static forbidden(t,e){return new n(m.Forbidden,t,403,e)}static rateLimit(t="Too many requests",e){return new n(m.RateLimit,t,429,e)}static authentication(t="Authentication required",e){return new n(m.Authentication,t,401,e)}static business(t,e=400,i){return new n(m.Business,t,e,i)}static network(t,e){return new n(m.Network,t,void 0,e)}static cancelled(t,e){return new n(m.Cancelled,t,void 0,e)}static file(t,e){return new n(m.File,t,void 0,e)}static config(t,e){return new n(m.Config,t,void 0,e)}static api(t,e=500,i){return new n(m.Api,t,e,i)}isClientError(){return V.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return V.network.has(this.type)}isAuthError(){return V.auth.has(this.type)}isType(t){return this.type===t}};qe=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"]);Ye=["html","htm","xhtml","xml","txt","md","markdown","pdf","csv","json","jsonc","webmanifest","map","toml","yaml","yml","rss","atom","css","scss","sass","less","js","mjs","cjs","jsx","ts","tsx","wasm","vue","svelte","png","jpg","jpeg","gif","webp","avif","svg","ico","bmp","tif","tiff","heic","heif","woff","woff2","ttf","otf","eot","mp3","wav","ogg","oga","opus","m4a","aac","flac","weba","mp4","webm","ogv","mov","m4v","avi","glb","gltf","usdz","vtt","srt","zip"],Dt=Ye.map(n=>`.${n}`).join(","),Xe=/[\x00-\x1f\x7f#?%\\<>"]/;K=new Set(["node_modules","package.json"]);Tt="/auth",pe={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",WEBHOOK:"webhook",SYSTEM:"system"},de={PREFIX:"ship-",HEX_LENGTH:64,TOTAL_LENGTH:69,HINT_LENGTH:4},me={PREFIX:"deploy-",HEX_LENGTH:64,TOTAL_LENGTH:71},j={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},b={API_KEY:pe.API_KEY,DEPLOY_TOKEN:pe.TOKEN,OPAQUE:"opaque"};At={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},I="ship.json",fe={rewrites:[{source:"/(.*)",destination:"/index.html"}]};Y="https://api.shipstatic.com",y={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};P={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},De=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;_={MIN_LENGTH:6,MAX_LENGTH:128}});async function it(n){let t=(await import("spark-md5")).default,e=new t.ArrayBuffer,i=2097152;for(let s=0;s<n.size;s+=i){let r=Math.min(s+i,n.size);e.append(await n.slice(s,r).arrayBuffer())}return{md5:e.end()}}async function st(n){let{createHash:t}=await import("crypto"),e=t("md5");return e.update(n),{md5:e.digest("hex")}}async function rt(n){let{createHash:t}=await import("crypto"),{createReadStream:e}=await import("fs");return new Promise((i,s)=>{let r=t("md5"),l=e(n);l.on("error",d=>s(a.file(`Failed to read file for MD5: ${d.message}`,{filePath:n}))),l.on("data",d=>r.update(d)),l.on("end",()=>i({md5:r.digest("hex")}))})}async function B(n){if(n instanceof Blob)return it(n);if(typeof Buffer<"u"&&Buffer.isBuffer(n))return st(n);if(typeof n=="string")return rt(n);throw a.business("Invalid input for MD5 calculation")}var H=R(()=>{"use strict";g()});function Jt(n){J=n}function at(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function x(){return J||at()}var J,F=R(()=>{"use strict";J=null});function Oe(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=[],s=Math.min(...e.map(r=>r.length));for(let r=0;r<s;r++){let l=e[0][r];if(e.every(d=>d[r]===l))i.push(l);else break}return i.join("/")}function z(n){return n.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var Q=R(()=>{"use strict"});function Ce(n,t={}){if(t.flatten===!1)return n.map(i=>({path:z(i),name:Z(i)}));let e=ct(n);return n.map(i=>{let s=z(i);if(e){let r=e.endsWith("/")?e:`${e}/`;s.startsWith(r)&&(s=s.substring(r.length))}return s||(s=Z(i)),{path:s,name:Z(i)}})}function ct(n){if(!n.length)return"";let e=n.map(r=>z(r)).map(r=>r.split("/")),i=[],s=Math.min(...e.map(r=>r.length));for(let r=0;r<s-1;r++){let l=e[0][r];if(e.every(d=>d[r]===l))i.push(l);else break}return i.join("/")}function Z(n){return n.split(/[/\\]/).pop()||n}var ee=R(()=>{"use strict";Q()});function te(n,t=1){if(n===0)return"0 Bytes";let e=1024,i=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(n)/Math.log(e));return`${parseFloat((n/e**s).toFixed(t))} ${i[s]}`}function ne(n){if(ue(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 hn(n,t){let e=[],i=[],s=[];if(n.length===0){let o={file:"(no files)",message:"At least one file must be provided"};return e.push(o),{files:[],validFiles:[],errors:e,warnings:[],canDeploy:!1}}for(let o of n)if(k(o.name))return e.push({file:o.name,message:"Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder"}),{files:n.map(c=>({...c,status:y.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:e,warnings:[],canDeploy:!1};if(n.length>t.maxFilesCount){let o={file:`(${n.length} files)`,message:`File count (${n.length}) exceeds limit of ${t.maxFilesCount}`};return e.push(o),{files:n.map(c=>({...c,status:y.VALIDATION_FAILED,statusMessage:o.message})),validFiles:[],errors:e,warnings:[],canDeploy:!1}}let r=0;for(let o of n){let c=y.READY,p="Ready for upload",S=o.name?ne(o.name):{valid:!1,reason:"File name cannot be empty"};if(o.status===y.PROCESSING_ERROR)c=y.VALIDATION_FAILED,p=o.statusMessage||"File failed during processing",e.push({file:o.name,message:p});else if(o.size===0){c=y.EXCLUDED,p="File is empty (0 bytes) and cannot be deployed due to storage limitations",i.push({file:o.name,message:p}),s.push({...o,status:c,statusMessage:p});continue}else o.size<0?(c=y.VALIDATION_FAILED,p="File size must be positive",e.push({file:o.name,message:p})):!o.name||o.name.trim().length===0?(c=y.VALIDATION_FAILED,p="File name cannot be empty",e.push({file:o.name||"(empty)",message:p})):o.name.includes("\0")?(c=y.VALIDATION_FAILED,p="File name contains invalid characters (null byte)",e.push({file:o.name,message:p})):S.valid?$(o.name)?(c=y.VALIDATION_FAILED,p=`File extension not allowed: "${o.name}"`,e.push({file:o.name,message:p})):o.size>t.maxFileSize?(c=y.VALIDATION_FAILED,p=`File size (${te(o.size)}) exceeds limit of ${te(t.maxFileSize)}`,e.push({file:o.name,message:p})):(r+=o.size,r>t.maxTotalSize&&(c=y.VALIDATION_FAILED,p=`Total size would exceed limit of ${te(t.maxTotalSize)}`,e.push({file:o.name,message:p}))):(c=y.VALIDATION_FAILED,p=S.reason||"Invalid file name",e.push({file:o.name,message:p}));s.push({...o,status:c,statusMessage:p})}e.length>0&&(s=s.map(o=>o.status===y.EXCLUDED?o:{...o,status:y.VALIDATION_FAILED,statusMessage:o.status===y.VALIDATION_FAILED?o.statusMessage:"Deployment failed due to validation errors in bundle"}));let l=e.length===0?s.filter(o=>o.status===y.READY):[],d=e.length===0;return{files:s,validFiles:l,errors:e,warnings:i,canDeploy:d}}function ut(n){return n.filter(t=>t.status===y.READY)}function yn(n){return ut(n).length>0}var ie=R(()=>{"use strict";g()});import{isJunk as dt}from"junk";function Fe(n,t){if(!n||n.length===0)return[];if(!t?.allowUnbuilt&&n.find(i=>i&&k(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 s=i[i.length-1];if(dt(s))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(mt.some(d=>l.toLowerCase()===d.toLowerCase()))return!1;return!0})}var mt,se=R(()=>{"use strict";g();mt=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function _e(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 $e(n,t){let e=ne(n);if(!e.valid)throw a.business(e.reason||"Invalid file name");if($(n))throw a.business(`File extension not allowed: "${t}"`)}var re=R(()=>{"use strict";g();ie()});var Me={};Ge(Me,{processFilesForNode:()=>Ue});import*as E from"fs";import*as D from"path";function ke(n,t=new Set){let e=[],i=E.realpathSync(n);if(t.has(i))return e;t.add(i);let s=E.readdirSync(n);for(let r of s){let l=D.join(n,r),d=E.statSync(l);if(d.isDirectory()){let o=ke(l,t);e.push(...o)}else d.isFile()&&e.push(l)}return e}async function Ue(n,t={},e){if(x()!=="node")throw a.business("processFilesForNode can only be called in Node.js environment.");for(let u of n){let h=D.resolve(u);try{if(E.statSync(h).isDirectory()){let T=E.readdirSync(h).find(A=>K.has(A));if(T)throw a.business(`"${T}" detected \u2014 deploy your build output (dist/, build/, out/), not the project folder`)}}catch(T){if(O(T))throw T}}let i=n.flatMap(u=>{let h=D.resolve(u);try{return E.statSync(h).isDirectory()?ke(h):[h]}catch{throw a.file(`Path does not exist: ${u}`,{filePath:u})}}),s=[...new Set(i)],r=n.map(u=>D.resolve(u)),l=Oe(r.map(u=>{try{return E.statSync(u).isDirectory()?u:D.dirname(u)}catch{return D.dirname(u)}})),d=s.map(u=>{if(l&&l.length>0){let h=D.relative(l,u);if(h&&typeof h=="string"&&!h.startsWith(".."))return h.replace(/\\/g,"/")}return D.basename(u)}),c=Ce(d,{flatten:t.pathDetect!==!1}).map(u=>u.path),p=new Set(Fe(c));if(p.size===0)return[];let S=[],L=[];for(let u=0;u<s.length;u++)p.has(c[u])&&(S.push(s[u]),L.push(c[u]));let N=[],w=0;if(!e)throw a.config("Platform limits not provided. processFilesForNode requires the limits argument \u2014 pass `ship.getLimits()` result.");for(let u=0;u<S.length;u++){let h=S[u],T=L[u];try{_e(T,h);let A=E.statSync(h);if(A.size===0)continue;if($e(T,h),A.size>e.maxFileSize)throw a.business(`File ${h} is too large. Maximum allowed size is ${e.maxFileSize/(1024*1024)}MB.`);if(w+=A.size,w>e.maxTotalSize)throw a.business(`Total deploy size is too large. Maximum allowed is ${e.maxTotalSize/(1024*1024)}MB.`);let v=E.readFileSync(h),{md5:Be}=await B(v);N.push({path:T,content:v,size:v.length,md5:Be})}catch(A){if(O(A))throw A;let v=A instanceof Error?A.message:String(A);throw a.file(`Failed to read file "${h}": ${v}`,{filePath:h})}}if(N.length>e.maxFilesCount)throw a.business(`Too many files to deploy. Maximum allowed is ${e.maxFilesCount} files.`);return N}var oe=R(()=>{"use strict";g();ee();F();se();H();Q();re()});g();g();g();var U=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 s=Array.from(i);for(let r of s)try{r(...e)}catch(l){i.delete(r),t!=="error"&&setTimeout(()=>{let d=l instanceof Error?l:new Error(String(l));this.emit("error",d,String(t))},0)}}};g();g();function C(n){if(n==null)return;if(n.length===0)return n;if(n.length>P.MAX_COUNT)throw a.validation(`Maximum ${P.MAX_COUNT} labels allowed`);let t=n.map((i,s)=>{if(typeof i!="string")throw a.validation(`Label at index ${s} must be a string`);let r=i.trim().toLowerCase();if(r.length<P.MIN_LENGTH)throw a.validation(`Labels must be at least ${P.MIN_LENGTH} characters long`);if(r.length>P.MAX_LENGTH)throw a.validation(`Labels must be no more than ${P.MAX_LENGTH} characters long`);if(!De.test(r))throw a.validation(`Labels must start and end with alphanumeric characters, with optional separators (${P.SEPARATORS}) between segments`);return r}),e=[...new Set(t)];if(e.length!==t.length)throw a.validation("Duplicate labels are not allowed");return e}async function Te(n){let t=n.find(s=>s.path===I||s.path===`/${I}`);if(!t)return;let e=t.content,i=typeof e.text=="function"?await e.text():t.content.toString("utf8");he(i)}var Ze=3e4,Ae=3e5,et=3e5,tt=Ae+et,nt="sdk";function W(n){let t=new URLSearchParams;n?.limit!==void 0&&t.set("limit",String(n.limit)),n?.cursor!==void 0&&t.set("cursor",n.cursor);let e=t.toString();return e?`?${e}`:""}var M=class extends U{constructor(e){super();this.globalHeaders={};this.apiUrl=e.apiUrl||Y,this.getAuthHeadersCallback=e.getAuthHeaders,this.session=e.session??!1,this.caller=e.caller,this.timeout=e.timeout??Ze,this.deployTimeout=e.timeout??Ae,this.deployBuildTimeout=e.timeout??tt,this.fetch=e.fetch??globalThis.fetch.bind(globalThis),this.createDeployBody=e.createDeployBody,this.deployEndpoint=e.deployEndpoint||f.DEPLOYMENTS}setGlobalHeaders(e){this.globalHeaders=e}async executeRequest(e,i,s,r=this.timeout){let l=()=>{};try{let d=await this.mergeHeaders(i.headers),o=this.createTimeoutSignal(i.signal,r);l=o.cleanup;let c={...i,headers:d,credentials:this.session&&!d.Authorization?"include":void 0,signal:o.signal};this.emit("request",e,c);let p=await this.fetch(e,c);if(l(),!p.ok)throw await a.fromHttpResponse(p,s);return this.emit("response",this.safeClone(p),e),{data:await this.parseResponse(this.safeClone(p)),status:p.status}}catch(d){l();let o=a.fromFetchError(d,s);throw this.emit("error",o,e),o}}async request(e,i,s,r){let{data:l}=await this.executeRequest(e,i,s,r);return l}async requestWithStatus(e,i,s){return this.executeRequest(e,i,s)}async mergeHeaders(e={}){return{...this.globalHeaders,...this.caller?{"X-Caller":this.caller}:{},...await this.getAuthHeadersCallback(),...e}}createTimeoutSignal(e,i=this.timeout){let s=new AbortController,r=setTimeout(()=>s.abort(),i);if(e){let l=()=>s.abort();e.addEventListener("abort",l),e.aborted&&s.abort()}return{signal:s.signal,cleanup:()=>clearTimeout(r)}}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 deploy(e,i={}){if(!e.length)throw a.business("No files to deploy");for(let c of e)if(!c.md5)throw a.file(`MD5 checksum missing for file: ${c.path}`,{filePath:c.path});X(i.password);let s=ce(i.idempotencyKey),r=C(i.labels);await Te(e);let l=i.build||i.prerender||i.spa?{build:i.build,prerender:i.prerender,spa:i.spa}:void 0,{body:d,headers:o}=await this.createDeployBody(e,{labels:r,via:i.via??nt,password:i.password,flags:l,captcha:i.captcha});return this.request(`${this.apiUrl}${this.deployEndpoint}`,{method:"POST",body:d,headers:s?{...o,"Idempotency-Key":s}:o,signal:i.signal||null},"Deploy",i.build||i.prerender?this.deployBuildTimeout:this.deployTimeout)}async listDeployments(e){return this.request(`${this.apiUrl}${f.DEPLOYMENTS}${W(e)}`,{method:"GET"},"List deployments")}async getDeployment(e){return this.request(`${this.apiUrl}${f.DEPLOYMENT(encodeURIComponent(e))}`,{method:"GET"},"Get deployment")}async updateDeploymentLabels(e,i){let s=C(i);return this.request(`${this.apiUrl}${f.DEPLOYMENT(encodeURIComponent(e))}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({labels:s})},"Update deployment labels")}async deleteDeployment(e){return this.request(`${this.apiUrl}${f.DEPLOYMENT(encodeURIComponent(e))}`,{method:"DELETE"},"Delete deployment")}async setDomain(e,i,s){let r=C(s),l={};i&&(l.deployment=i),r!==void 0&&(l.labels=r);let{data:d,status:o}=await this.requestWithStatus(`${this.apiUrl}${f.DOMAIN(encodeURIComponent(e))}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)},"Set domain");return{...d,isCreate:o===201}}async listDomains(e){return this.request(`${this.apiUrl}${f.DOMAINS}${W(e)}`,{method:"GET"},"List domains")}async getDomain(e){return this.request(`${this.apiUrl}${f.DOMAIN(encodeURIComponent(e))}`,{method:"GET"},"Get domain")}async deleteDomain(e){return this.request(`${this.apiUrl}${f.DOMAIN(encodeURIComponent(e))}`,{method:"DELETE"},"Delete domain")}async verifyDomain(e){return this.request(`${this.apiUrl}${f.DOMAIN_VERIFY(encodeURIComponent(e))}`,{method:"POST"},"Verify domain")}async getDomainDns(e){return this.request(`${this.apiUrl}${f.DOMAIN_DNS(encodeURIComponent(e))}`,{method:"GET"},"Get domain DNS")}async getDomainRecords(e){return this.request(`${this.apiUrl}${f.DOMAIN_RECORDS(encodeURIComponent(e))}`,{method:"GET"},"Get domain records")}async getDomainShare(e){return this.request(`${this.apiUrl}${f.DOMAIN_SHARE(encodeURIComponent(e))}`,{method:"GET"},"Get domain share")}async validateDomain(e){return this.request(`${this.apiUrl}${f.DOMAINS_VALIDATE}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:e})},"Validate domain")}async createToken(e,i){let s=C(i),r={};return e!==void 0&&(r.ttl=e),s!==void 0&&(r.labels=s),this.request(`${this.apiUrl}${f.TOKENS}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)},"Create token")}async listTokens(e){return this.request(`${this.apiUrl}${f.TOKENS}${W(e)}`,{method:"GET"},"List tokens")}async deleteToken(e){return this.request(`${this.apiUrl}${f.TOKEN(encodeURIComponent(e))}`,{method:"DELETE"},"Delete token")}async getToken(e){return this.request(`${this.apiUrl}${f.TOKEN(encodeURIComponent(e))}`,{method:"GET"},"Get token")}async getAccount(){return this.request(`${this.apiUrl}${f.ACCOUNT}`,{method:"GET"},"Get account")}async getLimits(){return this.request(`${this.apiUrl}${f.LIMITS}`,{method:"GET"},"Get limits")}async ping(){return this.request(`${this.apiUrl}${f.PING}`,{method:"GET"},"Ping")}async checkSPA(e,i={}){let s=e.find(o=>o.path==="index.html"||o.path==="/index.html");if(!s||s.size>100*1024)return!1;let r;if(typeof Buffer<"u"&&Buffer.isBuffer(s.content))r=s.content.toString("utf-8");else if(typeof Blob<"u"&&s.content instanceof Blob)r=await s.content.text();else if(typeof File<"u"&&s.content instanceof File)r=await s.content.text();else return!1;let l={files:e.map(o=>o.path),index:r};return(await this.request(`${this.apiUrl}${f.SPA_CHECK}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)},"SPA check")).isSPA}};g();g();H();async function ot(){let n=JSON.stringify(fe,null,2),t;typeof Buffer<"u"?t=Buffer.from(n,"utf-8"):t=new Blob([n],{type:"application/json"});let{md5:e}=await B(t);return{path:I,content:t,size:n.length,md5:e}}async function Se(n,t,e){if(e.spaDetect===!1||e.spa||e.build||e.prerender||n.some(i=>i.path===I))return n;try{if(await t.checkSPA(n,e)){let s=await ot();return[...n,s]}}catch{}return n}function Re(n){let{getApi:t,ensureInit:e,processInput:i}=n;return{upload:async(s,r={})=>{if(await e(),!i)throw a.config("processInput function is not provided.");let l=t(),d=await i(s,r);return d=await Se(d,l,r),l.deploy(d,r)},list:async s=>(await e(),t().listDeployments(s)),get:async s=>(await e(),t().getDeployment(s)),set:async(s,r)=>(await e(),t().updateDeploymentLabels(s,r.labels)),delete:async s=>(await e(),t().deleteDeployment(s))}}function Ie(n){let{getApi:t,ensureInit:e}=n;return{set:async(i,s={})=>(await e(),t().setDomain(i,s.deployment,s.labels)),list:async i=>(await e(),t().listDomains(i)),get:async i=>(await e(),t().getDomain(i)),delete:async i=>(await e(),t().deleteDomain(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 we(n){let{getApi:t,ensureInit:e}=n;return{get:async()=>(await e(),t().getAccount())}}function Pe(n){let{getApi:t,ensureInit:e}=n;return{create:async(i={})=>(await e(),t().createToken(i.ttl,i.labels)),list:async i=>(await e(),t().listTokens(i)),get:async i=>(await e(),t().getToken(i)),delete:async i=>(await e(),t().deleteToken(i))}}var G=class{constructor(t={}){this.initPromise=null;this.platformLimits=null;this.credential=null;if(t={...t,apiUrl:t.apiUrl||void 0,token:t.token||void 0,caller:t.caller||void 0},this.clientOptions=t,t.caller!==void 0&&ge(t.caller),t.token&&t.session)throw a.config("Provide either `token` or `session`, not both.");typeof t.token=="string"?(q(t.token),this.credential=t.token):t.token&&(this.credential=t.token),this.http=new M({...t,getAuthHeaders:()=>this.getAuthHeaders(),createDeployBody:this.getDeployBodyCreator()});let e={getApi:()=>this.http,ensureInit:()=>this.ensureInitialized()};this.deployments=Re({...e,processInput:(i,s)=>this.processInput(i,s)}),this.domains=Ie(e),this.account=we(e),this.tokens=Pe(e)}async ensureInitialized(){return this.initPromise||(this.initPromise=this.fetchPlatformLimits()),this.initPromise}async fetchPlatformLimits(){try{this.platformLimits=await this.http.getLimits()}catch(t){throw this.initPromise=null,t}}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()}async getLimits(){return this.platformLimits?this.platformLimits:(await this.ensureInitialized(),this.platformLimits)}on(t,e){this.http.on(t,e)}off(t,e){this.http.off(t,e)}setHeaders(t){this.http.setGlobalHeaders(t)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(t){if(this.clientOptions.session)throw a.config("Provide either `token` or `session`, not both.");if(typeof t=="string"){if(!t)throw a.business("Invalid token provided. Token must be a non-empty string.");q(t),this.credential=t;return}if(typeof t!="function")throw a.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=t}async getAuthHeaders(){if(this.credential===null)return{};let t=typeof this.credential=="function"?await this.credential():this.credential;if(!t)throw a.authentication("Token provider returned no token.");if(typeof t!="string")throw a.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${t}`}}};F();g();import{z as xe}from"zod";import{z as Ne}from"zod";var be={apiUrl:Ne.string().url().optional(),token:Ne.string().min(1).optional()};F();var lt=xe.object(be).strict(),pt={apiUrl:"SHIP_API_URL",token:"SHIP_TOKEN"};function Le(){if(x()!=="node")return{};let n={apiUrl:process.env.SHIP_API_URL||void 0,token:process.env.SHIP_TOKEN||void 0};try{return lt.parse(n)}catch(t){if(t instanceof xe.ZodError){let e=t.issues[0],i=e.path[0],s=(i&&pt[i])??"SHIP environment configuration";throw a.config(`Invalid ${s}: ${e.message}`)}throw a.config("Invalid environment configuration")}}g();async function ve(n,t={}){let{FormData:e,File:i}=await import("formdata-node"),{FormDataEncoder:s}=await import("form-data-encoder"),{labels:r,via:l,password:d,flags:o,captcha:c}=t,p=new e,S=[];for(let u of n){if(!Buffer.isBuffer(u.content)&&!(typeof Blob<"u"&&u.content instanceof Blob))throw a.file(`Unsupported file.content type for Node.js: ${u.path}`,{filePath:u.path});if(!u.md5)throw a.file(`File missing md5 checksum: ${u.path}`,{filePath:u.path});let h=new i([u.content],u.path,{type:"application/octet-stream"});p.append("files[]",h),S.push(u.md5)}p.append("checksums",JSON.stringify(S)),r&&r.length>0&&p.append("labels",JSON.stringify(r)),l&&p.append("via",l),d&&p.append("password",d),o?.build&&p.append("build","true"),o?.prerender&&p.append("prerender","true"),o?.spa&&p.append("spa","true"),c&&p.append("captcha",c);let L=new s(p),N=[];for await(let u of L.encode())N.push(Buffer.from(u));let w=Buffer.concat(N);return{body:w.buffer.slice(w.byteOffset,w.byteOffset+w.byteLength),headers:{"Content-Type":L.contentType,"Content-Length":Buffer.byteLength(w).toString()}}}g();g();ee();F();ie();se();H();re();function In(n,t,e,i=!0){let s=n===1?t:e;return i?`${n} ${s}`:s}oe();var ae=class extends G{constructor(t={}){if(x()!=="node")throw a.business("Node.js Ship class can only be used in Node.js environment.");let e=Le();super({...t,apiUrl:t.apiUrl||e.apiUrl,token:t.token||(t.session?void 0:e.token)})}async deploy(t,e){return super.deploy(t,e)}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:s}=await Promise.resolve().then(()=>(oe(),Me));return s(i,e,this.platformLimits??void 0)}getDeployBodyCreator(){return ve}},ft=ae;export{de as API_KEY,f as API_PATHS,Tt as AUTH_BASE_PATH,Et as AccountPlan,M as ApiHttp,pe as AuthMethod,qe as BLOCKED_EXTENSIONS,j as CALLER,Y as DEFAULT_API,I as DEPLOYMENT_CONFIG_FILENAME,me as DEPLOY_TOKEN,yt as DeploymentStatus,gt as DomainStatus,m as ErrorType,y as FILE_VALIDATION_STATUS,y as FileValidationStatus,le as IDEMPOTENCY_KEY_CONSTRAINTS,mt as JUNK_DIRECTORIES,P as LABEL_CONSTRAINTS,De as LABEL_PATTERN,At as OAuthScope,_ as PASSWORD_CONSTRAINTS,fe as SPA_DEFAULT_CONFIG,ae as Ship,a as ShipError,b as TokenKind,K as UNBUILT_PROJECT_MARKERS,Xe as UNSAFE_FILENAME_CHARS,Dt as WEB_FILE_ACCEPT,Jt as __setTestEnvironment,yn as allValidFilesReady,he as assertShipJsonSyntax,B as calculateMD5,We as classifyToken,we as createAccountResource,Re as createDeploymentResource,Ie as createDomainResource,Pe as createTokenResource,ft as default,xt as deserializeLabels,wt as extractSubdomain,Fe as filterJunk,te as formatFileSize,Pt as generateDeploymentUrl,Nt as generateDomainUrl,x as getENV,ut as getValidFiles,k as hasUnbuiltMarker,ue as hasUnsafeChars,$ as isBlockedExtension,It as isCustomDomain,Rt as isDeployment,Ee as isPlatformDomain,O as isShipError,Ce as optimizeDeployPaths,In as pluralize,Ue as processFilesForNode,bt as serializeLabels,Je as validateApiKey,St as validateApiUrl,ge as validateCaller,$e as validateDeployFile,_e as validateDeployPath,Qe as validateDeployToken,ne as validateFileName,hn as validateFiles,ce as validateIdempotencyKey,X as validatePassword,q as validateToken};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|