@shipstatic/ship 0.5.4 → 0.6.0
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 +29 -10
- package/dist/browser.js +1 -50
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +22 -22
- 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 +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
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.
|
|
@@ -544,7 +540,7 @@ declare function formatFileSize(bytes: number, decimals?: number): string;
|
|
|
544
540
|
* Validate files against configuration limits with severity-based reporting
|
|
545
541
|
*
|
|
546
542
|
* Validation categorizes issues by severity:
|
|
547
|
-
* - **Errors**: Block deployment (file too large,
|
|
543
|
+
* - **Errors**: Block deployment (file too large, blocked extension, etc.)
|
|
548
544
|
* - **Warnings**: Exclude files but allow deployment (empty files, etc.)
|
|
549
545
|
*
|
|
550
546
|
* @param files - Array of files to validate
|
|
@@ -580,6 +576,24 @@ 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
|
+
|
|
583
597
|
/**
|
|
584
598
|
* @file Platform configuration management for the Ship SDK.
|
|
585
599
|
* Implements fail-fast dynamic configuration with mandatory API fetch.
|
|
@@ -597,17 +611,22 @@ declare function getCurrentConfig(): ConfigResponse;
|
|
|
597
611
|
|
|
598
612
|
/**
|
|
599
613
|
* @file Browser-specific file utilities for the Ship SDK.
|
|
600
|
-
* Provides helpers for processing browser files into deploy-ready objects
|
|
614
|
+
* Provides helpers for processing browser files into deploy-ready objects.
|
|
615
|
+
*
|
|
616
|
+
* Pipeline order matches Node.js (node-files.ts) for consistency:
|
|
617
|
+
* 1. Extract paths → 2. Filter junk → 3. Optimize paths →
|
|
618
|
+
* 4. Security validate → 5. Skip empties → 6. Size validate →
|
|
619
|
+
* 7. Calculate MD5 → 8. Count validate
|
|
601
620
|
*/
|
|
602
621
|
|
|
603
622
|
/**
|
|
604
623
|
* Processes browser files into an array of StaticFile objects ready for deploy.
|
|
605
|
-
* Calculates MD5, filters junk files, and applies
|
|
624
|
+
* Calculates MD5, filters junk files, validates sizes, and applies path optimization.
|
|
606
625
|
*
|
|
607
626
|
* @param browserFiles - File[] to process for deploy.
|
|
608
627
|
* @param options - Processing options including pathDetect for automatic path optimization.
|
|
609
628
|
* @returns Promise resolving to an array of StaticFile objects.
|
|
610
|
-
* @throws {
|
|
629
|
+
* @throws {ShipError} If called outside a browser or with invalid input.
|
|
611
630
|
*/
|
|
612
631
|
declare function processFilesForBrowser(browserFiles: File[], options?: DeploymentOptions): Promise<StaticFile[]>;
|
|
613
632
|
|
|
@@ -644,4 +663,4 @@ declare class Ship extends Ship$1 {
|
|
|
644
663
|
protected getDeployBodyCreator(): DeployBodyCreator;
|
|
645
664
|
}
|
|
646
665
|
|
|
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, getValidFiles,
|
|
666
|
+
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, getValidFiles, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForBrowser, resolveConfig, setConfig as setPlatformConfig, validateDeployPath, validateFiles };
|