@easbot/utils 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -131,10 +131,13 @@ declare namespace Shell {
131
131
  signal?: AbortSignal;
132
132
  windowsHide?: boolean;
133
133
  shell?: boolean;
134
+ stdin?: 'null' | 'pipe';
135
+ stdout?: 'pipe' | 'ignore';
136
+ stderr?: 'pipe' | 'ignore';
134
137
  }
135
- interface SpawnOptions extends RunOptions {
136
- stdout?: 'pipe' | 'inherit' | 'null';
137
- stderr?: 'pipe' | 'inherit' | 'null';
138
+ interface SpawnOptions extends Omit<RunOptions, 'stdin' | 'stdout' | 'stderr'> {
139
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
140
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
138
141
  stdin?: 'pipe' | 'inherit' | 'null';
139
142
  }
140
143
  function run(shell: string | undefined, command: string, options?: RunOptions): Promise<{
@@ -155,12 +158,20 @@ declare namespace Shell {
155
158
  quiet?: boolean;
156
159
  nothrow?: boolean;
157
160
  env?: Record<string, string | undefined>;
161
+ stdin?: 'null' | 'pipe';
162
+ stdout?: 'pipe' | 'ignore';
163
+ stderr?: 'pipe' | 'ignore';
164
+ windowsHide?: boolean;
165
+ shell?: boolean;
158
166
  }
159
167
  function $(strings: TemplateStringsArray, ...values: unknown[]): {
160
168
  quiet: () => any;
161
169
  nothrow: () => any;
162
170
  cwd: (dir: string) => any;
163
171
  env: (env: Record<string, string | undefined>) => any;
172
+ stdin: (stdin: "null" | "pipe") => any;
173
+ stdout: (stdout: "pipe" | "ignore") => any;
174
+ stderr: (stderr: "pipe" | "ignore") => any;
164
175
  text: () => Promise<string>;
165
176
  lines: () => Promise<string[]>;
166
177
  then: (onfulfilled: (result: {
@@ -360,6 +371,7 @@ declare abstract class NamedError extends Error {
360
371
  };
361
372
  }
362
373
 
374
+ declare const MIME_TYPES: Record<string, string>;
363
375
  declare namespace Filesystem {
364
376
  function mkdir(p: string, options?: {
365
377
  recursive?: boolean;
@@ -376,10 +388,14 @@ declare namespace Filesystem {
376
388
  function writeJson(p: string, data: unknown, mode?: number): Promise<void>;
377
389
  function writeStream(p: string, stream: ReadableStream<Uint8Array> | Readable, mode?: number): Promise<void>;
378
390
  function mimeType(p: string): string;
391
+ function dirname(p: string): string;
392
+ function basename(p: string, ext?: string): string;
393
+ function extname(p: string): string;
379
394
  function toUnixPath(p: string): string;
380
395
  function normalize(p: string): string;
381
- const normalizePath: typeof normalize;
382
396
  function resolve(p: string): string;
397
+ function isAbsolute(p: string): boolean;
398
+ function join(base: string, ...paths: string[]): string;
383
399
  function windowsPath(p: string): string;
384
400
  function overlaps(a: string, b: string): boolean;
385
401
  function contains(parent: string, child: string): boolean;
@@ -880,8 +896,8 @@ interface NodeWhichOptions {
880
896
  interface NodeSpawnOptions {
881
897
  cwd?: string;
882
898
  env?: Record<string, string | undefined>;
883
- stdout?: 'pipe' | 'inherit' | 'null';
884
- stderr?: 'pipe' | 'inherit' | 'null';
899
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
900
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
885
901
  stdin?: 'pipe' | 'inherit' | 'null';
886
902
  signal?: AbortSignal;
887
903
  timeout?: number | false;
@@ -892,8 +908,8 @@ interface NodeSpawnObjectArgs {
892
908
  cmd: string[];
893
909
  cwd?: string;
894
910
  env?: Record<string, string | undefined>;
895
- stdout?: 'pipe' | 'inherit' | 'null';
896
- stderr?: 'pipe' | 'inherit' | 'null';
911
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
912
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
897
913
  stdin?: 'pipe' | 'inherit' | 'null';
898
914
  signal?: AbortSignal;
899
915
  timeout?: number | false;
@@ -948,6 +964,9 @@ declare namespace PKG {
948
964
  timeout?: number;
949
965
  windowsHide?: boolean;
950
966
  shell?: boolean;
967
+ stdin?: 'null' | 'pipe';
968
+ stdout?: 'pipe' | 'ignore';
969
+ stderr?: 'pipe' | 'ignore';
951
970
  }): Promise<{
952
971
  code: number;
953
972
  stdout: string;
@@ -1215,4 +1234,4 @@ declare function initLog(options: {
1215
1234
  level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
1216
1235
  }): Promise<void>;
1217
1236
 
1218
- export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, 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 RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
1237
+ export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, 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 RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
package/dist/index.d.ts CHANGED
@@ -131,10 +131,13 @@ declare namespace Shell {
131
131
  signal?: AbortSignal;
132
132
  windowsHide?: boolean;
133
133
  shell?: boolean;
134
+ stdin?: 'null' | 'pipe';
135
+ stdout?: 'pipe' | 'ignore';
136
+ stderr?: 'pipe' | 'ignore';
134
137
  }
135
- interface SpawnOptions extends RunOptions {
136
- stdout?: 'pipe' | 'inherit' | 'null';
137
- stderr?: 'pipe' | 'inherit' | 'null';
138
+ interface SpawnOptions extends Omit<RunOptions, 'stdin' | 'stdout' | 'stderr'> {
139
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
140
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
138
141
  stdin?: 'pipe' | 'inherit' | 'null';
139
142
  }
140
143
  function run(shell: string | undefined, command: string, options?: RunOptions): Promise<{
@@ -155,12 +158,20 @@ declare namespace Shell {
155
158
  quiet?: boolean;
156
159
  nothrow?: boolean;
157
160
  env?: Record<string, string | undefined>;
161
+ stdin?: 'null' | 'pipe';
162
+ stdout?: 'pipe' | 'ignore';
163
+ stderr?: 'pipe' | 'ignore';
164
+ windowsHide?: boolean;
165
+ shell?: boolean;
158
166
  }
159
167
  function $(strings: TemplateStringsArray, ...values: unknown[]): {
160
168
  quiet: () => any;
161
169
  nothrow: () => any;
162
170
  cwd: (dir: string) => any;
163
171
  env: (env: Record<string, string | undefined>) => any;
172
+ stdin: (stdin: "null" | "pipe") => any;
173
+ stdout: (stdout: "pipe" | "ignore") => any;
174
+ stderr: (stderr: "pipe" | "ignore") => any;
164
175
  text: () => Promise<string>;
165
176
  lines: () => Promise<string[]>;
166
177
  then: (onfulfilled: (result: {
@@ -360,6 +371,7 @@ declare abstract class NamedError extends Error {
360
371
  };
361
372
  }
362
373
 
374
+ declare const MIME_TYPES: Record<string, string>;
363
375
  declare namespace Filesystem {
364
376
  function mkdir(p: string, options?: {
365
377
  recursive?: boolean;
@@ -376,10 +388,14 @@ declare namespace Filesystem {
376
388
  function writeJson(p: string, data: unknown, mode?: number): Promise<void>;
377
389
  function writeStream(p: string, stream: ReadableStream<Uint8Array> | Readable, mode?: number): Promise<void>;
378
390
  function mimeType(p: string): string;
391
+ function dirname(p: string): string;
392
+ function basename(p: string, ext?: string): string;
393
+ function extname(p: string): string;
379
394
  function toUnixPath(p: string): string;
380
395
  function normalize(p: string): string;
381
- const normalizePath: typeof normalize;
382
396
  function resolve(p: string): string;
397
+ function isAbsolute(p: string): boolean;
398
+ function join(base: string, ...paths: string[]): string;
383
399
  function windowsPath(p: string): string;
384
400
  function overlaps(a: string, b: string): boolean;
385
401
  function contains(parent: string, child: string): boolean;
@@ -880,8 +896,8 @@ interface NodeWhichOptions {
880
896
  interface NodeSpawnOptions {
881
897
  cwd?: string;
882
898
  env?: Record<string, string | undefined>;
883
- stdout?: 'pipe' | 'inherit' | 'null';
884
- stderr?: 'pipe' | 'inherit' | 'null';
899
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
900
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
885
901
  stdin?: 'pipe' | 'inherit' | 'null';
886
902
  signal?: AbortSignal;
887
903
  timeout?: number | false;
@@ -892,8 +908,8 @@ interface NodeSpawnObjectArgs {
892
908
  cmd: string[];
893
909
  cwd?: string;
894
910
  env?: Record<string, string | undefined>;
895
- stdout?: 'pipe' | 'inherit' | 'null';
896
- stderr?: 'pipe' | 'inherit' | 'null';
911
+ stdout?: 'pipe' | 'inherit' | 'null' | 'ignore';
912
+ stderr?: 'pipe' | 'inherit' | 'null' | 'ignore';
897
913
  stdin?: 'pipe' | 'inherit' | 'null';
898
914
  signal?: AbortSignal;
899
915
  timeout?: number | false;
@@ -948,6 +964,9 @@ declare namespace PKG {
948
964
  timeout?: number;
949
965
  windowsHide?: boolean;
950
966
  shell?: boolean;
967
+ stdin?: 'null' | 'pipe';
968
+ stdout?: 'pipe' | 'ignore';
969
+ stderr?: 'pipe' | 'ignore';
951
970
  }): Promise<{
952
971
  code: number;
953
972
  stdout: string;
@@ -1215,4 +1234,4 @@ declare function initLog(options: {
1215
1234
  level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
1216
1235
  }): Promise<void>;
1217
1236
 
1218
- export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, 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 RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };
1237
+ export { $, Archive, AsyncQueue, Binary, type CodeSpanIndex$1 as CodeSpanIndex, Color, Context, type EasServer, Encode, EventLoop, type FenceSpan$1 as FenceSpan, Filesystem, Fn, type FormatOptions, type GitResult, Glob, Identifier, Ignore, type InlineCodeState$1 as InlineCodeState, Keybind, Lazy, Locale, Lock, 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 RPCMethod, type RenderLink, type RenderOptions, type RouteDefinition, type SSEHandler, Semver, type ServerOptions, Shell, Slug, type StreamHandler, type StyleMarker, Token, TruncateContent, type WebSocketHandler, type WebSocketRouteDefinition, Wildcard, abortAfter, abortAfterAny, buildCodeSpanIndex, chunkMarkdownIR, chunkText, chunkTextByBreakResolver, convertMarkdownTables, createInlineCodeState, createPkgShell, createRESTServer, createRPCServer, createServer, createStreamingServer, createWebSocketServer, defer, detectPlatform, escapeCommandArg, escapeCommandArgSafe, extractFrontmatter, findFenceSpanAt, findLast, fn, formatDuration, formatLocalISO, formatLocalISOCompact, formatLogTime, formatMarkdown, getDirectory, getFileExtension, getFilename, getFilenameTruncated, getTimezoneOffset, git, iife, initLog, isSafeFenceBreak, joinCommandArgs, lazy, lazyAsync, loadEnv, loadTextFile, loadTextFileAsync, markdownToIR, markdownToIRWithMeta, needsShellExecution, now, nowLocalISO, parseCommand, parseCommandWithOptions, parseFenceSpans, parseFrontmatterBlock, parseLocalISO, parseModelId, proxied, readableStreamToText, renderMarkdown, renderMarkdownWithMarkers, retry, scanParenAwareBreakpoints, serializeFrontmatter, shell, signal, startServer, truncateMiddle, updateSchema, whichSync, withTimeout, work };