@shipstatic/ship 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +33 -9
- package/dist/browser.js +1 -40
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +18 -18
- 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 +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _shipstatic_types from '@shipstatic/types';
|
|
2
|
-
import { ProgressInfo, StaticFile, Domain, Deployment, DeploymentListResponse, DomainListResponse, DomainDnsResponse, DomainRecordsResponse, DomainValidateResponse, TokenCreateResponse, TokenListResponse, Account, ConfigResponse,
|
|
2
|
+
import { ProgressInfo, StaticFile, Domain, Deployment, DeploymentListResponse, DomainListResponse, DomainDnsResponse, DomainRecordsResponse, DomainValidateResponse, TokenCreateResponse, TokenListResponse, Account, ConfigResponse, ResolvedConfig, DeployInput, AccountResource, DeploymentResource, DomainResource, TokenResource, ValidatableFile, FileValidationResult } from '@shipstatic/types';
|
|
3
3
|
export * from '@shipstatic/types';
|
|
4
4
|
export { Account, AccountResource, DEFAULT_API, DeployInput, Deployment, DeploymentResource, Domain, DomainResource, ErrorType, FileValidationStatus as FILE_VALIDATION_STATUS, PingResponse, ResolvedConfig, ShipError, StaticFile, TokenResource } from '@shipstatic/types';
|
|
5
5
|
|
|
@@ -237,10 +237,6 @@ declare class ApiHttp extends SimpleEvents {
|
|
|
237
237
|
* This means CLI flags always win, followed by env vars, then config files.
|
|
238
238
|
*/
|
|
239
239
|
|
|
240
|
-
/**
|
|
241
|
-
* Cross-environment config loader that dispatches to appropriate implementation.
|
|
242
|
-
*/
|
|
243
|
-
declare function loadConfig(configFile?: string): Promise<PlatformConfig>;
|
|
244
240
|
/**
|
|
245
241
|
* Universal configuration resolver for all environments.
|
|
246
242
|
* This is the single source of truth for config resolution.
|
|
@@ -580,6 +576,29 @@ declare function getValidFiles<T extends ValidatableFile>(files: T[]): T[];
|
|
|
580
576
|
*/
|
|
581
577
|
declare function allValidFilesReady<T extends ValidatableFile>(files: T[]): boolean;
|
|
582
578
|
|
|
579
|
+
/**
|
|
580
|
+
* Validate a deploy path for security concerns.
|
|
581
|
+
* Rejects paths containing path traversal patterns or null bytes.
|
|
582
|
+
*
|
|
583
|
+
* Checks for:
|
|
584
|
+
* - Null bytes (\0) — path injection
|
|
585
|
+
* - /../ — directory traversal within path
|
|
586
|
+
* - ../ at start — upward traversal
|
|
587
|
+
* - /.. at end — trailing traversal
|
|
588
|
+
*
|
|
589
|
+
* Does NOT reject double dots in filenames (e.g., "foo..bar.txt" is safe).
|
|
590
|
+
*
|
|
591
|
+
* @param deployPath - The deployment path to validate
|
|
592
|
+
* @param sourceIdentifier - Human-readable identifier for error messages
|
|
593
|
+
* @throws {ShipError} If the path contains unsafe patterns
|
|
594
|
+
*/
|
|
595
|
+
declare function validateDeployPath(deployPath: string, sourceIdentifier: string): void;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Get MIME type from file path (browser-compatible, no Node.js dependencies)
|
|
599
|
+
*/
|
|
600
|
+
declare function getMimeType(path: string): string;
|
|
601
|
+
|
|
583
602
|
/**
|
|
584
603
|
* @file Platform configuration management for the Ship SDK.
|
|
585
604
|
* Implements fail-fast dynamic configuration with mandatory API fetch.
|
|
@@ -597,17 +616,22 @@ declare function getCurrentConfig(): ConfigResponse;
|
|
|
597
616
|
|
|
598
617
|
/**
|
|
599
618
|
* @file Browser-specific file utilities for the Ship SDK.
|
|
600
|
-
* Provides helpers for processing browser files into deploy-ready objects
|
|
619
|
+
* Provides helpers for processing browser files into deploy-ready objects.
|
|
620
|
+
*
|
|
621
|
+
* Pipeline order matches Node.js (node-files.ts) for consistency:
|
|
622
|
+
* 1. Extract paths → 2. Filter junk → 3. Optimize paths →
|
|
623
|
+
* 4. Security validate → 5. Skip empties → 6. Size validate →
|
|
624
|
+
* 7. Calculate MD5 → 8. Count validate
|
|
601
625
|
*/
|
|
602
626
|
|
|
603
627
|
/**
|
|
604
628
|
* Processes browser files into an array of StaticFile objects ready for deploy.
|
|
605
|
-
* Calculates MD5, filters junk files, and applies
|
|
629
|
+
* Calculates MD5, filters junk files, validates sizes, and applies path optimization.
|
|
606
630
|
*
|
|
607
631
|
* @param browserFiles - File[] to process for deploy.
|
|
608
632
|
* @param options - Processing options including pathDetect for automatic path optimization.
|
|
609
633
|
* @returns Promise resolving to an array of StaticFile objects.
|
|
610
|
-
* @throws {
|
|
634
|
+
* @throws {ShipError} If called outside a browser or with invalid input.
|
|
611
635
|
*/
|
|
612
636
|
declare function processFilesForBrowser(browserFiles: File[], options?: DeploymentOptions): Promise<StaticFile[]>;
|
|
613
637
|
|
|
@@ -644,4 +668,4 @@ declare class Ship extends Ship$1 {
|
|
|
644
668
|
protected getDeployBodyCreator(): DeployBodyCreator;
|
|
645
669
|
}
|
|
646
670
|
|
|
647
|
-
export { type ApiDeployOptions, ApiHttp, type ApiHttpOptions, type DeployBody, type DeployBodyCreator, type DeployFile, type DeploymentOptions, type DeploymentResourceContext, type DomainSetResult, type ExecutionEnvironment, JUNK_DIRECTORIES, type MD5Result, type ResourceContext, Ship, type ShipClientOptions, type ShipEvents, __setTestEnvironment, allValidFilesReady, calculateMD5, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, filterJunk, formatFileSize, getCurrentConfig, getENV,
|
|
671
|
+
export { type ApiDeployOptions, ApiHttp, type ApiHttpOptions, type DeployBody, type DeployBodyCreator, type DeployFile, type DeploymentOptions, type DeploymentResourceContext, type DomainSetResult, type ExecutionEnvironment, JUNK_DIRECTORIES, type MD5Result, type ResourceContext, Ship, type ShipClientOptions, type ShipEvents, __setTestEnvironment, allValidFilesReady, calculateMD5, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, filterJunk, formatFileSize, getCurrentConfig, getENV, getMimeType, getValidFiles, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForBrowser, resolveConfig, setConfig as setPlatformConfig, validateDeployPath, validateFiles };
|