@easbot/utils 0.3.4 → 0.3.7
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/chunks/chunk-6HZ7Q7NO.mjs +2 -0
- package/dist/chunks/chunk-6JM5F6FM.cjs +2 -0
- package/dist/chunks/chunk-A2TCSTSM.cjs +5 -0
- package/dist/chunks/chunk-JQNKLHWT.cjs +20 -0
- package/dist/chunks/chunk-LBWRSUJC.mjs +20 -0
- package/dist/chunks/chunk-T3MZ3YS3.mjs +5 -0
- package/dist/chunks/{filesystem-OYOMZ7F3.cjs → filesystem-HQDKXRWJ.cjs} +1 -1
- package/dist/chunks/filesystem-XE6UYBAE.mjs +1 -0
- package/dist/chunks/{registry-DPBQYUUX.cjs → registry-BGNK5LJC.cjs} +1 -1
- package/dist/chunks/registry-NQR4SFLJ.mjs +1 -0
- package/dist/chunks/shell-PXZK5BNW.mjs +1 -0
- package/dist/chunks/shell-RJBXISIH.cjs +1 -0
- package/dist/index.cjs +52 -69
- package/dist/index.d.cts +20 -9
- package/dist/index.d.ts +20 -9
- package/dist/index.mjs +52 -69
- package/package.json +4 -3
- package/dist/chunks/chunk-2ISW3RDH.mjs +0 -1
- package/dist/chunks/chunk-DJ7NLT2Q.mjs +0 -5
- package/dist/chunks/chunk-YPKMFQLR.cjs +0 -1
- package/dist/chunks/chunk-ZHSHEAQD.cjs +0 -5
- package/dist/chunks/filesystem-KGIAOOG5.mjs +0 -1
- package/dist/chunks/registry-36YLLEJU.mjs +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -454,11 +454,9 @@ declare class IgnoreInstance {
|
|
|
454
454
|
private parseRule;
|
|
455
455
|
ignores(pathname: string, isDirectory?: boolean): boolean;
|
|
456
456
|
private checkIgnore;
|
|
457
|
+
private matchPath;
|
|
457
458
|
filter(pathnames: readonly string[]): string[];
|
|
458
459
|
createFilter(): (pathname: string) => boolean;
|
|
459
|
-
private patternToRegex;
|
|
460
|
-
private escapeRegexChar;
|
|
461
|
-
private findMatchingBracket;
|
|
462
460
|
private normalizePath;
|
|
463
461
|
}
|
|
464
462
|
|
|
@@ -473,7 +471,12 @@ declare namespace Fn {
|
|
|
473
471
|
const fn: typeof createFn;
|
|
474
472
|
}
|
|
475
473
|
|
|
476
|
-
|
|
474
|
+
interface LoadEnvOptions {
|
|
475
|
+
globalConfigPath?: string;
|
|
476
|
+
projectRoot?: string;
|
|
477
|
+
isDevelopment?: boolean;
|
|
478
|
+
}
|
|
479
|
+
declare function loadEnv(options?: LoadEnvOptions): void;
|
|
477
480
|
|
|
478
481
|
interface GitResult {
|
|
479
482
|
exitCode: number;
|
|
@@ -1251,6 +1254,10 @@ declare namespace Keybind {
|
|
|
1251
1254
|
}
|
|
1252
1255
|
|
|
1253
1256
|
declare namespace Locale {
|
|
1257
|
+
const SUPPORTED_LANGS: readonly ["zh-CN", "en-US"];
|
|
1258
|
+
type Lang = (typeof SUPPORTED_LANGS)[number];
|
|
1259
|
+
const DEFAULT_LANG: Lang;
|
|
1260
|
+
function resolveLocaleLang(override?: string, envKey?: string): Lang;
|
|
1254
1261
|
function titlecase(str: string): string;
|
|
1255
1262
|
function time(input: number): string;
|
|
1256
1263
|
function datetime(input: number): string;
|
|
@@ -1261,6 +1268,10 @@ declare namespace Locale {
|
|
|
1261
1268
|
function truncateMiddle(str: string, maxLength?: number): string;
|
|
1262
1269
|
function pluralize(count: number, singular: string, plural: string): string;
|
|
1263
1270
|
}
|
|
1271
|
+
declare const resolveLocaleLang: typeof Locale.resolveLocaleLang;
|
|
1272
|
+
declare const SUPPORTED_LANGS: readonly ["zh-CN", "en-US"];
|
|
1273
|
+
declare const DEFAULT_LANG: "en-US" | "zh-CN";
|
|
1274
|
+
type Lang = Locale.Lang;
|
|
1264
1275
|
|
|
1265
1276
|
declare namespace Lock {
|
|
1266
1277
|
function read(key: string): Promise<Disposable>;
|
|
@@ -1310,11 +1321,11 @@ declare function updateSchema<T extends z.ZodRawShape>(schema: z.ZodObject<T>):
|
|
|
1310
1321
|
|
|
1311
1322
|
declare namespace Wildcard {
|
|
1312
1323
|
function match(str: string, pattern: string): boolean;
|
|
1313
|
-
function all(input: string, patterns: Record<string,
|
|
1314
|
-
function allStructured(input: {
|
|
1324
|
+
function all<T = unknown>(input: string, patterns: Record<string, T>): T | undefined;
|
|
1325
|
+
function allStructured<T = unknown>(input: {
|
|
1315
1326
|
head: string;
|
|
1316
1327
|
tail: string[];
|
|
1317
|
-
}, patterns: Record<string,
|
|
1328
|
+
}, patterns: Record<string, T>): T | undefined;
|
|
1318
1329
|
}
|
|
1319
1330
|
|
|
1320
1331
|
declare namespace Log {
|
|
@@ -1352,7 +1363,7 @@ declare namespace Log {
|
|
|
1352
1363
|
const Default: Logger;
|
|
1353
1364
|
interface Options {
|
|
1354
1365
|
print: boolean;
|
|
1355
|
-
logDir
|
|
1366
|
+
logDir?: string;
|
|
1356
1367
|
logFile?: string;
|
|
1357
1368
|
dev?: boolean;
|
|
1358
1369
|
level?: Level;
|
|
@@ -1363,4 +1374,4 @@ declare namespace Log {
|
|
|
1363
1374
|
function create(tags?: Record<string, any>): Logger;
|
|
1364
1375
|
}
|
|
1365
1376
|
|
|
1366
|
-
export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Fetch, type FetchResponse, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, Log, MIME_TYPES, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type ProxyOptions, type RPCMethod, type RenderLink, type RenderOptions, type RequestOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, SessionTitle, Shell, Slug, type StreamHandler, type StyleMarker, type TimezoneDateParts, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, addMinutesInTimezone, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatLogTimeMs, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getProxyConfig, getProxyUrl, getTimezoneOffset, getTimezoneParts, git, iife, isSafeFenceBreak, isValidTimezone, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, normalizeTimezone, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
|
|
1377
|
+
export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, DEFAULT_LANG, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Fetch, type FetchResponse, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, type Lang, Lazy, Locale, Lock, Log, MIME_TYPES, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type ProxyOptions, type RPCMethod, type RenderLink, type RenderOptions, type RequestOptions, type RouteDefinition, type SSEHandler, SUPPORTED_LANGS, Semver, type ServerOptions, SessionTitle, Shell, Slug, type StreamHandler, type StyleMarker, type TimezoneDateParts, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, addMinutesInTimezone, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatLogTimeMs, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getProxyConfig, getProxyUrl, getTimezoneOffset, getTimezoneParts, git, iife, isSafeFenceBreak, isValidTimezone, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, normalizeTimezone, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, resolveLocaleLang, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
|
package/dist/index.d.ts
CHANGED
|
@@ -454,11 +454,9 @@ declare class IgnoreInstance {
|
|
|
454
454
|
private parseRule;
|
|
455
455
|
ignores(pathname: string, isDirectory?: boolean): boolean;
|
|
456
456
|
private checkIgnore;
|
|
457
|
+
private matchPath;
|
|
457
458
|
filter(pathnames: readonly string[]): string[];
|
|
458
459
|
createFilter(): (pathname: string) => boolean;
|
|
459
|
-
private patternToRegex;
|
|
460
|
-
private escapeRegexChar;
|
|
461
|
-
private findMatchingBracket;
|
|
462
460
|
private normalizePath;
|
|
463
461
|
}
|
|
464
462
|
|
|
@@ -473,7 +471,12 @@ declare namespace Fn {
|
|
|
473
471
|
const fn: typeof createFn;
|
|
474
472
|
}
|
|
475
473
|
|
|
476
|
-
|
|
474
|
+
interface LoadEnvOptions {
|
|
475
|
+
globalConfigPath?: string;
|
|
476
|
+
projectRoot?: string;
|
|
477
|
+
isDevelopment?: boolean;
|
|
478
|
+
}
|
|
479
|
+
declare function loadEnv(options?: LoadEnvOptions): void;
|
|
477
480
|
|
|
478
481
|
interface GitResult {
|
|
479
482
|
exitCode: number;
|
|
@@ -1251,6 +1254,10 @@ declare namespace Keybind {
|
|
|
1251
1254
|
}
|
|
1252
1255
|
|
|
1253
1256
|
declare namespace Locale {
|
|
1257
|
+
const SUPPORTED_LANGS: readonly ["zh-CN", "en-US"];
|
|
1258
|
+
type Lang = (typeof SUPPORTED_LANGS)[number];
|
|
1259
|
+
const DEFAULT_LANG: Lang;
|
|
1260
|
+
function resolveLocaleLang(override?: string, envKey?: string): Lang;
|
|
1254
1261
|
function titlecase(str: string): string;
|
|
1255
1262
|
function time(input: number): string;
|
|
1256
1263
|
function datetime(input: number): string;
|
|
@@ -1261,6 +1268,10 @@ declare namespace Locale {
|
|
|
1261
1268
|
function truncateMiddle(str: string, maxLength?: number): string;
|
|
1262
1269
|
function pluralize(count: number, singular: string, plural: string): string;
|
|
1263
1270
|
}
|
|
1271
|
+
declare const resolveLocaleLang: typeof Locale.resolveLocaleLang;
|
|
1272
|
+
declare const SUPPORTED_LANGS: readonly ["zh-CN", "en-US"];
|
|
1273
|
+
declare const DEFAULT_LANG: "en-US" | "zh-CN";
|
|
1274
|
+
type Lang = Locale.Lang;
|
|
1264
1275
|
|
|
1265
1276
|
declare namespace Lock {
|
|
1266
1277
|
function read(key: string): Promise<Disposable>;
|
|
@@ -1310,11 +1321,11 @@ declare function updateSchema<T extends z.ZodRawShape>(schema: z.ZodObject<T>):
|
|
|
1310
1321
|
|
|
1311
1322
|
declare namespace Wildcard {
|
|
1312
1323
|
function match(str: string, pattern: string): boolean;
|
|
1313
|
-
function all(input: string, patterns: Record<string,
|
|
1314
|
-
function allStructured(input: {
|
|
1324
|
+
function all<T = unknown>(input: string, patterns: Record<string, T>): T | undefined;
|
|
1325
|
+
function allStructured<T = unknown>(input: {
|
|
1315
1326
|
head: string;
|
|
1316
1327
|
tail: string[];
|
|
1317
|
-
}, patterns: Record<string,
|
|
1328
|
+
}, patterns: Record<string, T>): T | undefined;
|
|
1318
1329
|
}
|
|
1319
1330
|
|
|
1320
1331
|
declare namespace Log {
|
|
@@ -1352,7 +1363,7 @@ declare namespace Log {
|
|
|
1352
1363
|
const Default: Logger;
|
|
1353
1364
|
interface Options {
|
|
1354
1365
|
print: boolean;
|
|
1355
|
-
logDir
|
|
1366
|
+
logDir?: string;
|
|
1356
1367
|
logFile?: string;
|
|
1357
1368
|
dev?: boolean;
|
|
1358
1369
|
level?: Level;
|
|
@@ -1363,4 +1374,4 @@ declare namespace Log {
|
|
|
1363
1374
|
function create(tags?: Record<string, any>): Logger;
|
|
1364
1375
|
}
|
|
1365
1376
|
|
|
1366
|
-
export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Fetch, type FetchResponse, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, Log, MIME_TYPES, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type ProxyOptions, type RPCMethod, type RenderLink, type RenderOptions, type RequestOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, SessionTitle, Shell, Slug, type StreamHandler, type StyleMarker, type TimezoneDateParts, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, addMinutesInTimezone, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatLogTimeMs, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getProxyConfig, getProxyUrl, getTimezoneOffset, getTimezoneParts, git, iife, isSafeFenceBreak, isValidTimezone, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, normalizeTimezone, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
|
|
1377
|
+
export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, DEFAULT_LANG, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Fetch, type FetchResponse, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, type Lang, Lazy, Locale, Lock, Log, MIME_TYPES, Markdown, type MarkdownConfig, type MarkdownIR, type MarkdownLinkSpan, type MarkdownParseOptions, type MarkdownStyle, type MarkdownStyleSpan, type MarkdownTableMode, type MiddlewareDefinition, NamedError, type NodeSpawnObjectArgs, type NodeSpawnOptions, type NodeSpawnResult, type NodeWhichOptions, PKG, PackageRegistry, type ParseCommandResult, type ParsedFrontmatter, type ParsedVersion, PkgShell, type ProxyOptions, type RPCMethod, type RenderLink, type RenderOptions, type RequestOptions, type RouteDefinition, type SSEHandler, SUPPORTED_LANGS, Semver, type ServerOptions, SessionTitle, Shell, Slug, type StreamHandler, type StyleMarker, type TimezoneDateParts, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, addMinutesInTimezone, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatLogTimeMs, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getProxyConfig, getProxyUrl, getTimezoneOffset, getTimezoneParts, git, iife, isSafeFenceBreak, isValidTimezone, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, normalizeTimezone, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, resolveLocaleLang, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
|