@stacksjs/utils 0.70.87 → 0.70.88
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/package.json +11 -11
- package/dist/bytes.d.ts +0 -42
- package/dist/clean.d.ts +0 -1
- package/dist/colors.d.ts +0 -146
- package/dist/config.d.ts +0 -23
- package/dist/debounce.d.ts +0 -29
- package/dist/detect.d.ts +0 -35
- package/dist/equal.d.ts +0 -13
- package/dist/errors.d.ts +0 -65
- package/dist/export-size.d.ts +0 -2
- package/dist/find.d.ts +0 -4
- package/dist/git.d.ts +0 -1
- package/dist/hash.d.ts +0 -3
- package/dist/helpers.d.ts +0 -53
- package/dist/index.d.ts +0 -24
- package/dist/index.js +0 -16
- package/dist/macroable.d.ts +0 -28
- package/dist/markdown.d.ts +0 -46
- package/dist/merge.d.ts +0 -20
- package/dist/observer.d.ts +0 -64
- package/dist/pipeline.d.ts +0 -13
- package/dist/safe-json.d.ts +0 -49
- package/dist/size.d.ts +0 -37
- package/dist/versions.d.ts +0 -8
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/utils",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.70.
|
|
5
|
+
"version": "0.70.88",
|
|
6
6
|
"description": "The Stacks helper functions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -58,20 +58,20 @@
|
|
|
58
58
|
"size": "bun scripts/export-size.ts"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@stacksjs/browser": "0.70.
|
|
61
|
+
"@stacksjs/browser": "0.70.88"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@stacksjs/actions": "0.70.
|
|
65
|
-
"@stacksjs/arrays": "0.70.
|
|
66
|
-
"@stacksjs/cli": "0.70.
|
|
67
|
-
"@stacksjs/config": "0.70.
|
|
64
|
+
"@stacksjs/actions": "0.70.88",
|
|
65
|
+
"@stacksjs/arrays": "0.70.88",
|
|
66
|
+
"@stacksjs/cli": "0.70.88",
|
|
67
|
+
"@stacksjs/config": "0.70.88",
|
|
68
68
|
"better-dx": "^0.2.16",
|
|
69
69
|
"filesize": "^11.0.22",
|
|
70
70
|
"markdown-table": "^3.0.4",
|
|
71
|
-
"@stacksjs/lint": "0.70.
|
|
72
|
-
"@stacksjs/path": "0.70.
|
|
73
|
-
"@stacksjs/storage": "0.70.
|
|
74
|
-
"@stacksjs/strings": "0.70.
|
|
75
|
-
"@stacksjs/types": "0.70.
|
|
71
|
+
"@stacksjs/lint": "0.70.88",
|
|
72
|
+
"@stacksjs/path": "0.70.88",
|
|
73
|
+
"@stacksjs/storage": "0.70.88",
|
|
74
|
+
"@stacksjs/strings": "0.70.88",
|
|
75
|
+
"@stacksjs/types": "0.70.88"
|
|
76
76
|
}
|
|
77
77
|
}
|
package/dist/bytes.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format bytes to human-readable string
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```ts
|
|
6
|
-
* formatBytes(1024) // '1 KB'
|
|
7
|
-
* formatBytes(1024, { binary: true }) // '1 KiB'
|
|
8
|
-
* formatBytes(1234567) // '1.2 MB'
|
|
9
|
-
* formatBytes(1234567, { precision: 2 }) // '1.23 MB'
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export declare function formatBytes(bytes: number, options?: BytesOptions): string;
|
|
13
|
-
/**
|
|
14
|
-
* Parse human-readable byte string to number
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* parseBytes('1 KB') // 1000
|
|
19
|
-
* parseBytes('1 KiB') // 1024
|
|
20
|
-
* parseBytes('1.5 MB') // 1500000
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function parseBytes(input: string): number;
|
|
24
|
-
/**
|
|
25
|
-
* Compare two byte values
|
|
26
|
-
*/
|
|
27
|
-
export declare function compareBytes(a: number | string, b: number | string): number;
|
|
28
|
-
// Aliases
|
|
29
|
-
export declare const prettyBytes: unknown;
|
|
30
|
-
export declare const readableSize: unknown;
|
|
31
|
-
/**
|
|
32
|
-
* Format bytes to human-readable string (pretty-bytes replacement)
|
|
33
|
-
*/
|
|
34
|
-
export declare interface BytesOptions {
|
|
35
|
-
precision?: number
|
|
36
|
-
binary?: boolean
|
|
37
|
-
space?: boolean
|
|
38
|
-
locale?: string
|
|
39
|
-
minimumFractionDigits?: number
|
|
40
|
-
maximumFractionDigits?: number
|
|
41
|
-
}
|
|
42
|
-
export { formatBytes as default };
|
package/dist/clean.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function cleanProject(): Promise<void>;
|
package/dist/colors.d.ts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
declare function createColorFn(code: string, endCode?: string): ColorFn;
|
|
2
|
-
// Strip colors from text
|
|
3
|
-
export declare function stripColors(text: string): string;
|
|
4
|
-
// Check if colors are supported
|
|
5
|
-
export declare function supportsColor(): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Terminal colors and formatting (kolorist replacement)
|
|
8
|
-
*
|
|
9
|
-
* Lightweight terminal color library with zero dependencies
|
|
10
|
-
*/
|
|
11
|
-
declare const isColorSupported: unknown;
|
|
12
|
-
declare const colors: {
|
|
13
|
-
reset: unknown;
|
|
14
|
-
black: unknown;
|
|
15
|
-
red: unknown;
|
|
16
|
-
green: unknown;
|
|
17
|
-
yellow: unknown;
|
|
18
|
-
blue: unknown;
|
|
19
|
-
magenta: unknown;
|
|
20
|
-
cyan: unknown;
|
|
21
|
-
white: unknown;
|
|
22
|
-
gray: unknown;
|
|
23
|
-
grey: unknown;
|
|
24
|
-
lightRed: unknown;
|
|
25
|
-
lightGreen: unknown;
|
|
26
|
-
lightYellow: unknown;
|
|
27
|
-
lightBlue: unknown;
|
|
28
|
-
lightMagenta: unknown;
|
|
29
|
-
lightCyan: unknown;
|
|
30
|
-
lightGray: unknown;
|
|
31
|
-
lightGrey: unknown;
|
|
32
|
-
bgBlack: unknown;
|
|
33
|
-
bgRed: unknown;
|
|
34
|
-
bgGreen: unknown;
|
|
35
|
-
bgYellow: unknown;
|
|
36
|
-
bgBlue: unknown;
|
|
37
|
-
bgMagenta: unknown;
|
|
38
|
-
bgCyan: unknown;
|
|
39
|
-
bgWhite: unknown;
|
|
40
|
-
bgLightRed: unknown;
|
|
41
|
-
bgLightGreen: unknown;
|
|
42
|
-
bgLightYellow: unknown;
|
|
43
|
-
bgLightBlue: unknown;
|
|
44
|
-
bgLightMagenta: unknown;
|
|
45
|
-
bgLightCyan: unknown;
|
|
46
|
-
bold: unknown;
|
|
47
|
-
dim: unknown;
|
|
48
|
-
italic: unknown;
|
|
49
|
-
underline: unknown;
|
|
50
|
-
inverse: unknown;
|
|
51
|
-
hidden: unknown;
|
|
52
|
-
strikethrough: unknown
|
|
53
|
-
};
|
|
54
|
-
// Color functions
|
|
55
|
-
export declare const black: unknown;
|
|
56
|
-
export declare const red: unknown;
|
|
57
|
-
export declare const green: unknown;
|
|
58
|
-
export declare const yellow: unknown;
|
|
59
|
-
export declare const blue: unknown;
|
|
60
|
-
export declare const magenta: unknown;
|
|
61
|
-
export declare const cyan: unknown;
|
|
62
|
-
export declare const white: unknown;
|
|
63
|
-
export declare const gray: unknown;
|
|
64
|
-
export declare const grey: unknown;
|
|
65
|
-
// Bright colors
|
|
66
|
-
export declare const lightRed: unknown;
|
|
67
|
-
export declare const lightGreen: unknown;
|
|
68
|
-
export declare const lightYellow: unknown;
|
|
69
|
-
export declare const lightBlue: unknown;
|
|
70
|
-
export declare const lightMagenta: unknown;
|
|
71
|
-
export declare const lightCyan: unknown;
|
|
72
|
-
export declare const lightGray: unknown;
|
|
73
|
-
export declare const lightGrey: unknown;
|
|
74
|
-
// Background colors
|
|
75
|
-
export declare const bgBlack: unknown;
|
|
76
|
-
export declare const bgRed: unknown;
|
|
77
|
-
export declare const bgGreen: unknown;
|
|
78
|
-
export declare const bgYellow: unknown;
|
|
79
|
-
export declare const bgBlue: unknown;
|
|
80
|
-
export declare const bgMagenta: unknown;
|
|
81
|
-
export declare const bgCyan: unknown;
|
|
82
|
-
export declare const bgWhite: unknown;
|
|
83
|
-
// Bright background colors
|
|
84
|
-
export declare const bgLightRed: unknown;
|
|
85
|
-
export declare const bgLightGreen: unknown;
|
|
86
|
-
export declare const bgLightYellow: unknown;
|
|
87
|
-
export declare const bgLightBlue: unknown;
|
|
88
|
-
export declare const bgLightMagenta: unknown;
|
|
89
|
-
export declare const bgLightCyan: unknown;
|
|
90
|
-
// Text formatting
|
|
91
|
-
export declare const bold: unknown;
|
|
92
|
-
export declare const dim: unknown;
|
|
93
|
-
export declare const italic: unknown;
|
|
94
|
-
export declare const underline: unknown;
|
|
95
|
-
export declare const inverse: unknown;
|
|
96
|
-
export declare const hidden: unknown;
|
|
97
|
-
export declare const strikethrough: unknown;
|
|
98
|
-
// Reset
|
|
99
|
-
export declare const reset: unknown;
|
|
100
|
-
declare const __dtsx_default_export__: {
|
|
101
|
-
black: typeof black;
|
|
102
|
-
red: typeof red;
|
|
103
|
-
green: typeof green;
|
|
104
|
-
yellow: typeof yellow;
|
|
105
|
-
blue: typeof blue;
|
|
106
|
-
magenta: typeof magenta;
|
|
107
|
-
cyan: typeof cyan;
|
|
108
|
-
white: typeof white;
|
|
109
|
-
gray: typeof gray;
|
|
110
|
-
grey: typeof grey;
|
|
111
|
-
lightRed: typeof lightRed;
|
|
112
|
-
lightGreen: typeof lightGreen;
|
|
113
|
-
lightYellow: typeof lightYellow;
|
|
114
|
-
lightBlue: typeof lightBlue;
|
|
115
|
-
lightMagenta: typeof lightMagenta;
|
|
116
|
-
lightCyan: typeof lightCyan;
|
|
117
|
-
lightGray: typeof lightGray;
|
|
118
|
-
lightGrey: typeof lightGrey;
|
|
119
|
-
bgBlack: typeof bgBlack;
|
|
120
|
-
bgRed: typeof bgRed;
|
|
121
|
-
bgGreen: typeof bgGreen;
|
|
122
|
-
bgYellow: typeof bgYellow;
|
|
123
|
-
bgBlue: typeof bgBlue;
|
|
124
|
-
bgMagenta: typeof bgMagenta;
|
|
125
|
-
bgCyan: typeof bgCyan;
|
|
126
|
-
bgWhite: typeof bgWhite;
|
|
127
|
-
bgLightRed: typeof bgLightRed;
|
|
128
|
-
bgLightGreen: typeof bgLightGreen;
|
|
129
|
-
bgLightYellow: typeof bgLightYellow;
|
|
130
|
-
bgLightBlue: typeof bgLightBlue;
|
|
131
|
-
bgLightMagenta: typeof bgLightMagenta;
|
|
132
|
-
bgLightCyan: typeof bgLightCyan;
|
|
133
|
-
bold: typeof bold;
|
|
134
|
-
dim: typeof dim;
|
|
135
|
-
italic: typeof italic;
|
|
136
|
-
underline: typeof underline;
|
|
137
|
-
inverse: typeof inverse;
|
|
138
|
-
hidden: typeof hidden;
|
|
139
|
-
strikethrough: typeof strikethrough;
|
|
140
|
-
reset: typeof reset;
|
|
141
|
-
stripColors: typeof stripColors;
|
|
142
|
-
supportsColor: typeof supportsColor
|
|
143
|
-
};
|
|
144
|
-
declare type ColorFn = (_text: string | number) => string;
|
|
145
|
-
// Default export
|
|
146
|
-
export default __dtsx_default_export__;
|
package/dist/config.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
defineApp,
|
|
3
|
-
defineCache,
|
|
4
|
-
defineCdn,
|
|
5
|
-
defineChat,
|
|
6
|
-
defineCli,
|
|
7
|
-
defineDatabase,
|
|
8
|
-
defineDependencies,
|
|
9
|
-
defineDns,
|
|
10
|
-
defineEmail,
|
|
11
|
-
defineEmailConfig,
|
|
12
|
-
defineGit,
|
|
13
|
-
defineHashing,
|
|
14
|
-
defineLibrary,
|
|
15
|
-
defineNotification,
|
|
16
|
-
definePayment,
|
|
17
|
-
defineQueue,
|
|
18
|
-
defineSearchEngine,
|
|
19
|
-
defineServices,
|
|
20
|
-
defineSms,
|
|
21
|
-
defineFilesystems,
|
|
22
|
-
defineUi,
|
|
23
|
-
} from '@stacksjs/config';
|
package/dist/debounce.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a debounced function that delays invoking func until after wait milliseconds
|
|
3
|
-
* have elapsed since the last time the debounced function was invoked.
|
|
4
|
-
*
|
|
5
|
-
* @param fn - The function to debounce
|
|
6
|
-
* @param wait - The number of milliseconds to delay
|
|
7
|
-
* @param options - Options object
|
|
8
|
-
* @returns The debounced function
|
|
9
|
-
*/
|
|
10
|
-
export declare function debounce<T extends (..._args: any[]) => any>(fn: T, wait?: number, options?: DebounceOptions): T & { cancel: () => void; flush: () => void };
|
|
11
|
-
/**
|
|
12
|
-
* Creates a throttled function that only invokes func at most once per every wait milliseconds
|
|
13
|
-
*
|
|
14
|
-
* @param fn - The function to throttle
|
|
15
|
-
* @param wait - The number of milliseconds to throttle
|
|
16
|
-
* @returns The throttled function
|
|
17
|
-
*/
|
|
18
|
-
export declare function throttle<T extends (...args: any[]) => any>(fn: T, wait?: number): T & { cancel: () => void };
|
|
19
|
-
/**
|
|
20
|
-
* Delays execution of a function
|
|
21
|
-
*/
|
|
22
|
-
export declare function delay(ms: number): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Debounce and throttle utilities (perfect-debounce replacement)
|
|
25
|
-
*/
|
|
26
|
-
export declare interface DebounceOptions {
|
|
27
|
-
leading?: boolean
|
|
28
|
-
trailing?: boolean
|
|
29
|
-
}
|
package/dist/detect.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export declare function detectIndent(text: string): IndentInfo;
|
|
2
|
-
/**
|
|
3
|
-
* Detect newline type in a string
|
|
4
|
-
*
|
|
5
|
-
* @returns '\r\n' (CRLF - Windows), '\n' (LF - Unix), '\r' (CR - old Mac), or null
|
|
6
|
-
*/
|
|
7
|
-
export declare function detectNewline(text: string): '\r\n' | '\n' | '\r' | null;
|
|
8
|
-
/**
|
|
9
|
-
* Detect newline type with graceful fallback
|
|
10
|
-
*/
|
|
11
|
-
export declare function detectNewlineGraceful(text: string, fallback?: '\r\n' | '\n'): '\r\n' | '\n' | '\r';
|
|
12
|
-
/**
|
|
13
|
-
* Normalize newlines in text to specified type
|
|
14
|
-
*/
|
|
15
|
-
export declare function normalizeNewlines(text: string, newline?: '\r\n' | '\n' | '\r'): string;
|
|
16
|
-
/**
|
|
17
|
-
* Count different types of newlines in text
|
|
18
|
-
*/
|
|
19
|
-
export declare function countNewlines(text: string): {
|
|
20
|
-
crlf: number
|
|
21
|
-
lf: number
|
|
22
|
-
cr: number
|
|
23
|
-
total: number
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Text detection utilities (detect-indent and detect-newline replacements)
|
|
27
|
-
*/
|
|
28
|
-
/**
|
|
29
|
-
* Detect indentation type and amount in a string
|
|
30
|
-
*/
|
|
31
|
-
export declare interface IndentInfo {
|
|
32
|
-
amount: number
|
|
33
|
-
type: 'space' | 'tab' | null
|
|
34
|
-
indent: string
|
|
35
|
-
}
|
package/dist/equal.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deep equality with NaN-safety and cycle detection.
|
|
3
|
-
*
|
|
4
|
-
* - `NaN === NaN` is false in JavaScript, so the previous `Object.is`
|
|
5
|
-
* tail correctly handled that case but only at the leaf — a
|
|
6
|
-
* `[NaN, NaN]` pair compared element-by-element worked, but compound
|
|
7
|
-
* structures relied on the tail. The new shape preserves that.
|
|
8
|
-
* - Circular references used to send isDeepEqual into infinite recursion
|
|
9
|
-
* (`a.self = a; isDeepEqual(a, a)` blew the stack). A WeakSet of
|
|
10
|
-
* already-visited objects breaks the cycle and treats two structurally
|
|
11
|
-
* identical cycles as equal.
|
|
12
|
-
*/
|
|
13
|
-
export declare function isDeepEqual(value1: any, value2: any, seen?: WeakMap<object, object>): boolean;
|
package/dist/errors.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error-handling helpers (stacksjs/stacks#1875 T-1).
|
|
3
|
-
*
|
|
4
|
-
* Background: a `catch (e: any)` block lets you reach `e.message`
|
|
5
|
-
* without a typecheck — but the thrown value isn't guaranteed to be
|
|
6
|
-
* an `Error`. Strings, numbers, plain objects, and even `null` can
|
|
7
|
-
* be thrown. `e.message` on a string returns `undefined`; on `null`
|
|
8
|
-
* it throws TypeError. `${e}` works but loses stack trace info.
|
|
9
|
-
*
|
|
10
|
-
* These helpers let catch blocks type `e` as `unknown` (the safe
|
|
11
|
-
* TypeScript default) and pull a useful string / stack out without
|
|
12
|
-
* branching at every site.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Pull a human-readable message out of an unknown thrown value.
|
|
16
|
-
*
|
|
17
|
-
* Resolution order:
|
|
18
|
-
* 1. `Error.message` — the common case
|
|
19
|
-
* 2. plain-object `.message` — duck-typing for error-like values
|
|
20
|
-
* from across a serialization boundary (HTTP responses, IPC, etc.)
|
|
21
|
-
* 3. `String(e)` — covers strings, numbers, booleans
|
|
22
|
-
* 4. `'Unknown error'` — for `null` / `undefined` thrown values
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* try {
|
|
27
|
-
* await someAsyncOp()
|
|
28
|
-
* }
|
|
29
|
-
* catch (e: unknown) {
|
|
30
|
-
* log.error(`Failed: ${getErrorMessage(e)}`)
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function getErrorMessage(e: unknown): string;
|
|
35
|
-
/**
|
|
36
|
-
* Pull a stack trace out of an unknown thrown value, returning
|
|
37
|
-
* `undefined` when one isn't available. Useful for log enrichment
|
|
38
|
-
* without forcing the caller to narrow `e` first.
|
|
39
|
-
*/
|
|
40
|
-
export declare function getErrorStack(e: unknown): string | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Pull a `.code` string out of an unknown thrown value. Common across
|
|
43
|
-
* AWS SDK errors (`'AlreadyExistsException'`, `'NoSuchEntity'`, …),
|
|
44
|
-
* Node fs errors (`'ENOENT'`, `'EACCES'`, …), and many HTTP-client
|
|
45
|
-
* libraries. Returns `undefined` when the input doesn't carry a
|
|
46
|
-
* string code, so callers can default-handle.
|
|
47
|
-
*/
|
|
48
|
-
export declare function getErrorCode(e: unknown): string | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Pull an HTTP-style status code (`.statusCode` or `.status`) out of an
|
|
51
|
-
* unknown thrown value. AWS SDK errors use `.statusCode`; fetch/Node
|
|
52
|
-
* errors often use `.status`. Returns `undefined` when neither is a
|
|
53
|
-
* finite number — same default-handling pattern as `getErrorCode`.
|
|
54
|
-
*/
|
|
55
|
-
export declare function getErrorStatusCode(e: unknown): number | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Coerce an unknown thrown value into a real `Error`. The thrown
|
|
58
|
-
* value is preserved on `.cause` (ES2022) when the input was a
|
|
59
|
-
* non-Error so debugging tools can still surface it. Idempotent —
|
|
60
|
-
* passing in an Error returns it unchanged.
|
|
61
|
-
*
|
|
62
|
-
* Use this when downstream APIs require an `Error` instance (e.g.
|
|
63
|
-
* tracing SDKs that want `captureException(Error)`).
|
|
64
|
-
*/
|
|
65
|
-
export declare function toError(e: unknown): Error;
|
package/dist/export-size.d.ts
DELETED
package/dist/find.d.ts
DELETED
package/dist/git.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isGitClean(): boolean;
|
package/dist/hash.d.ts
DELETED
package/dist/helpers.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { AddressInfo } from 'node:net';
|
|
2
|
-
import type { CliOptions, Manifest, Subprocess } from '@stacksjs/types';
|
|
3
|
-
import type { NpmScript } from '@stacksjs/enums';
|
|
4
|
-
import type { Result } from '@stacksjs/error-handling';
|
|
5
|
-
// Bun has native YAML support via Bun.YAML
|
|
6
|
-
// import { semver } from './versions'
|
|
7
|
-
export declare function packageManager(): Promise<string>;
|
|
8
|
-
export declare function initProject(): Promise<Result<Subprocess, Error>>;
|
|
9
|
-
export declare function ensureProjectIsInitialized(): Promise<boolean>;
|
|
10
|
-
export declare function installIfVersionMismatch(): Promise<void>;
|
|
11
|
-
export declare function frameworkVersion(): Promise<string>;
|
|
12
|
-
export declare function isAppKeySet(): Promise<boolean>;
|
|
13
|
-
/**
|
|
14
|
-
* Determines the utilized reset preset.
|
|
15
|
-
*
|
|
16
|
-
* @url https://github.com/cwcss/crosswind
|
|
17
|
-
* @param preset
|
|
18
|
-
*/
|
|
19
|
-
export declare function determineResetPreset(preset?: string | null): string[];
|
|
20
|
-
/**
|
|
21
|
-
* Determines whether the specified value is a package manifest.
|
|
22
|
-
*/
|
|
23
|
-
export declare function isManifest(obj: any): obj is Manifest;
|
|
24
|
-
/**
|
|
25
|
-
* Determines whether the specified value is a string, null, or undefined.
|
|
26
|
-
*/
|
|
27
|
-
export declare function isOptionalString(value: any): value is string | null | undefined;
|
|
28
|
-
export declare function setEnvValue(key: string, value: string): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Runs the specified NPM script in the package.json file.
|
|
31
|
-
*/
|
|
32
|
-
export declare function runNpmScript(script: NpmScript, options?: CliOptions): Promise<Result<Subprocess, Error>>;
|
|
33
|
-
/**
|
|
34
|
-
* Determines whether the specified NPM script exists in the given manifest.
|
|
35
|
-
*/
|
|
36
|
-
export declare function hasScript(manifest: Manifest, script: NpmScript): boolean;
|
|
37
|
-
export declare function parseYaml(content: any): any;
|
|
38
|
-
/**
|
|
39
|
-
* Determines the level of debugging.
|
|
40
|
-
*
|
|
41
|
-
* The debug level is determined by the following:
|
|
42
|
-
* 1. The --verbose flag
|
|
43
|
-
* 2. The debug property in the app configuration
|
|
44
|
-
*
|
|
45
|
-
* Currently, we don't support a custom debug level,
|
|
46
|
-
* though, we would like to in the future.
|
|
47
|
-
*
|
|
48
|
-
* @param options
|
|
49
|
-
*/
|
|
50
|
-
export declare function determineDebugLevel(options?: CliOptions): boolean;
|
|
51
|
-
export declare function isIpv6(address: AddressInfo): boolean;
|
|
52
|
-
export declare function dumpYaml(content: any): string;
|
|
53
|
-
export declare function loadYaml(content: string): any;
|
package/dist/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export * from './clean';
|
|
2
|
-
export * from './config';
|
|
3
|
-
export * from './equal';
|
|
4
|
-
export * from './errors';
|
|
5
|
-
export * from './export-size';
|
|
6
|
-
export * from './find';
|
|
7
|
-
export * from './git';
|
|
8
|
-
export * from './hash';
|
|
9
|
-
export * from './helpers';
|
|
10
|
-
export * from './macroable';
|
|
11
|
-
export * from './safe-json';
|
|
12
|
-
export * from './versions';
|
|
13
|
-
export * as browserUtils from '@stacksjs/browser';
|
|
14
|
-
export { clamp, notNullish, retry, useOnline } from '@stacksjs/browser';
|
|
15
|
-
// Native utility replacements
|
|
16
|
-
export * from './merge';
|
|
17
|
-
export * from './detect';
|
|
18
|
-
export * from './debounce';
|
|
19
|
-
export * from './bytes';
|
|
20
|
-
export * from './colors';
|
|
21
|
-
export * from './markdown';
|
|
22
|
-
export * from './size';
|
|
23
|
-
export * from './observer';
|
|
24
|
-
export * from './pipeline';
|
package/dist/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{path as L}from"@stacksjs/path";async function S$(){await Bun.$`rm -rf ${L.projectPath("bun.lock")}`,await Bun.$`rm -rf ${L.projectPath("yarn.lock")}`,await Bun.$`rm -rf ${L.projectPath("node_modules/")}`,await Bun.$`rm -rf ${L.frameworkPath("dist")}`,await Bun.$`rm -rf ${L.frameworkPath("node_modules")}`,await Bun.$`rm -rf ${L.frameworkPath("**/dist")}`,await Bun.$`rm -rf ${L.frameworkPath("**/node_modules")}`,await Bun.$`rm -rf ${L.frameworkCloudPath("cdk.out/")}`,await Bun.$`rm -rf ${L.frameworkCloudPath("cdk.context.json")}`,await Bun.$`rm -rf ${L.cloudPath("dist.zip")}`}import{defineApp as p$,defineCache as g$,defineCdn as b$,defineChat as m$,defineCli as d$,defineDatabase as u$,defineDependencies as c$,defineDns as n$,defineEmail as i$,defineEmailConfig as s$,defineGit as r$,defineHashing as a$,defineLibrary as o$,defineNotification as l$,definePayment as t$,defineQueue as e$,defineSearchEngine as $T,defineServices as TT,defineSms as fT,defineFilesystems as HT,defineUi as QT}from"@stacksjs/config";import{getTypeName as S}from"@stacksjs/types";function v($,T,f=new WeakMap){if($===T)return!0;if(typeof $==="number"&&typeof T==="number"&&Number.isNaN($)&&Number.isNaN(T))return!0;let H=S($),Q=S(T);if(H!==Q)return!1;if($&&typeof $==="object"){if(f.get($)===T)return!0;f.set($,T)}if(H==="array"){if($.length!==T.length)return!1;return $.every((X,_)=>v(X,T[_],f))}if(H==="object"){let X=Object.keys($);if(X.length!==Object.keys(T).length)return!1;return X.every((_)=>v($[_],T[_],f))}return Object.is($,T)}function $$($){if($ instanceof Error)return $.message;if(typeof $==="string")return $;if(typeof $==="number"||typeof $==="boolean")return String($);if($&&typeof $==="object"&&"message"in $&&typeof $.message==="string")return $.message;if($==null)return"Unknown error";try{return String($)}catch{return"Unknown error"}}function qT($){if($ instanceof Error)return $.stack;if($&&typeof $==="object"&&"stack"in $&&typeof $.stack==="string")return $.stack;return}function VT($){if($&&typeof $==="object"&&"code"in $&&typeof $.code==="string")return $.code;return}function _T($){if(!$||typeof $!=="object")return;let T=$;if(typeof T.statusCode==="number"&&Number.isFinite(T.statusCode))return T.statusCode;if(typeof T.status==="number"&&Number.isFinite(T.status))return T.status;return}function PT($){if($ instanceof Error)return $;return Error($$($),{cause:$})}import{stat as T$}from"fs/promises";var C=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],p=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];function I($,T={}){let{precision:f=1,binary:H=!1,space:Q=!0,locale:X="en-US",minimumFractionDigits:_=0,maximumFractionDigits:P=f}=T;if(!Number.isFinite($))throw TypeError(`Expected a finite number, got ${typeof $}: ${$}`);let B=$<0,J=B?"-":"";if(B)$=-$;if($<1){let e=$.toLocaleString(X,{minimumFractionDigits:_,maximumFractionDigits:P});return`${J}${e}${Q?" ":""}B`}let G=H?1024:1000,Y=H?p:C,U=Math.min(Math.floor(Math.log($)/Math.log(G)),Y.length-1),O=($/G**U).toLocaleString(X,{minimumFractionDigits:_,maximumFractionDigits:P}),W=Y[U];return`${J}${O}${Q?" ":""}${W}`}function y($){let T=$.match(/^(-?[\d.]+)\s*([A-Za-z]+)?$/);if(!T)throw Error(`Invalid byte string: ${$}`);let[,f,H="B"]=T;if(f===void 0)throw Error(`Invalid byte string: ${$}`);let Q=Number.parseFloat(f);if(!Number.isFinite(Q))throw Error(`Invalid number in byte string: ${f}`);let X=H.toUpperCase(),_=X.endsWith("IB"),P=_?1024:1000,B=0,J=_?p:C;for(let G=0;G<J.length;G++)if(J[G]?.toUpperCase()===X){B=G;break}return Q*P**B}function GT($,T){let f=typeof $==="string"?y($):$,H=typeof T==="string"?y(T):T;return f-H}var JT=I,UT=I;async function f$($){try{return(await T$($)).size}catch{return 0}}async function H$($){let T=[],f=0;try{let H=await Q$($);for(let Q of H){let X=await f$(Q.path);f+=X,T.push({name:Q.name,size:X,readable:I(X)})}}catch(H){}return{totalSize:f,totalReadable:I(f),exports:T.sort((H,Q)=>Q.size-H.size)}}async function Q$($){let T=[];try{let f=await Bun.$.throws(!1)`find ${$} -type f \\( -name "*.js" -o -name "*.mjs" -o -name "*.cjs" \\)`.text();for(let H of f.split(`
|
|
3
|
-
`).filter(Boolean)){let Q=H.replace($,"").replace(/^\//,"");T.push({name:Q,path:H})}}catch{}return T}function X$($){return Math.floor($*0.3)}function Z$($){return Math.floor($*0.25)}function OT($){if($.exports.length===0)return"No exports found";let T=["Export Sizes:",""],f=Math.max(...$.exports.map((H)=>H.name.length));for(let H of $.exports){let Q=H.name.padEnd(f," ");T.push(` ${Q} ${H.readable}`)}return T.push(""),T.push(`Total: ${$.totalReadable}`),T.push(`Estimated gzipped: ${I(X$($.totalSize))}`),T.push(`Estimated brotli: ${I(Z$($.totalSize))}`),T.join(`
|
|
4
|
-
`)}import g from"fs/promises";import D from"os";import b from"path";import{italic as R}from"@stacksjs/cli";import{log as z}from"@stacksjs/logging";var q$="buddy",m=["node_modules","dist","vendor","storage/framework",/.*out.*/,/.*\/\..*/],V$=[`${D.homedir()}/Documents`,`${D.homedir()}/Pictures`,`${D.homedir()}/Library`,`${D.homedir()}/.Trash`];async function zT($,T){let f=!!$;$=$||D.homedir();let H=f?m:[...m,...V$];if(!T?.quiet)z.info(`Searching for Stacks projects in: ${R($)}`),z.info("This may take a few moments..."),console.log(""),console.log(R(" Please note, while Stacks is searching for projects on your machine,")),console.log(R(" you may be asked for permissions to scan certain directories.")),console.log(""),z.debug(`Excluding directories: ${H.join(", ")}`);let Q=await d($,H);if(!Q)throw Error("No Stacks projects found");return Q}async function d($,T){let f=[];if(T.some((P)=>typeof P==="string"?$.includes(P):P.test($)))return f;let Q;try{Q=await g.readdir($,{withFileTypes:!0})}catch(P){return console.error(`Error reading directory ${$}:`,P),f}let X=!1,_=!1;for(let P of Q){if(P.isFile()&&P.name===q$)X=!0;if(P.isDirectory()){let B=b.join($,P.name);if(P.name==="storage"){let G=b.join(B,"framework/core/buddy");try{await g.access(G),_=!0}catch{}}let J=await d(B,T);f.push(...J)}}if(X&&_)f.push($);return f}import{execSync as _$}from"child_process";import{handleError as P$}from"@stacksjs/error-handling";function hT(){try{return _$("git diff-index --quiet HEAD --"),!0}catch($){return P$($),!1}}import{config as B$}from"@stacksjs/config";import{log as u}from"@stacksjs/logging";import{path as M}from"@stacksjs/path";import{hashPaths as E}from"@stacksjs/storage";function CT(){try{return E(M.cloudPath("src/edge"))}catch($){u.error("Are we in a Docker container? Failed to hash paths. Error below:"),u.error($);return}}function pT(){let $=[M.projectPath("docs"),M.frameworkPath("docs/dist")],T=[M.projectPath("resources/views"),M.projectPath("resources/assets"),M.projectPath("resources/lang"),M.projectPath("resources/functions"),M.projectPath("resources/components"),M.projectPath("resources/modules"),M.projectPath("resources/stores"),M.frameworkPath("views/web")];return B$.app.docMode===!0?E($):E(T)}function gT(){let $=[M.projectPath("docs"),M.frameworkPath("docs/dist")];return E($)}import{runAction as G$}from"@stacksjs/actions";import{log as c,runCommand as J$}from"@stacksjs/cli";import{app as s,ui as n}from"@stacksjs/config";import{Action as U$}from"@stacksjs/enums";import{err as r,handleError as x,ok as Y$}from"@stacksjs/error-handling";import{frameworkPath as h,projectPath as k}from"@stacksjs/path";import{fs as A,readJsonFile as K$,readPackageJson as a,readTextFile as o,writeTextFile as M$}from"@stacksjs/storage";async function rT(){let{packageManager:$}=await a(h("package.json"));return $}async function aT(){if(s.env!=="production")c.info("Project not yet initialized, generating application key...");else x("Please run `buddy key:generate` to generate an application key");let $=await G$(U$.KeyGenerate,{cwd:k()});if($.isErr)return r(x($.error));return c.info("Application key generated."),Y$($.value)}async function oT(){if(A.existsSync(k(".env")))return await i();if(A.existsSync(k(".env.example")))A.copyFileSync(k(".env.example"),k(".env"));else console.error("no .env.example file found");return await i()}async function lT(){}async function tT(){return(await a(h("package.json"))).version}async function i(){let f=(await o(".env",k())).data.split(`
|
|
5
|
-
`).find((H)=>H.startsWith("APP_KEY="));return!!(f&&f.length>16)}function eT($){if($===void 0&&n.reset)$=n.reset;if($===null)return[];let H={tailwind:'import { tailwindPreflight as reset } from "@cwcss/crosswind"',preflight:'import { tailwindPreflight as reset } from "@cwcss/crosswind"',forms:'import { tailwindFormsPreflight as reset } from "@cwcss/crosswind"'}[$??"tailwind"];return H?[H]:[]}function O$($){return $&&typeof $==="object"&&w($.name)&&w($.version)&&w($.description)}function w($){let T=typeof $;return $===null||T==="undefined"||T==="string"}async function $f($,T){let f=await o(k(".env")),H=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Q=new RegExp(`^${H}=.*$`,"m"),X=`${$}=${T}`,_=Q.test(f.data)?f.data.replace(Q,X):`${f.data}${f.data.endsWith(`
|
|
6
|
-
`)?"":`
|
|
7
|
-
`}${X}
|
|
8
|
-
`;await M$({path:k(".env"),data:_})}async function Tf($,T){let{data:f}=await K$("package.json",h());if(O$(f)&&L$(f,$))return await J$(`bun run ${$}`,T);return r(x(`The ${$} script does not exist in the package.json file.`))}function L$($,T){let f=$.scripts;if(f&&typeof f==="object")return Boolean(f[T]);return!1}function ff($){return Bun.YAML.parse($)}function Hf($){if($?.verbose===!0)return!0;return s.debug===!0}function Qf($){return $.family==="IPv6"||$.family===6}function Xf($){let T=Bun.YAML;if(typeof T.stringify==="function")return T.stringify($);return JSON.stringify($,null,2)}function Zf($){return Bun.YAML.parse($)}class k${static macros=new Map;static macro($,T,f=!1){if(this.macros.has($)&&!f)throw Error(`Macro "${$}" is already registered`);this.macros.set($,T),Object.defineProperty(this.prototype,$,{value:T,writable:!0,configurable:!0,enumerable:!1})}static mixin($,T=!0){let f=Object.getOwnPropertyNames($);for(let H of f){if(H==="constructor")continue;if(this.macros.has(H)&&!T)continue;let Q=Object.getOwnPropertyDescriptor($,H);if(Q&&typeof Q.value==="function")this.macro(H,Q.value,T)}}static hasMacro($){return this.macros.has($)}static flushMacros(){for(let $ of this.macros.keys())delete this.prototype[$];this.macros.clear()}static getMacros(){return Array.from(this.macros.keys())}callMacro($,...T){let f=this.constructor.macros.get($);if(!f)throw Error(`Macro "${$}" is not registered`);return f.apply(this,T)}}function Vf($=class{}){return class extends ${static macros=new Map;static macro(T,f,H=!1){if(this.macros.has(T)&&!H)throw Error(`Macro "${T}" is already registered`);this.macros.set(T,f),Object.defineProperty(this.prototype,T,{value:f,writable:!0,configurable:!0,enumerable:!1})}static mixin(T,f=!0){let H=Object.getOwnPropertyNames(T);for(let Q of H){if(Q==="constructor")continue;if(this.macros.has(Q)&&!f)continue;let X=Object.getOwnPropertyDescriptor(T,Q);if(X&&typeof X.value==="function")this.macro(Q,X.value,f)}}static hasMacro(T){return this.macros.has(T)}static flushMacros(){for(let T of this.macros.keys())delete this.prototype[T];this.macros.clear()}static getMacros(){return Array.from(this.macros.keys())}}}function _f($){let T=new Map;return $.macro=function(f,H,Q=!1){if(T.has(f)&&!Q)throw Error(`Macro "${f}" is already registered`);T.set(f,H),Object.defineProperty($.prototype,f,{value:H,writable:!0,configurable:!0,enumerable:!1})},$.mixin=function(f,H=!0){let Q=Object.getOwnPropertyNames(f);for(let X of Q){if(X==="constructor")continue;if(T.has(X)&&!H)continue;let _=Object.getOwnPropertyDescriptor(f,X);if(_&&typeof _.value==="function")$.macro(X,_.value,H)}},$.hasMacro=function(f){return T.has(f)},$.flushMacros=function(){for(let f of T.keys())delete $.prototype[f];T.clear()},$.getMacros=function(){return Array.from(T.keys())},$}function Jf($,T){if(typeof $!=="string"||$.length===0)return T;try{return JSON.parse($)}catch{return T}}function Uf($){if(typeof $!=="string")return{ok:!1,reason:"not-string"};if($.length===0)return{ok:!1,reason:"empty"};try{return{ok:!0,value:JSON.parse($)}}catch(T){return{ok:!1,reason:"malformed",error:T}}}function Yf($,T){let f=new WeakSet;return JSON.stringify($,(H,Q)=>{if(typeof Q==="bigint")return Q.toString();if(Q&&typeof Q==="object"){if(f.has(Q))return"[Circular]";f.add(Q)}return Q},T)}var W$="0.70.87";var Lf=Bun.semver;function kf($,T){return Bun.semver.order($,T)===1}function If($,T){return Bun.semver.order($,T)===-1}function Wf($,T){return Bun.semver.order($,T)===0}function Df($,T){return Bun.semver.order($,T)>=0}function Ef($,T){return Bun.semver.order($,T)<=0}function N(...$){let T={};for(let f of $){if(!f||typeof f!=="object")continue;for(let H in f){let Q=f[H],X=T[H];if(Q===void 0)continue;if(Array.isArray(Q))T[H]=Array.isArray(X)?[...X,...Q]:[...Q];else if(Q&&typeof Q==="object"&&!E$(Q))T[H]=N(X||{},Q);else T[H]=Q}}return T}function Rf($){return(...T)=>{return N($,...T)}}function D$($,...T){return N({},...T,$)}function E$($){if($ instanceof Date)return!0;if($ instanceof RegExp)return!0;if($ instanceof Error)return!0;if($ instanceof Promise)return!0;if($ instanceof Map)return!0;if($ instanceof Set)return!0;if($ instanceof WeakMap)return!0;if($ instanceof WeakSet)return!0;if(ArrayBuffer.isView($))return!0;return!1}var zf=D$,Af=N;function xf($){let T=$.split(`
|
|
9
|
-
`),f=[];for(let P of T){if(!P.trim())continue;let B=P.match(/^(\s+)/);if(B&&B[1]!==void 0)f.push(B[1])}if(f.length===0)return{amount:0,type:null,indent:""};let H=new Map;for(let P of f)H.set(P,(H.get(P)||0)+1);let Q="",X=0;for(let[P,B]of H)if(B>X)X=B,Q=P;if(Q.includes("\t"))return{amount:Q.length,type:"tab",indent:Q};return{amount:Q.length,type:"space",indent:Q}}function N$($){if(!$)return null;if($.includes(`\r
|
|
10
|
-
`))return`\r
|
|
11
|
-
`;if($.includes(`
|
|
12
|
-
`))return`
|
|
13
|
-
`;if($.includes("\r"))return"\r";return null}function hf($,T=`
|
|
14
|
-
`){return N$($)||T}function Ff($,T=`
|
|
15
|
-
`){return $.replace(/\r\n|\r|\n/g,T)}function jf($){let T=($.match(/\r\n/g)||[]).length,f=($.match(/\r(?!\n)/g)||[]).length,H=($.match(/(?<!\r)\n/g)||[]).length;return{crlf:T,lf:H,cr:f,total:T+H+f}}function vf($,T=0,f={}){let{leading:H=!1,trailing:Q=!0}=f,X=null,_=null,P=null,B,J=()=>{if(_)B=$.apply(P,_),_=null,P=null;return B},G=()=>{if(X)clearTimeout(X),X=null;_=null,P=null},Y=()=>{if(X)return clearTimeout(X),X=null,J();return B},U=function(...K){_=K,P=this;let O=H&&!X;if(X)clearTimeout(X);if(X=setTimeout(()=>{if(X=null,Q&&_)J()},T),O)return J();return B};return U.cancel=G,U.flush=Y,U}function yf($,T=0){let f=null,H=0,Q=null,X=null,_=()=>{if(Q)$.apply(X,Q),Q=null,X=null,H=Date.now()},P=()=>{if(f)clearTimeout(f),f=null;Q=null,X=null},B=function(...J){Q=J,X=this;let Y=Date.now()-H;if(Y>=T)_();else if(!f)f=setTimeout(()=>{f=null,_()},T-Y)};return B.cancel=P,B}function Cf($){return new Promise((T)=>setTimeout(T,$))}var Z=!process.env.NO_COLOR&&(process.env.FORCE_COLOR||process.stdout?.isTTY),q={reset:Z?"\x1B[0m":"",black:Z?"\x1B[30m":"",red:Z?"\x1B[31m":"",green:Z?"\x1B[32m":"",yellow:Z?"\x1B[33m":"",blue:Z?"\x1B[34m":"",magenta:Z?"\x1B[35m":"",cyan:Z?"\x1B[36m":"",white:Z?"\x1B[37m":"",gray:Z?"\x1B[90m":"",grey:Z?"\x1B[90m":"",lightRed:Z?"\x1B[91m":"",lightGreen:Z?"\x1B[92m":"",lightYellow:Z?"\x1B[93m":"",lightBlue:Z?"\x1B[94m":"",lightMagenta:Z?"\x1B[95m":"",lightCyan:Z?"\x1B[96m":"",lightGray:Z?"\x1B[37m":"",lightGrey:Z?"\x1B[37m":"",bgBlack:Z?"\x1B[40m":"",bgRed:Z?"\x1B[41m":"",bgGreen:Z?"\x1B[42m":"",bgYellow:Z?"\x1B[43m":"",bgBlue:Z?"\x1B[44m":"",bgMagenta:Z?"\x1B[45m":"",bgCyan:Z?"\x1B[46m":"",bgWhite:Z?"\x1B[47m":"",bgLightRed:Z?"\x1B[101m":"",bgLightGreen:Z?"\x1B[102m":"",bgLightYellow:Z?"\x1B[103m":"",bgLightBlue:Z?"\x1B[104m":"",bgLightMagenta:Z?"\x1B[105m":"",bgLightCyan:Z?"\x1B[106m":"",bold:Z?"\x1B[1m":"",dim:Z?"\x1B[2m":"",italic:Z?"\x1B[3m":"",underline:Z?"\x1B[4m":"",inverse:Z?"\x1B[7m":"",hidden:Z?"\x1B[8m":"",strikethrough:Z?"\x1B[9m":""};function V($,T=q.reset){return(f)=>{if(!Z)return String(f);return`${$}${f}${T}`}}var gf=V(q.black),bf=V(q.red),mf=V(q.green),df=V(q.yellow),uf=V(q.blue),cf=V(q.magenta),nf=V(q.cyan),sf=V(q.white),R$=V(q.gray),rf=R$,af=V(q.lightRed),of=V(q.lightGreen),lf=V(q.lightYellow),tf=V(q.lightBlue),ef=V(q.lightMagenta),$0=V(q.lightCyan),z$=V(q.lightGray),T0=z$,f0=V(q.bgBlack),H0=V(q.bgRed),Q0=V(q.bgGreen),X0=V(q.bgYellow),Z0=V(q.bgBlue),q0=V(q.bgMagenta),V0=V(q.bgCyan),_0=V(q.bgWhite),P0=V(q.bgLightRed),B0=V(q.bgLightGreen),G0=V(q.bgLightYellow),J0=V(q.bgLightBlue),U0=V(q.bgLightMagenta),Y0=V(q.bgLightCyan),K0=V(q.bold),M0=V(q.dim),O0=V(q.italic),L0=V(q.underline),k0=V(q.inverse),I0=V(q.hidden),W0=V(q.strikethrough),D0=V(q.reset,"");function E0($){return $.replace(/\x1B\[\d+m/g,"")}function N0(){return!!Z}function A$($,T={}){let{align:f=[],padding:H=!0,delimiter:Q="|",delimiterStart:X=!0,delimiterEnd:_=!0,alignDelimiter:P="-"}=T;if(!$||$.length===0)return"";let B=$.map((U)=>U.map((K)=>{if(K===null||K===void 0)return"";return String(K)})),J=Math.max(...B.map((U)=>U.length)),G=Array.from({length:J}).fill(0);for(let U of B)for(let K=0;K<U.length;K++){let O=U[K]?.length??0;if(O>(G[K]??0))G[K]=O}let Y=[];if(B.length>0){let U=B[0]??[];Y.push(F(U,G,H,Q,X,_));let K=G.map((O,W)=>{let j=x$(f[W]);return w$(O,j,P)});Y.push(F(K,G,H,Q,X,_));for(let O=1;O<B.length;O++){let W=B[O]??[];Y.push(F(W,G,H,Q,X,_))}}return Y.join(`
|
|
16
|
-
`)}function F($,T,f,H,Q,X){let _=$.map((J,G)=>{let Y=T[G]??0;return J.padEnd(Y," ")}),P=f?" ":"",B=_.map((J)=>`${P}${J}${P}`).join(H);if(Q)B=H+B;if(X)B=B+H;return B}function w$($,T,f){let H=T==="center"?3:T?2:1;if($<H)$=H;let Q=f.repeat($);if(T==="left")Q=`:${Q.slice(1)}`;else if(T==="right")Q=Q.slice(0,-1)+":";else if(T==="center")Q=`:${Q.slice(2)}:`;return Q}function x$($){if(!$)return null;switch($){case"l":case"left":return"left";case"c":case"center":return"center";case"r":case"right":return"right";default:return null}}function z0($,T={}){if(!$||$.length===0)return"";let f=Array.from(new Set($.flatMap((Q)=>Object.keys(Q)))),H=[f,...$.map((Q)=>f.map((X)=>Q[X]))];return A$(H,T)}function h$(){return typeof window<"u"&&"ResizeObserver"in window}function l(){if(h$())return window.ResizeObserver;return class{callback;observedElements=new Set;rafId=null;constructor(T){this.callback=T}observe(T){if(!this.observedElements.has(T))this.observedElements.add(T),this.scheduleCheck()}unobserve(T){if(this.observedElements.delete(T),this.observedElements.size===0&&this.rafId!==null)(typeof cancelAnimationFrame<"u"?cancelAnimationFrame:clearTimeout)(this.rafId),this.rafId=null}disconnect(){if(this.observedElements.clear(),this.rafId!==null)(typeof cancelAnimationFrame<"u"?cancelAnimationFrame:clearTimeout)(this.rafId),this.rafId=null}scheduleCheck(){if(this.rafId!==null)return;let T=typeof requestAnimationFrame<"u"?requestAnimationFrame:setTimeout;this.rafId=T(()=>{if(this.check(),this.rafId=null,this.observedElements.size>0)this.scheduleCheck()})}check(){let T=[];for(let f of this.observedElements){let H=f.getBoundingClientRect(),Q={target:f,contentRect:H,borderBoxSize:[{inlineSize:H.width,blockSize:H.height}],contentBoxSize:[{inlineSize:H.width,blockSize:H.height}],devicePixelContentBoxSize:[{inlineSize:H.width,blockSize:H.height}]};T.push(Q)}if(T.length>0)this.callback(T,this)}}}function F$($,T){let H=new(l())($),Q=Array.isArray(T)?T:[T];for(let X of Q)H.observe(X);return()=>{H.disconnect()}}function w0($,T){return F$((f)=>{let H=f.find((Q)=>Q.target===$);if(H)T(H)},$)}var x0=l();class t{passable;pipes=[];method="handle";static send($){let T=new t;return T.passable=$,T}through($){return this.pipes=$,this}pipe(...$){return this.pipes.push(...$),this}via($){return this.method=$,this}then($){return this.pipes.reduceRight((f,H)=>{return(Q)=>{if(typeof H==="function")return H(Q,f);let X=H[this.method];if(typeof X==="function")return X.call(H,Q,f);return f(Q)}},$)(this.passable)}thenReturn(){return this.then(($)=>$)}}export{df as yellow,sf as white,pT as websiteSourceHash,W$ as version,l0 as useOnline,L0 as underline,PT as toError,yf as throttle,N0 as supportsColor,E0 as stripColors,W0 as strikethrough,$f as setEnvValue,Lf as semver,Yf as safeJsonStringify,Uf as safeJsonParseResult,Jf as safeJsonParse,Tf as runNpmScript,o0 as retry,D0 as reset,bf as red,UT as readableSize,JT as prettyBytes,ff as parseYaml,y as parseBytes,rT as packageManager,CT as originRequestFunctionHash,w0 as observeElementSize,a0 as notNullish,Ff as normalizeNewlines,D$ as mergeDefaults,N as merge,z0 as markdownTableFromObjects,A$ as markdownTable,cf as magenta,_f as macroable,Zf as loadYaml,lf as lightYellow,af as lightRed,ef as lightMagenta,T0 as lightGrey,of as lightGreen,z$ as lightGray,$0 as lightCyan,tf as lightBlue,O0 as italic,Ef as isVersionLessThanOrEqual,If as isVersionLessThan,Df as isVersionGreaterThanOrEqual,kf as isVersionGreaterThan,Wf as isVersionEqual,h$ as isResizeObserverSupported,w as isOptionalString,O$ as isManifest,Qf as isIpv6,hT as isGitClean,v as isDeepEqual,i as isAppKeySet,k0 as inverse,lT as installIfVersionMismatch,aT as initProject,I0 as hidden,L$ as hasScript,rf as grey,mf as green,R$ as gray,l as getResizeObserver,f$ as getFileSize,H$ as getExportsSize,_T as getErrorStatusCode,qT as getErrorStack,$$ as getErrorMessage,VT as getErrorCode,tT as frameworkVersion,OT as formatExportSizes,I as formatBytes,zT as findStacksProjects,X$ as estimateGzipSize,Z$ as estimateBrotliSize,oT as ensureProjectIsInitialized,Xf as dumpYaml,gT as docsSourceHash,M0 as dim,eT as determineResetPreset,Hf as determineDebugLevel,hf as detectNewlineGraceful,N$ as detectNewline,xf as detectIndent,Cf as delay,Af as defuArrayFn,zf as defu,QT as defineUi,fT as defineSms,TT as defineServices,$T as defineSearchEngine,e$ as defineQueue,t$ as definePayment,l$ as defineNotification,o$ as defineLibrary,a$ as defineHashing,r$ as defineGit,HT as defineFilesystems,s$ as defineEmailConfig,i$ as defineEmail,n$ as defineDns,c$ as defineDependencies,u$ as defineDatabase,d$ as defineCli,m$ as defineChat,b$ as defineCdn,g$ as defineCache,p$ as defineApp,vf as debounce,nf as cyan,F$ as createResizeObserver,Rf as createMerger,Vf as createMacroable,jf as countNewlines,GT as compareBytes,S$ as cleanProject,r0 as clamp,i0 as browserUtils,K0 as bold,uf as blue,gf as black,X0 as bgYellow,_0 as bgWhite,H0 as bgRed,q0 as bgMagenta,G0 as bgLightYellow,P0 as bgLightRed,U0 as bgLightMagenta,B0 as bgLightGreen,Y0 as bgLightCyan,J0 as bgLightBlue,Q0 as bgGreen,V0 as bgCyan,Z0 as bgBlue,f0 as bgBlack,x0 as ResizeObserver,t as Pipeline,k$ as Macroable};
|
package/dist/macroable.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a macroable class
|
|
3
|
-
*/
|
|
4
|
-
export declare function createMacroable<T extends new (..._args: any[]) => any>(BaseClass?: T): T & MacroableConstructor;
|
|
5
|
-
/**
|
|
6
|
-
* Mixin for adding macroable functionality to existing classes
|
|
7
|
-
*/
|
|
8
|
-
export declare function macroable<T extends new (..._args: any[]) => any>(target: T): T & MacroableConstructor;
|
|
9
|
-
/**
|
|
10
|
-
* Native Macroable implementation
|
|
11
|
-
* Inspired by Laravel's Macroable trait - allows adding methods dynamically to classes
|
|
12
|
-
*/
|
|
13
|
-
export declare interface MacroableConstructor {
|
|
14
|
-
new (...args: any[]): any
|
|
15
|
-
macro(name: string, fn: Function, replace?: boolean): void
|
|
16
|
-
mixin(obj: Record<string, any>, replace?: boolean): void
|
|
17
|
-
hasMacro(name: string): boolean
|
|
18
|
-
flushMacros(): void
|
|
19
|
-
getMacros(): string[]
|
|
20
|
-
}
|
|
21
|
-
export declare class Macroable {
|
|
22
|
-
static macro(name: string, fn: Function, replace?: boolean): void;
|
|
23
|
-
static mixin(obj: Record<string, any>, replace?: boolean): void;
|
|
24
|
-
static hasMacro(name: string): boolean;
|
|
25
|
-
static flushMacros(): void;
|
|
26
|
-
static getMacros(): string[];
|
|
27
|
-
protected callMacro(name: string, ...args: any[]): any;
|
|
28
|
-
}
|
package/dist/markdown.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate a markdown table from a 2D array
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```ts
|
|
6
|
-
* const table = markdownTable([
|
|
7
|
-
* ['Name', 'Age', 'City'],
|
|
8
|
-
* ['Alice', 30, 'NYC'],
|
|
9
|
-
* ['Bob', 25, 'LA']
|
|
10
|
-
* ])
|
|
11
|
-
* // | Name | Age | City |
|
|
12
|
-
* // | ----- | --- | ---- |
|
|
13
|
-
* // | Alice | 30 | NYC |
|
|
14
|
-
* // | Bob | 25 | LA |
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare function markdownTable(table: Table, options?: MarkdownTableOptions): string;
|
|
18
|
-
/**
|
|
19
|
-
* Create a markdown table from objects
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* const data = [
|
|
24
|
-
* { name: 'Alice', age: 30 },
|
|
25
|
-
* { name: 'Bob', age: 25 }
|
|
26
|
-
* ]
|
|
27
|
-
* const table = markdownTableFromObjects(data)
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare function markdownTableFromObjects<T extends Record<string, any>>(objects: T[], options?: MarkdownTableOptions): string;
|
|
31
|
-
/**
|
|
32
|
-
* Markdown table generation (markdown-table replacement)
|
|
33
|
-
*/
|
|
34
|
-
export declare interface MarkdownTableOptions {
|
|
35
|
-
align?: Array<'l' | 'c' | 'r' | 'left' | 'center' | 'right' | null>
|
|
36
|
-
padding?: boolean
|
|
37
|
-
delimiter?: string
|
|
38
|
-
delimiterStart?: boolean
|
|
39
|
-
delimiterEnd?: boolean
|
|
40
|
-
alignDelimiter?: string
|
|
41
|
-
}
|
|
42
|
-
declare type CellValue = string | number | boolean | null | undefined;
|
|
43
|
-
declare type Row = CellValue[];
|
|
44
|
-
declare type Table = Row[];
|
|
45
|
-
// Alias
|
|
46
|
-
export { markdownTable as default };
|
package/dist/merge.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare function merge<T extends Record<string, any>>(...objects: DeepPartial<T>[]): T;
|
|
2
|
-
/**
|
|
3
|
-
* Create a merger function with defaults (defu-like API)
|
|
4
|
-
*/
|
|
5
|
-
export declare function createMerger<T extends Record<string, any>>(defaults: T): void;
|
|
6
|
-
/**
|
|
7
|
-
* Merge with defaults (defu API)
|
|
8
|
-
*/
|
|
9
|
-
export declare function mergeDefaults<T extends Record<string, any>>(obj: DeepPartial<T>, ...defaults: DeepPartial<T>[]): T;
|
|
10
|
-
// Aliases for defu compatibility
|
|
11
|
-
export declare const defu: unknown;
|
|
12
|
-
export declare const defuArrayFn: unknown;
|
|
13
|
-
/**
|
|
14
|
-
* Deep merge objects (defu replacement)
|
|
15
|
-
*
|
|
16
|
-
* Merges multiple objects together, with later objects taking precedence.
|
|
17
|
-
* Arrays are concatenated, objects are recursively merged.
|
|
18
|
-
*/
|
|
19
|
-
declare type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]> } : T;
|
|
20
|
-
export { merge as default };
|
package/dist/observer.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check if ResizeObserver is supported natively
|
|
3
|
-
*/
|
|
4
|
-
export declare function isResizeObserverSupported(): boolean;
|
|
5
|
-
/**
|
|
6
|
-
* Get ResizeObserver (native or polyfill)
|
|
7
|
-
*
|
|
8
|
-
* Modern browsers all support ResizeObserver, but this provides a fallback
|
|
9
|
-
*/
|
|
10
|
-
export declare function getResizeObserver(): any;
|
|
11
|
-
/**
|
|
12
|
-
* Create a resize observer with automatic cleanup
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* const cleanup = createResizeObserver((entries) => {
|
|
17
|
-
* for (const entry of entries) {
|
|
18
|
-
* console.log('Element resized:', entry.target)
|
|
19
|
-
* }
|
|
20
|
-
* }, element)
|
|
21
|
-
*
|
|
22
|
-
* // Later, clean up
|
|
23
|
-
* cleanup()
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export declare function createResizeObserver(callback: ResizeObserverCallback, target: Element | Element[]): () => void;
|
|
27
|
-
/**
|
|
28
|
-
* Observe element size changes
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```ts
|
|
32
|
-
* const stop = observeElementSize(element, (entry) => {
|
|
33
|
-
* console.log('Size:', entry.contentRect.width, entry.contentRect.height)
|
|
34
|
-
* })
|
|
35
|
-
*
|
|
36
|
-
* // Stop observing
|
|
37
|
-
* stop()
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare function observeElementSize(element: Element, callback: (entry: ResizeObserverEntry) => void): () => void;
|
|
41
|
-
// Export the native ResizeObserver if available, or the polyfill
|
|
42
|
-
export declare const ResizeObserver: any;
|
|
43
|
-
/**
|
|
44
|
-
* ResizeObserver polyfill (resize-observer-polyfill replacement)
|
|
45
|
-
*
|
|
46
|
-
* Note: Modern browsers all support ResizeObserver natively now.
|
|
47
|
-
* This provides a simple fallback for older browsers.
|
|
48
|
-
*/
|
|
49
|
-
export declare interface ResizeObserverSize {
|
|
50
|
-
readonly inlineSize: number
|
|
51
|
-
readonly blockSize: number
|
|
52
|
-
}
|
|
53
|
-
export declare interface ResizeObserverEntry {
|
|
54
|
-
readonly target: Element
|
|
55
|
-
readonly contentRect: DOMRectReadOnly
|
|
56
|
-
readonly borderBoxSize: ReadonlyArray<ResizeObserverSize>
|
|
57
|
-
readonly contentBoxSize: ReadonlyArray<ResizeObserverSize>
|
|
58
|
-
readonly devicePixelContentBoxSize: ReadonlyArray<ResizeObserverSize>
|
|
59
|
-
}
|
|
60
|
-
export type ResizeObserverCallback = (
|
|
61
|
-
entries: ResizeObserverEntry[],
|
|
62
|
-
observer: ResizeObserver,
|
|
63
|
-
) => void;
|
|
64
|
-
export default ResizeObserver;
|
package/dist/pipeline.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare interface PipeClass<T> {
|
|
2
|
-
handle: PipeFunction<T>
|
|
3
|
-
}
|
|
4
|
-
declare type PipeFunction<T> = (data: T, next: (data: T) => T) => T;
|
|
5
|
-
declare type Pipe<T> = PipeFunction<T> | PipeClass<T>;
|
|
6
|
-
export declare class Pipeline<T> {
|
|
7
|
-
static send<T>(passable: T): Pipeline<T>;
|
|
8
|
-
through(pipes: Pipe<T>[]): this;
|
|
9
|
-
pipe(...pipes: Pipe<T>[]): this;
|
|
10
|
-
via(method: string): this;
|
|
11
|
-
then(destination: (data: T) => T): T;
|
|
12
|
-
thenReturn(): T;
|
|
13
|
-
}
|
package/dist/safe-json.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse `text` as JSON, returning `defaultValue` (default: `undefined`)
|
|
3
|
-
* when the input isn't valid JSON.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* const config = safeJsonParse<Config>(rawText, { mode: 'default' })
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare function safeJsonParse<T = unknown>(text: unknown, defaultValue?: T): T | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Result-flavored variant: surfaces *why* a parse failed when callers
|
|
13
|
-
* want to log the difference between "empty input" and "malformed input".
|
|
14
|
-
*/
|
|
15
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
16
|
-
export declare function safeJsonParseResult<T = unknown>(text: unknown): { ok: true, value: T } | { ok: false, reason: 'not-string' | 'empty' | 'malformed', error?: unknown };
|
|
17
|
-
/**
|
|
18
|
-
* Stringify with cycle and bigint safety.
|
|
19
|
-
*
|
|
20
|
-
* `JSON.stringify` throws on circular refs (rare but real, e.g. logger
|
|
21
|
-
* captures of an Express-style req object) and on bigint values (common
|
|
22
|
-
* with database IDs that overflow Number). This wrapper substitutes
|
|
23
|
-
* `[Circular]` for cycles and converts bigints to strings — same shape
|
|
24
|
-
* downstream consumers expect from a "best-effort serialize this for
|
|
25
|
-
* logs" call.
|
|
26
|
-
*/
|
|
27
|
-
export declare function safeJsonStringify(value: unknown, space?: number): string;
|
|
28
|
-
/**
|
|
29
|
-
* Safe JSON wrappers.
|
|
30
|
-
*
|
|
31
|
-
* Bare `JSON.parse(s)` throws `SyntaxError` on malformed input —
|
|
32
|
-
* which 90% of the time is exactly what you want, except in:
|
|
33
|
-
*
|
|
34
|
-
* - Webhook handlers: a malformed payload should produce a 400, not crash
|
|
35
|
-
* - Cache reads: a corrupt cache entry should miss, not throw
|
|
36
|
-
* - Log readers: a bad line should be skipped, not stop the parser
|
|
37
|
-
* - User-supplied config: a typo should produce a clear "X is invalid" error
|
|
38
|
-
*
|
|
39
|
-
* `safeJsonParse` returns `undefined` for malformed input (or a typed
|
|
40
|
-
* default), so call sites don't need a try/catch ladder around every
|
|
41
|
-
* untrusted input. `safeJsonParseResult` returns a discriminated union
|
|
42
|
-
* for cases where the failure reason matters.
|
|
43
|
-
*/
|
|
44
|
-
export type JsonValue = | string
|
|
45
|
-
| number
|
|
46
|
-
| boolean
|
|
47
|
-
| null
|
|
48
|
-
| JsonValue[]
|
|
49
|
-
| { [key: string]: JsonValue }
|
package/dist/size.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the size of a file
|
|
3
|
-
*/
|
|
4
|
-
export declare function getFileSize(filePath: string): Promise<number>;
|
|
5
|
-
/**
|
|
6
|
-
* Get sizes of all exports in a package
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const sizes = await getExportsSize('./dist')
|
|
11
|
-
* console.log(sizes.totalReadable) // "42.5 KB"
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare function getExportsSize(distPath: string): Promise<PackageExportsSizeResult>;
|
|
15
|
-
/**
|
|
16
|
-
* Get gzipped size estimate
|
|
17
|
-
*/
|
|
18
|
-
export declare function estimateGzipSize(size: number): number;
|
|
19
|
-
/**
|
|
20
|
-
* Get brotli size estimate
|
|
21
|
-
*/
|
|
22
|
-
export declare function estimateBrotliSize(size: number): number;
|
|
23
|
-
/**
|
|
24
|
-
* Format export sizes as a table
|
|
25
|
-
*/
|
|
26
|
-
export declare function formatExportSizes(result: PackageExportsSizeResult): string;
|
|
27
|
-
export declare interface ExportSize {
|
|
28
|
-
name: string
|
|
29
|
-
size: number
|
|
30
|
-
readable: string
|
|
31
|
-
}
|
|
32
|
-
export declare interface PackageExportsSizeResult {
|
|
33
|
-
totalSize: number
|
|
34
|
-
totalReadable: string
|
|
35
|
-
exports: ExportSize[]
|
|
36
|
-
}
|
|
37
|
-
export { getExportsSize as default };
|
package/dist/versions.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { version } from '../package.json';
|
|
2
|
-
export declare function isVersionGreaterThan(version: string, compareVersion: string): boolean;
|
|
3
|
-
export declare function isVersionLessThan(version: string, compareVersion: string): boolean;
|
|
4
|
-
export declare function isVersionEqual(version: string, compareVersion: string): boolean;
|
|
5
|
-
export declare function isVersionGreaterThanOrEqual(version: string, compareVersion: string): boolean;
|
|
6
|
-
export declare function isVersionLessThanOrEqual(version: string, compareVersion: string): boolean;
|
|
7
|
-
export declare const semver: typeof Bun.semver;
|
|
8
|
-
export { version };
|