@adriangalilea/utils 0.7.0 → 0.8.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/README.md +1 -5
- package/dist/bot/access-control.d.ts +91 -58
- package/dist/bot/access-control.d.ts.map +1 -1
- package/dist/bot/access-control.js +105 -75
- package/dist/bot/access-control.js.map +1 -1
- package/dist/bot/index.d.ts +3 -0
- package/dist/bot/index.d.ts.map +1 -1
- package/dist/bot/index.js +3 -0
- package/dist/bot/index.js.map +1 -1
- package/dist/bot/kit.d.ts.map +1 -1
- package/dist/bot/kit.js +6 -0
- package/dist/bot/kit.js.map +1 -1
- package/dist/bot/language.d.ts +279 -0
- package/dist/bot/language.d.ts.map +1 -0
- package/dist/bot/language.js +222 -0
- package/dist/bot/language.js.map +1 -0
- package/dist/bot/menu.d.ts +175 -0
- package/dist/bot/menu.d.ts.map +1 -0
- package/dist/bot/menu.js +284 -0
- package/dist/bot/menu.js.map +1 -0
- package/dist/bot/message-history.d.ts +259 -0
- package/dist/bot/message-history.d.ts.map +1 -0
- package/dist/bot/message-history.js +111 -0
- package/dist/bot/message-history.js.map +1 -0
- package/package.json +13 -1
- package/dist/currency/crypto-symbols-data.d.ts +0 -10
- package/dist/currency/crypto-symbols-data.d.ts.map +0 -1
- package/dist/currency/crypto-symbols-data.js +0 -13765
- package/dist/currency/crypto-symbols-data.js.map +0 -1
- package/dist/currency/crypto-symbols.d.ts +0 -20
- package/dist/currency/crypto-symbols.d.ts.map +0 -1
- package/dist/currency/crypto-symbols.js +0 -23
- package/dist/currency/crypto-symbols.js.map +0 -1
- package/dist/currency/download-crypto-list.d.ts +0 -10
- package/dist/currency/download-crypto-list.d.ts.map +0 -1
- package/dist/currency/download-crypto-list.js +0 -69
- package/dist/currency/download-crypto-list.js.map +0 -1
- package/dist/currency/index.d.ts +0 -84
- package/dist/currency/index.d.ts.map +0 -1
- package/dist/currency/index.js +0 -230
- package/dist/currency/index.js.map +0 -1
- package/dist/dir.d.ts +0 -40
- package/dist/dir.d.ts.map +0 -1
- package/dist/dir.js +0 -108
- package/dist/dir.js.map +0 -1
- package/dist/file.d.ts +0 -53
- package/dist/file.d.ts.map +0 -1
- package/dist/file.js +0 -211
- package/dist/file.js.map +0 -1
- package/dist/format.d.ts +0 -40
- package/dist/format.d.ts.map +0 -1
- package/dist/format.js +0 -83
- package/dist/format.js.map +0 -1
- package/dist/kev.d.ts +0 -149
- package/dist/kev.d.ts.map +0 -1
- package/dist/kev.js +0 -761
- package/dist/kev.js.map +0 -1
- package/dist/log.d.ts +0 -91
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -300
- package/dist/log.js.map +0 -1
- package/dist/logger.d.ts +0 -91
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -269
- package/dist/logger.js.map +0 -1
- package/dist/path.d.ts +0 -67
- package/dist/path.d.ts.map +0 -1
- package/dist/path.js +0 -107
- package/dist/path.js.map +0 -1
- package/dist/project.d.ts +0 -35
- package/dist/project.d.ts.map +0 -1
- package/dist/project.js +0 -154
- package/dist/project.js.map +0 -1
package/dist/logger.js
DELETED
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A Next.js-style logger for TypeScript applications
|
|
3
|
-
* Provides colored output with Unicode symbols for different log levels
|
|
4
|
-
*/
|
|
5
|
-
// ANSI escape codes for colors
|
|
6
|
-
const ANSI = {
|
|
7
|
-
reset: '\x1b[0m',
|
|
8
|
-
bold: '\x1b[1m',
|
|
9
|
-
dim: '\x1b[2m',
|
|
10
|
-
// Foreground colors
|
|
11
|
-
black: '\x1b[30m',
|
|
12
|
-
red: '\x1b[31m',
|
|
13
|
-
green: '\x1b[32m',
|
|
14
|
-
yellow: '\x1b[33m',
|
|
15
|
-
blue: '\x1b[34m',
|
|
16
|
-
magenta: '\x1b[35m',
|
|
17
|
-
cyan: '\x1b[36m',
|
|
18
|
-
white: '\x1b[37m',
|
|
19
|
-
gray: '\x1b[90m',
|
|
20
|
-
// Custom purple (Next.js style)
|
|
21
|
-
purple: '\x1b[38;2;173;127;168m',
|
|
22
|
-
// Background colors
|
|
23
|
-
bgRed: '\x1b[41m',
|
|
24
|
-
bgGreen: '\x1b[42m',
|
|
25
|
-
bgYellow: '\x1b[43m',
|
|
26
|
-
bgBlue: '\x1b[44m',
|
|
27
|
-
bgMagenta: '\x1b[45m',
|
|
28
|
-
bgCyan: '\x1b[46m',
|
|
29
|
-
bgWhite: '\x1b[47m',
|
|
30
|
-
};
|
|
31
|
-
// Detect if colors should be enabled
|
|
32
|
-
const isColorEnabled = () => {
|
|
33
|
-
const env = process.env;
|
|
34
|
-
if (env.NO_COLOR)
|
|
35
|
-
return false;
|
|
36
|
-
if (env.FORCE_COLOR)
|
|
37
|
-
return true;
|
|
38
|
-
return process.stdout?.isTTY && !env.CI && env.TERM !== 'dumb';
|
|
39
|
-
};
|
|
40
|
-
const colorEnabled = isColorEnabled();
|
|
41
|
-
// Color formatter function
|
|
42
|
-
const formatter = (open, close = ANSI.reset) => {
|
|
43
|
-
if (!colorEnabled)
|
|
44
|
-
return (str) => str;
|
|
45
|
-
return (str) => `${open}${str}${close}`;
|
|
46
|
-
};
|
|
47
|
-
// Text styling functions
|
|
48
|
-
export const bold = formatter(ANSI.bold);
|
|
49
|
-
export const dim = formatter(ANSI.dim);
|
|
50
|
-
export const red = formatter(ANSI.red);
|
|
51
|
-
export const green = formatter(ANSI.green);
|
|
52
|
-
export const yellow = formatter(ANSI.yellow);
|
|
53
|
-
export const blue = formatter(ANSI.blue);
|
|
54
|
-
export const magenta = formatter(ANSI.magenta);
|
|
55
|
-
export const cyan = formatter(ANSI.cyan);
|
|
56
|
-
export const white = formatter(ANSI.white);
|
|
57
|
-
export const gray = formatter(ANSI.gray);
|
|
58
|
-
export const purple = formatter(ANSI.purple);
|
|
59
|
-
// Background colors
|
|
60
|
-
export const bgRed = formatter(ANSI.bgRed);
|
|
61
|
-
export const bgGreen = formatter(ANSI.bgGreen);
|
|
62
|
-
export const bgYellow = formatter(ANSI.bgYellow);
|
|
63
|
-
export const bgBlue = formatter(ANSI.bgBlue);
|
|
64
|
-
export const bgMagenta = formatter(ANSI.bgMagenta);
|
|
65
|
-
export const bgCyan = formatter(ANSI.bgCyan);
|
|
66
|
-
export const bgWhite = formatter(ANSI.bgWhite);
|
|
67
|
-
// Prefix symbols matching Next.js style
|
|
68
|
-
const prefixes = {
|
|
69
|
-
wait: white(bold('○')),
|
|
70
|
-
error: red(bold('⨯')),
|
|
71
|
-
warn: yellow(bold('⚠')),
|
|
72
|
-
ready: '▶',
|
|
73
|
-
info: white(bold(' ')),
|
|
74
|
-
success: green(bold('✓')),
|
|
75
|
-
event: green(bold('✓')),
|
|
76
|
-
trace: magenta(bold('»')),
|
|
77
|
-
};
|
|
78
|
-
// LRU Cache for warn-once functionality
|
|
79
|
-
class LRUCache {
|
|
80
|
-
cache = new Map();
|
|
81
|
-
maxSize;
|
|
82
|
-
constructor(maxSize) {
|
|
83
|
-
this.maxSize = maxSize;
|
|
84
|
-
}
|
|
85
|
-
get(key) {
|
|
86
|
-
const item = this.cache.get(key);
|
|
87
|
-
if (item !== undefined) {
|
|
88
|
-
// Move to end (most recently used)
|
|
89
|
-
this.cache.delete(key);
|
|
90
|
-
this.cache.set(key, item);
|
|
91
|
-
}
|
|
92
|
-
return item;
|
|
93
|
-
}
|
|
94
|
-
set(key, value) {
|
|
95
|
-
if (this.cache.has(key)) {
|
|
96
|
-
this.cache.delete(key);
|
|
97
|
-
}
|
|
98
|
-
this.cache.set(key, value);
|
|
99
|
-
if (this.cache.size > this.maxSize) {
|
|
100
|
-
// Remove least recently used (first item)
|
|
101
|
-
const firstKey = this.cache.keys().next().value;
|
|
102
|
-
if (firstKey !== undefined) {
|
|
103
|
-
this.cache.delete(firstKey);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
has(key) {
|
|
108
|
-
return this.cache.has(key);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const warnOnceCache = new LRUCache(10_000);
|
|
112
|
-
// Core logging function
|
|
113
|
-
function prefixedLog(level, ...messages) {
|
|
114
|
-
// Remove empty first message
|
|
115
|
-
if ((messages[0] === '' || messages[0] === undefined) && messages.length === 1) {
|
|
116
|
-
messages.shift();
|
|
117
|
-
}
|
|
118
|
-
// Determine console method based on level
|
|
119
|
-
const consoleMethod = level === 'error' ? 'error' : level === 'warn' ? 'warn' : 'log';
|
|
120
|
-
const prefix = prefixes[level];
|
|
121
|
-
// Handle empty messages
|
|
122
|
-
if (messages.length === 0) {
|
|
123
|
-
console[consoleMethod]('');
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
// Format and log the message
|
|
127
|
-
if (messages.length === 1 && typeof messages[0] === 'string') {
|
|
128
|
-
console[consoleMethod](` ${prefix} ${messages[0]}`);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
console[consoleMethod](` ${prefix}`, ...messages);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
// Bootstrap function for startup messages (no prefix, just indentation)
|
|
135
|
-
export function bootstrap(...messages) {
|
|
136
|
-
console.log(' ' + messages.join(' '));
|
|
137
|
-
}
|
|
138
|
-
// Main logging functions
|
|
139
|
-
export function wait(...messages) {
|
|
140
|
-
prefixedLog('wait', ...messages);
|
|
141
|
-
}
|
|
142
|
-
export function error(...messages) {
|
|
143
|
-
prefixedLog('error', ...messages);
|
|
144
|
-
}
|
|
145
|
-
export function warn(...messages) {
|
|
146
|
-
prefixedLog('warn', ...messages);
|
|
147
|
-
}
|
|
148
|
-
export function ready(...messages) {
|
|
149
|
-
prefixedLog('ready', ...messages);
|
|
150
|
-
}
|
|
151
|
-
export function info(...messages) {
|
|
152
|
-
prefixedLog('info', ...messages);
|
|
153
|
-
}
|
|
154
|
-
export function success(...messages) {
|
|
155
|
-
prefixedLog('success', ...messages);
|
|
156
|
-
}
|
|
157
|
-
export function event(...messages) {
|
|
158
|
-
prefixedLog('event', ...messages);
|
|
159
|
-
}
|
|
160
|
-
export function trace(...messages) {
|
|
161
|
-
prefixedLog('trace', ...messages);
|
|
162
|
-
}
|
|
163
|
-
// Special warn-once function
|
|
164
|
-
export function warnOnce(...messages) {
|
|
165
|
-
const key = messages.join(' ');
|
|
166
|
-
if (!warnOnceCache.has(key)) {
|
|
167
|
-
warnOnceCache.set(key, true);
|
|
168
|
-
warn(...messages);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
// Timer functionality for measuring durations
|
|
172
|
-
const timers = new Map();
|
|
173
|
-
export function time(label) {
|
|
174
|
-
timers.set(label, Date.now());
|
|
175
|
-
}
|
|
176
|
-
export function timeEnd(label) {
|
|
177
|
-
const start = timers.get(label);
|
|
178
|
-
if (start === undefined) {
|
|
179
|
-
warn(`Timer '${label}' does not exist`);
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
const duration = Date.now() - start;
|
|
183
|
-
timers.delete(label);
|
|
184
|
-
const formatted = duration > 10000
|
|
185
|
-
? `${Math.round(duration / 100) / 10}s`
|
|
186
|
-
: `${Math.round(duration)}ms`;
|
|
187
|
-
trace(`${label}: ${formatted}`);
|
|
188
|
-
}
|
|
189
|
-
// Utility function to create a prefixed logger instance
|
|
190
|
-
export function createLogger(prefix) {
|
|
191
|
-
return {
|
|
192
|
-
wait: (...messages) => wait(`[${prefix}]`, ...messages),
|
|
193
|
-
error: (...messages) => error(`[${prefix}]`, ...messages),
|
|
194
|
-
warn: (...messages) => warn(`[${prefix}]`, ...messages),
|
|
195
|
-
ready: (...messages) => ready(`[${prefix}]`, ...messages),
|
|
196
|
-
info: (...messages) => info(`[${prefix}]`, ...messages),
|
|
197
|
-
success: (...messages) => success(`[${prefix}]`, ...messages),
|
|
198
|
-
event: (...messages) => event(`[${prefix}]`, ...messages),
|
|
199
|
-
trace: (...messages) => trace(`[${prefix}]`, ...messages),
|
|
200
|
-
warnOnce: (...messages) => warnOnce(`[${prefix}]`, ...messages),
|
|
201
|
-
time: (label) => time(`${prefix}:${label}`),
|
|
202
|
-
timeEnd: (label) => timeEnd(`${prefix}:${label}`),
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
// Export a default logger instance
|
|
206
|
-
const logger = {
|
|
207
|
-
wait,
|
|
208
|
-
error,
|
|
209
|
-
warn,
|
|
210
|
-
ready,
|
|
211
|
-
info,
|
|
212
|
-
success,
|
|
213
|
-
event,
|
|
214
|
-
trace,
|
|
215
|
-
warnOnce,
|
|
216
|
-
time,
|
|
217
|
-
timeEnd,
|
|
218
|
-
bootstrap,
|
|
219
|
-
createLogger,
|
|
220
|
-
// Color utilities
|
|
221
|
-
colors: {
|
|
222
|
-
bold,
|
|
223
|
-
dim,
|
|
224
|
-
red,
|
|
225
|
-
green,
|
|
226
|
-
yellow,
|
|
227
|
-
blue,
|
|
228
|
-
magenta,
|
|
229
|
-
cyan,
|
|
230
|
-
white,
|
|
231
|
-
gray,
|
|
232
|
-
purple,
|
|
233
|
-
bgRed,
|
|
234
|
-
bgGreen,
|
|
235
|
-
bgYellow,
|
|
236
|
-
bgBlue,
|
|
237
|
-
bgMagenta,
|
|
238
|
-
bgCyan,
|
|
239
|
-
bgWhite,
|
|
240
|
-
},
|
|
241
|
-
};
|
|
242
|
-
export default logger;
|
|
243
|
-
// Example usage helper
|
|
244
|
-
export function logAppStartup(options) {
|
|
245
|
-
const { name, version, port, host = 'localhost', environment } = options;
|
|
246
|
-
bootstrap(bold(purple(`▶ ${name} ${version}`)));
|
|
247
|
-
bootstrap(`- Local: http://${host}:${port}`);
|
|
248
|
-
if (host !== 'localhost') {
|
|
249
|
-
bootstrap(`- Network: http://${getNetworkAddress()}:${port}`);
|
|
250
|
-
}
|
|
251
|
-
if (environment) {
|
|
252
|
-
bootstrap(`- Environment: ${environment}`);
|
|
253
|
-
}
|
|
254
|
-
info('');
|
|
255
|
-
}
|
|
256
|
-
// Helper to get network address
|
|
257
|
-
function getNetworkAddress() {
|
|
258
|
-
const os = require('os');
|
|
259
|
-
const interfaces = os.networkInterfaces();
|
|
260
|
-
for (const name of Object.keys(interfaces)) {
|
|
261
|
-
for (const iface of interfaces[name]) {
|
|
262
|
-
if (iface.family === 'IPv4' && !iface.internal) {
|
|
263
|
-
return iface.address;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
return 'localhost';
|
|
268
|
-
}
|
|
269
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+BAA+B;AAC/B,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IAEd,oBAAoB;IACpB,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,UAAU;IAEhB,gCAAgC;IAChC,MAAM,EAAE,wBAAwB;IAEhC,oBAAoB;IACpB,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,UAAU;IAClB,SAAS,EAAE,UAAU;IACrB,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,UAAU;CACX,CAAA;AAEV,qCAAqC;AACrC,MAAM,cAAc,GAAG,GAAY,EAAE;IACnC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,IAAI,GAAG,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC9B,IAAI,GAAG,CAAC,WAAW;QAAE,OAAO,IAAI,CAAA;IAChC,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,IAAI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AE,IAAI,GAAG,WAAW,EAAE,WAAW,EAAE,GAAG,OAAO,CAAA;IAExE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;IAC/C,SAAS,CAAC,0BAA0B,IAAI,IAAI,IAAI,EAAE,CAAC,CAAA;IAEnD,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QACzB,SAAS,CAAC,0BAA0B,iBAAiB,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;IACpE,CAAC;IAED,IAAI,WAAW,EAAE,CAAC;QAChB,SAAS,CAAC,mBAAmB,WAAW,EAAE,CAAC,CAAA;IAC7C,CAAC;IAED,IAAI,CAAC,EAAE,CAAC,CAAA;AACV,CAAC;AAED,gCAAgC;AAChC,SAAS,iBAAiB;IACxB,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACxB,MAAM,UAAU,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAA;IAEzC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3C,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,IAAI,CAAE,EAAE,CAAC;YACtC,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;gBAC/C,OAAO,KAAK,CAAC,OAAO,CAAA;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAA;AACpB,CAAC"}
|
package/dist/path.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Path utilities for consistent path handling across the library
|
|
3
|
-
*/
|
|
4
|
-
declare class PathOps {
|
|
5
|
-
/**
|
|
6
|
-
* Resolve a path relative to the calling module
|
|
7
|
-
* Pass import.meta.url as the second parameter to resolve relative to your module
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* // In some module, resolve a file relative to that module:
|
|
11
|
-
* const configPath = path.resolve('./config.json', import.meta.url)
|
|
12
|
-
*/
|
|
13
|
-
resolve(targetPath: string, baseUrl?: string): string;
|
|
14
|
-
/**
|
|
15
|
-
* Join path segments
|
|
16
|
-
*/
|
|
17
|
-
join(...segments: string[]): string;
|
|
18
|
-
/**
|
|
19
|
-
* Get the directory name of a path
|
|
20
|
-
*/
|
|
21
|
-
dirname(p: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Get the base name of a path
|
|
24
|
-
*/
|
|
25
|
-
basename(p: string, ext?: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Get the extension of a path
|
|
28
|
-
*/
|
|
29
|
-
extname(p: string): string;
|
|
30
|
-
/**
|
|
31
|
-
* Parse a path into its components
|
|
32
|
-
*/
|
|
33
|
-
parse(p: string): {
|
|
34
|
-
root: string;
|
|
35
|
-
dir: string;
|
|
36
|
-
base: string;
|
|
37
|
-
ext: string;
|
|
38
|
-
name: string;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Check if a path is absolute
|
|
42
|
-
*/
|
|
43
|
-
isAbsolute(p: string): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Get the relative path from one path to another
|
|
46
|
-
*/
|
|
47
|
-
relative(from: string, to: string): string;
|
|
48
|
-
/**
|
|
49
|
-
* Convert a file:// URL to a path
|
|
50
|
-
*/
|
|
51
|
-
fromFileUrl(url: string): string;
|
|
52
|
-
/**
|
|
53
|
-
* Get the directory from a file:// URL
|
|
54
|
-
*/
|
|
55
|
-
dirnameFromUrl(url: string): string;
|
|
56
|
-
/**
|
|
57
|
-
* Resolve to absolute path
|
|
58
|
-
*/
|
|
59
|
-
absolute(...segments: string[]): string;
|
|
60
|
-
/**
|
|
61
|
-
* Get current working directory
|
|
62
|
-
*/
|
|
63
|
-
cwd(): string;
|
|
64
|
-
}
|
|
65
|
-
export declare const path: PathOps;
|
|
66
|
-
export {};
|
|
67
|
-
//# sourceMappingURL=path.d.ts.map
|
package/dist/path.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,cAAM,OAAO;IACX;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IAwBrD;;OAEG;IACH,IAAI,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM;IAInC;;OAEG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAI1B;;OAEG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM;IAIzC;;OAEG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAI1B;;OAEG;IACH,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG;QAChB,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;QACX,IAAI,EAAE,MAAM,CAAA;KACb;IAID;;OAEG;IACH,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAI9B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM;IAI1C;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAOhC;;OAEG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAInC;;OAEG;IACH,QAAQ,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM;IAIvC;;OAEG;IACH,GAAG,IAAI,MAAM;CAGd;AAED,eAAO,MAAM,IAAI,SAAgB,CAAA"}
|
package/dist/path.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from 'url';
|
|
2
|
-
import { dirname, join, resolve, isAbsolute, relative, basename, extname, parse } from 'path';
|
|
3
|
-
/**
|
|
4
|
-
* Path utilities for consistent path handling across the library
|
|
5
|
-
*/
|
|
6
|
-
class PathOps {
|
|
7
|
-
/**
|
|
8
|
-
* Resolve a path relative to the calling module
|
|
9
|
-
* Pass import.meta.url as the second parameter to resolve relative to your module
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* // In some module, resolve a file relative to that module:
|
|
13
|
-
* const configPath = path.resolve('./config.json', import.meta.url)
|
|
14
|
-
*/
|
|
15
|
-
resolve(targetPath, baseUrl) {
|
|
16
|
-
// If absolute path, return as-is
|
|
17
|
-
if (isAbsolute(targetPath)) {
|
|
18
|
-
return targetPath;
|
|
19
|
-
}
|
|
20
|
-
// If we have a base URL (import.meta.url), resolve relative to it
|
|
21
|
-
if (baseUrl) {
|
|
22
|
-
if (baseUrl.startsWith('file://')) {
|
|
23
|
-
const basePath = fileURLToPath(baseUrl);
|
|
24
|
-
const baseDir = dirname(basePath);
|
|
25
|
-
return join(baseDir, targetPath);
|
|
26
|
-
}
|
|
27
|
-
// If baseUrl is a regular path, use it as base directory
|
|
28
|
-
if (isAbsolute(baseUrl)) {
|
|
29
|
-
const baseDir = dirname(baseUrl);
|
|
30
|
-
return join(baseDir, targetPath);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
// Default to resolving from current working directory
|
|
34
|
-
return resolve(process.cwd(), targetPath);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Join path segments
|
|
38
|
-
*/
|
|
39
|
-
join(...segments) {
|
|
40
|
-
return join(...segments);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Get the directory name of a path
|
|
44
|
-
*/
|
|
45
|
-
dirname(p) {
|
|
46
|
-
return dirname(p);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Get the base name of a path
|
|
50
|
-
*/
|
|
51
|
-
basename(p, ext) {
|
|
52
|
-
return basename(p, ext);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Get the extension of a path
|
|
56
|
-
*/
|
|
57
|
-
extname(p) {
|
|
58
|
-
return extname(p);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Parse a path into its components
|
|
62
|
-
*/
|
|
63
|
-
parse(p) {
|
|
64
|
-
return parse(p);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Check if a path is absolute
|
|
68
|
-
*/
|
|
69
|
-
isAbsolute(p) {
|
|
70
|
-
return isAbsolute(p);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get the relative path from one path to another
|
|
74
|
-
*/
|
|
75
|
-
relative(from, to) {
|
|
76
|
-
return relative(from, to);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Convert a file:// URL to a path
|
|
80
|
-
*/
|
|
81
|
-
fromFileUrl(url) {
|
|
82
|
-
if (url.startsWith('file://')) {
|
|
83
|
-
return fileURLToPath(url);
|
|
84
|
-
}
|
|
85
|
-
return url;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Get the directory from a file:// URL
|
|
89
|
-
*/
|
|
90
|
-
dirnameFromUrl(url) {
|
|
91
|
-
return dirname(this.fromFileUrl(url));
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Resolve to absolute path
|
|
95
|
-
*/
|
|
96
|
-
absolute(...segments) {
|
|
97
|
-
return resolve(...segments);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Get current working directory
|
|
101
|
-
*/
|
|
102
|
-
cwd() {
|
|
103
|
-
return process.cwd();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
export const path = new PathOps();
|
|
107
|
-
//# sourceMappingURL=path.js.map
|
package/dist/path.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources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Q,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,CAAS;QACf,OAAO,OAAO,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,CAAS;QAOb,OAAO,KAAK,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,CAAS;QAClB,OAAO,UAAU,CAAC,CAAC,CAAC,CAAA;IACtB,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,IAAY,EAAE,EAAU;QAC/B,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IAC3B,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,GAAW;QACrB,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,OAAO,aAAa,CAAC,GAAG,CAAC,CAAA;QAC3B,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,GAAW;QACxB,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;IACvC,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,GAAG,QAAkB;QAC5B,OAAO,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAA;IAC7B,CAAC;IAED;;OAEG;IACH,GAAG;QACD,OAAO,OAAO,CAAC,GAAG,EAAE,CAAA;IACtB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,OAAO,EAAE,CAAA"}
|
package/dist/project.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Find project root by walking up from current directory looking for project markers.
|
|
3
|
-
* Checks for: package.json, tsconfig.json, .git, deno.json
|
|
4
|
-
*/
|
|
5
|
-
export declare function findProjectRoot(): string;
|
|
6
|
-
/**
|
|
7
|
-
* Find project root from a specific directory
|
|
8
|
-
*/
|
|
9
|
-
export declare function findProjectRootFrom(startDir: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Find monorepo root by walking up looking for turborepo markers.
|
|
12
|
-
* Checks for: turbo.json, pnpm-workspace.yaml, lerna.json
|
|
13
|
-
*/
|
|
14
|
-
export declare function findMonorepoRoot(): string;
|
|
15
|
-
/**
|
|
16
|
-
* Find monorepo root from a specific directory
|
|
17
|
-
*/
|
|
18
|
-
export declare function findMonorepoRootFrom(startDir: string): string;
|
|
19
|
-
/**
|
|
20
|
-
* Get the nearest package.json data
|
|
21
|
-
*/
|
|
22
|
-
export declare function getPackageJson(): any | null;
|
|
23
|
-
/**
|
|
24
|
-
* Check if current project is a TypeScript project
|
|
25
|
-
*/
|
|
26
|
-
export declare function isTypeScriptProject(): boolean;
|
|
27
|
-
export declare const project: {
|
|
28
|
-
findProjectRoot: typeof findProjectRoot;
|
|
29
|
-
findProjectRootFrom: typeof findProjectRootFrom;
|
|
30
|
-
findMonorepoRoot: typeof findMonorepoRoot;
|
|
31
|
-
findMonorepoRootFrom: typeof findMonorepoRootFrom;
|
|
32
|
-
getPackageJson: typeof getPackageJson;
|
|
33
|
-
isTypeScriptProject: typeof isTypeScriptProject;
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=project.d.ts.map
|
package/dist/project.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAiC5D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAGzC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA+C7D;AAkBD;;GAEG;AACH,wBAAgB,cAAc,IAAI,GAAG,GAAG,IAAI,CAY3C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAe7C;AAED,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAA"}
|
package/dist/project.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { file } from './file.js';
|
|
2
|
-
import { dir } from './dir.js';
|
|
3
|
-
import { path } from './path.js';
|
|
4
|
-
/**
|
|
5
|
-
* Find project root by walking up from current directory looking for project markers.
|
|
6
|
-
* Checks for: package.json, tsconfig.json, .git, deno.json
|
|
7
|
-
*/
|
|
8
|
-
export function findProjectRoot() {
|
|
9
|
-
const cwd = process.cwd();
|
|
10
|
-
return findProjectRootFrom(cwd);
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Find project root from a specific directory
|
|
14
|
-
*/
|
|
15
|
-
export function findProjectRootFrom(startDir) {
|
|
16
|
-
let currentDir = startDir;
|
|
17
|
-
while (true) {
|
|
18
|
-
// Check for TypeScript/JavaScript project markers
|
|
19
|
-
if (file.exists(path.join(currentDir, 'package.json'))) {
|
|
20
|
-
return currentDir;
|
|
21
|
-
}
|
|
22
|
-
if (file.exists(path.join(currentDir, 'tsconfig.json'))) {
|
|
23
|
-
return currentDir;
|
|
24
|
-
}
|
|
25
|
-
if (dir.exists(path.join(currentDir, '.git'))) {
|
|
26
|
-
return currentDir;
|
|
27
|
-
}
|
|
28
|
-
if (file.exists(path.join(currentDir, 'deno.json'))) {
|
|
29
|
-
return currentDir;
|
|
30
|
-
}
|
|
31
|
-
if (file.exists(path.join(currentDir, 'deno.jsonc'))) {
|
|
32
|
-
return currentDir;
|
|
33
|
-
}
|
|
34
|
-
// Move up one directory
|
|
35
|
-
const parent = path.dirname(currentDir);
|
|
36
|
-
// Stop at filesystem root
|
|
37
|
-
if (parent === currentDir) {
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
currentDir = parent;
|
|
41
|
-
}
|
|
42
|
-
return '';
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Find monorepo root by walking up looking for turborepo markers.
|
|
46
|
-
* Checks for: turbo.json, pnpm-workspace.yaml, lerna.json
|
|
47
|
-
*/
|
|
48
|
-
export function findMonorepoRoot() {
|
|
49
|
-
const cwd = process.cwd();
|
|
50
|
-
return findMonorepoRootFrom(cwd);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Find monorepo root from a specific directory
|
|
54
|
-
*/
|
|
55
|
-
export function findMonorepoRootFrom(startDir) {
|
|
56
|
-
let currentDir = startDir;
|
|
57
|
-
while (true) {
|
|
58
|
-
// Check for turbo.json (turborepo)
|
|
59
|
-
const turboPath = path.join(currentDir, 'turbo.json');
|
|
60
|
-
if (file.exists(turboPath)) {
|
|
61
|
-
if (isTurboRepo(turboPath)) {
|
|
62
|
-
return currentDir;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// Check for pnpm workspace
|
|
66
|
-
if (file.exists(path.join(currentDir, 'pnpm-workspace.yaml'))) {
|
|
67
|
-
return currentDir;
|
|
68
|
-
}
|
|
69
|
-
// Check for lerna
|
|
70
|
-
if (file.exists(path.join(currentDir, 'lerna.json'))) {
|
|
71
|
-
return currentDir;
|
|
72
|
-
}
|
|
73
|
-
// Check for npm/yarn workspaces (package.json with workspaces field)
|
|
74
|
-
const pkgPath = path.join(currentDir, 'package.json');
|
|
75
|
-
if (file.exists(pkgPath)) {
|
|
76
|
-
try {
|
|
77
|
-
const pkg = JSON.parse(file.readText(pkgPath));
|
|
78
|
-
if (pkg.workspaces) {
|
|
79
|
-
return currentDir;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
// Not a valid package.json, continue
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
// Move up one directory
|
|
87
|
-
const parent = path.dirname(currentDir);
|
|
88
|
-
// Stop at filesystem root
|
|
89
|
-
if (parent === currentDir) {
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
currentDir = parent;
|
|
93
|
-
}
|
|
94
|
-
return '';
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Check if a turbo.json file is a valid turborepo config
|
|
98
|
-
*/
|
|
99
|
-
function isTurboRepo(turboJsonPath) {
|
|
100
|
-
try {
|
|
101
|
-
const content = file.readText(turboJsonPath);
|
|
102
|
-
const config = JSON.parse(content);
|
|
103
|
-
// Check for turborepo-specific fields
|
|
104
|
-
// A valid turbo.json should have "pipeline" or "tasks" field
|
|
105
|
-
return 'pipeline' in config || 'tasks' in config;
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Get the nearest package.json data
|
|
113
|
-
*/
|
|
114
|
-
export function getPackageJson() {
|
|
115
|
-
const root = findProjectRoot();
|
|
116
|
-
if (!root)
|
|
117
|
-
return null;
|
|
118
|
-
const pkgPath = path.join(root, 'package.json');
|
|
119
|
-
if (!file.exists(pkgPath))
|
|
120
|
-
return null;
|
|
121
|
-
try {
|
|
122
|
-
return JSON.parse(file.readText(pkgPath));
|
|
123
|
-
}
|
|
124
|
-
catch {
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Check if current project is a TypeScript project
|
|
130
|
-
*/
|
|
131
|
-
export function isTypeScriptProject() {
|
|
132
|
-
const root = findProjectRoot();
|
|
133
|
-
if (!root)
|
|
134
|
-
return false;
|
|
135
|
-
// Check for tsconfig.json
|
|
136
|
-
if (file.exists(path.join(root, 'tsconfig.json')))
|
|
137
|
-
return true;
|
|
138
|
-
// Check for TypeScript in dependencies
|
|
139
|
-
const pkg = getPackageJson();
|
|
140
|
-
if (pkg) {
|
|
141
|
-
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
142
|
-
return 'typescript' in deps;
|
|
143
|
-
}
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
export const project = {
|
|
147
|
-
findProjectRoot,
|
|
148
|
-
findProjectRootFrom,
|
|
149
|
-
findMonorepoRoot,
|
|
150
|
-
findMonorepoRootFrom,
|
|
151
|
-
getPackageJson,
|
|
152
|
-
isTypeScriptProject,
|
|
153
|
-
};
|
|
154
|
-
//# sourceMappingURL=project.js.map
|
package/dist/project.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IACzB,OAAO,mBAAmB,CAAC,GAAG,CAAC,CAAA;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IAClD,IAAI,UAAU,GAAG,QAAQ,CAAA;IAEzB,OAAO,IAAI,EAAE,CAAC;QACZ,kDAAkD;QAClD,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;YACvD,OAAO,UAAU,CAAA;QACnB,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC;YACxD,OAAO,UAAU,CAAA;QACnB,CAAC;QACD,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;YAC9C,OAAO,UAAU,CAAA;QACnB,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC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