just-bash 2.9.8 → 2.10.1

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.
@@ -1,5 +1,5 @@
1
- import type { BufferEncoding, CpOptions, DirectoryEntry, DirentEntry, FileContent, FileEntry, FsEntry, FsStat, IFileSystem, InitialFiles, MkdirOptions, ReadFileOptions, RmOptions, SymlinkEntry, WriteFileOptions } from "../interface.js";
2
- export type { BufferEncoding, FileContent, FileEntry, DirectoryEntry, SymlinkEntry, FsEntry, FsStat, IFileSystem, };
1
+ import type { BufferEncoding, CpOptions, DirectoryEntry, DirentEntry, FileContent, FileEntry, FsEntry, FsStat, IFileSystem, InitialFiles, LazyFileEntry, MkdirOptions, ReadFileOptions, RmOptions, SymlinkEntry, WriteFileOptions } from "../interface.js";
2
+ export type { BufferEncoding, FileContent, FileEntry, LazyFileEntry, DirectoryEntry, SymlinkEntry, FsEntry, FsStat, IFileSystem, };
3
3
  export interface FsData {
4
4
  [path: string]: FsEntry;
5
5
  }
@@ -13,6 +13,19 @@ export declare class InMemoryFs implements IFileSystem {
13
13
  mode?: number;
14
14
  mtime?: Date;
15
15
  }): void;
16
+ /**
17
+ * Store a lazy file entry whose content is provided by a function on first read.
18
+ * Writing to the path replaces the lazy entry, so the function is never called.
19
+ */
20
+ writeFileLazy(path: string, lazy: () => string | Uint8Array | Promise<string | Uint8Array>, metadata?: {
21
+ mode?: number;
22
+ mtime?: Date;
23
+ }): void;
24
+ /**
25
+ * Materialize a lazy file entry, replacing it with a concrete FileEntry.
26
+ * Returns the materialized FileEntry.
27
+ */
28
+ private materializeLazy;
16
29
  readFile(path: string, options?: ReadFileOptions | BufferEncoding): Promise<string>;
17
30
  readFileBuffer(path: string): Promise<Uint8Array>;
18
31
  writeFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
@@ -38,7 +38,13 @@ export interface SymlinkEntry {
38
38
  mode: number;
39
39
  mtime: Date;
40
40
  }
41
- export type FsEntry = FileEntry | DirectoryEntry | SymlinkEntry;
41
+ export interface LazyFileEntry {
42
+ type: "file";
43
+ lazy: () => string | Uint8Array | Promise<string | Uint8Array>;
44
+ mode: number;
45
+ mtime: Date;
46
+ }
47
+ export type FsEntry = FileEntry | LazyFileEntry | DirectoryEntry | SymlinkEntry;
42
48
  /**
43
49
  * Directory entry with type information (similar to Node's Dirent)
44
50
  * Used by readdirWithFileTypes for efficient directory listing without stat calls
@@ -210,9 +216,13 @@ export interface FileInit {
210
216
  mtime?: Date;
211
217
  }
212
218
  /**
213
- * Initial files can be simple content or extended options with metadata
219
+ * Lazy file provider - a function whose return value becomes the file content on first read
220
+ */
221
+ export type LazyFileProvider = () => string | Uint8Array | Promise<string | Uint8Array>;
222
+ /**
223
+ * Initial files can be simple content, extended options with metadata, or lazy providers
214
224
  */
215
- export type InitialFiles = Record<string, FileContent | FileInit>;
225
+ export type InitialFiles = Record<string, FileContent | FileInit | LazyFileProvider>;
216
226
  /**
217
227
  * Factory function type for creating filesystem instances
218
228
  */
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export type { CommandNode, PipelineNode, ScriptNode, SimpleCommandNode, StatementNode, WordNode, } from "./ast/types.js";
1
2
  export type { BashLogger, BashOptions, ExecOptions } from "./Bash.js";
2
3
  export { Bash } from "./Bash.js";
3
4
  export type { AllCommandName, CommandName, NetworkCommandName, PythonCommandName, } from "./commands/registry.js";
@@ -5,14 +6,22 @@ export { getCommandNames, getNetworkCommandNames, getPythonCommandNames, } from
5
6
  export type { CustomCommand, LazyCommand } from "./custom-commands.js";
6
7
  export { defineCommand } from "./custom-commands.js";
7
8
  export { InMemoryFs } from "./fs/in-memory-fs/index.js";
8
- export type { BufferEncoding, CpOptions, DirectoryEntry, FileContent, FileEntry, FileInit, FileSystemFactory, FsEntry, FsStat, InitialFiles, MkdirOptions, RmOptions, SymlinkEntry, } from "./fs/interface.js";
9
+ export type { BufferEncoding, CpOptions, DirectoryEntry, FileContent, FileEntry, FileInit, FileSystemFactory, FsEntry, FsStat, InitialFiles, LazyFileEntry, LazyFileProvider, MkdirOptions, RmOptions, SymlinkEntry, } from "./fs/interface.js";
9
10
  export { MountableFs, type MountableFsOptions, type MountConfig, } from "./fs/mountable-fs/index.js";
10
11
  export { OverlayFs, type OverlayFsOptions } from "./fs/overlay-fs/index.js";
11
12
  export { ReadWriteFs, type ReadWriteFsOptions, } from "./fs/read-write-fs/index.js";
12
13
  export type { NetworkConfig } from "./network/index.js";
13
14
  export { NetworkAccessDeniedError, RedirectNotAllowedError, TooManyRedirectsError, } from "./network/index.js";
15
+ export { parse } from "./parser/parser.js";
14
16
  export type { CommandFinished as SandboxCommandFinished, OutputMessage, SandboxOptions, WriteFilesInput, } from "./sandbox/index.js";
15
17
  export { Command as SandboxCommand, Sandbox } from "./sandbox/index.js";
16
18
  export type { DefenseInDepthConfig, DefenseInDepthHandle, DefenseInDepthStats, SecurityViolation, SecurityViolationType, } from "./security/index.js";
17
19
  export { createConsoleViolationCallback, DefenseInDepthBox, SecurityViolationError, SecurityViolationLogger, } from "./security/index.js";
20
+ export { BashTransformPipeline } from "./transform/pipeline.js";
21
+ export type { CommandCollectorMetadata } from "./transform/plugins/command-collector.js";
22
+ export { CommandCollectorPlugin } from "./transform/plugins/command-collector.js";
23
+ export type { TeeFileInfo, TeePluginMetadata, TeePluginOptions, } from "./transform/plugins/tee-plugin.js";
24
+ export { TeePlugin } from "./transform/plugins/tee-plugin.js";
25
+ export { serialize } from "./transform/serialize.js";
26
+ export type { BashTransformResult, TransformContext, TransformPlugin, TransformResult, } from "./transform/types.js";
18
27
  export type { BashExecResult, Command, CommandContext, ExecResult, IFileSystem, } from "./types.js";
package/dist/types.d.ts CHANGED
@@ -18,6 +18,7 @@ export interface ExecResult {
18
18
  /** Result from BashEnv.exec() - always includes env */
19
19
  export interface BashExecResult extends ExecResult {
20
20
  env: Record<string, string>;
21
+ metadata?: Record<string, unknown>;
21
22
  }
22
23
  /** Options for exec calls within commands (internal API) */
23
24
  export interface CommandExecOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "just-bash",
3
- "version": "2.9.8",
3
+ "version": "2.10.1",
4
4
  "description": "A simulated bash environment with virtual filesystem",
5
5
  "repository": {
6
6
  "type": "git",