@shipstatic/types 0.7.2 → 0.7.4
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/index.d.ts +14 -0
- package/dist/index.js +23 -0
- package/package.json +2 -1
- package/src/index.ts +26 -0
package/dist/index.d.ts
CHANGED
|
@@ -388,6 +388,20 @@ export declare const BLOCKED_EXTENSIONS: ReadonlySet<string>;
|
|
|
388
388
|
* isBlockedExtension('README') // false
|
|
389
389
|
*/
|
|
390
390
|
export declare function isBlockedExtension(filename: string): boolean;
|
|
391
|
+
/**
|
|
392
|
+
* Directory names that indicate an unbuilt project was uploaded instead of build output.
|
|
393
|
+
* Used for early detection in CLI, browser, and server validation.
|
|
394
|
+
*/
|
|
395
|
+
export declare const UNBUILT_PROJECT_MARKERS: ReadonlySet<string>;
|
|
396
|
+
/**
|
|
397
|
+
* Check if a file path contains an unbuilt project marker directory.
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* hasUnbuiltMarker('node_modules/react/index.js') // true
|
|
401
|
+
* hasUnbuiltMarker('package.json') // true
|
|
402
|
+
* hasUnbuiltMarker('dist/index.html') // false
|
|
403
|
+
*/
|
|
404
|
+
export declare function hasUnbuiltMarker(filePath: string): boolean;
|
|
391
405
|
/**
|
|
392
406
|
* Simple ping response for health checks
|
|
393
407
|
*/
|
package/dist/index.js
CHANGED
|
@@ -249,6 +249,29 @@ export function isBlockedExtension(filename) {
|
|
|
249
249
|
const ext = filename.slice(dotIndex + 1).toLowerCase();
|
|
250
250
|
return BLOCKED_EXTENSIONS.has(ext);
|
|
251
251
|
}
|
|
252
|
+
// =============================================================================
|
|
253
|
+
// UNBUILT PROJECT MARKERS
|
|
254
|
+
// =============================================================================
|
|
255
|
+
/**
|
|
256
|
+
* Directory names that indicate an unbuilt project was uploaded instead of build output.
|
|
257
|
+
* Used for early detection in CLI, browser, and server validation.
|
|
258
|
+
*/
|
|
259
|
+
export const UNBUILT_PROJECT_MARKERS = new Set([
|
|
260
|
+
'node_modules',
|
|
261
|
+
'package.json',
|
|
262
|
+
]);
|
|
263
|
+
/**
|
|
264
|
+
* Check if a file path contains an unbuilt project marker directory.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* hasUnbuiltMarker('node_modules/react/index.js') // true
|
|
268
|
+
* hasUnbuiltMarker('package.json') // true
|
|
269
|
+
* hasUnbuiltMarker('dist/index.html') // false
|
|
270
|
+
*/
|
|
271
|
+
export function hasUnbuiltMarker(filePath) {
|
|
272
|
+
const segments = filePath.replace(/\\/g, '/').split('/').filter(Boolean);
|
|
273
|
+
return segments.some(s => UNBUILT_PROJECT_MARKERS.has(s));
|
|
274
|
+
}
|
|
252
275
|
// API Key Configuration
|
|
253
276
|
export const API_KEY_PREFIX = 'ship-';
|
|
254
277
|
export const API_KEY_HEX_LENGTH = 64;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipstatic/types",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Shared types for Shipstatic platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^24.10.9",
|
|
37
|
+
"husky": "^9.1.7",
|
|
37
38
|
"typescript": "^5.9.3",
|
|
38
39
|
"vitest": "^2.1.8"
|
|
39
40
|
},
|
package/src/index.ts
CHANGED
|
@@ -571,6 +571,32 @@ export function isBlockedExtension(filename: string): boolean {
|
|
|
571
571
|
return BLOCKED_EXTENSIONS.has(ext);
|
|
572
572
|
}
|
|
573
573
|
|
|
574
|
+
// =============================================================================
|
|
575
|
+
// UNBUILT PROJECT MARKERS
|
|
576
|
+
// =============================================================================
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Directory names that indicate an unbuilt project was uploaded instead of build output.
|
|
580
|
+
* Used for early detection in CLI, browser, and server validation.
|
|
581
|
+
*/
|
|
582
|
+
export const UNBUILT_PROJECT_MARKERS: ReadonlySet<string> = new Set([
|
|
583
|
+
'node_modules',
|
|
584
|
+
'package.json',
|
|
585
|
+
]);
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Check if a file path contains an unbuilt project marker directory.
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* hasUnbuiltMarker('node_modules/react/index.js') // true
|
|
592
|
+
* hasUnbuiltMarker('package.json') // true
|
|
593
|
+
* hasUnbuiltMarker('dist/index.html') // false
|
|
594
|
+
*/
|
|
595
|
+
export function hasUnbuiltMarker(filePath: string): boolean {
|
|
596
|
+
const segments = filePath.replace(/\\/g, '/').split('/').filter(Boolean);
|
|
597
|
+
return segments.some(s => UNBUILT_PROJECT_MARKERS.has(s));
|
|
598
|
+
}
|
|
599
|
+
|
|
574
600
|
// =============================================================================
|
|
575
601
|
// COMMON RESPONSE PATTERNS
|
|
576
602
|
// =============================================================================
|