@orkestrel/sea 0.0.3 → 0.0.5

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.
@@ -2,6 +2,14 @@ import { EmitterErrorHandler } from '@orkestrel/emitter';
2
2
  import { EmitterHooks } from '@orkestrel/emitter';
3
3
  import { EmitterInterface } from '@orkestrel/emitter';
4
4
 
5
+ /**
6
+ * Align an ELF note component size to its four-byte boundary.
7
+ *
8
+ * @param value - Component size to align
9
+ * @returns The value rounded up to the next multiple of four
10
+ */
11
+ export declare function alignELFNoteSize(value: number): number;
12
+
5
13
  export declare class Asset implements AssetInterface {
6
14
  readonly key: string;
7
15
  readonly content: ArrayBuffer;
@@ -49,10 +57,10 @@ export declare class AssetManager implements AssetManagerInterface {
49
57
 
50
58
  /** Events emitted by an {@link AssetManagerInterface}. */
51
59
  export declare type AssetManagerEventMap = {
52
- register: readonly [asset: AssetInterface];
53
- load: readonly [keys: readonly string[]];
54
- clear: readonly [];
55
- error: readonly [error: unknown];
60
+ readonly register: readonly [asset: AssetInterface];
61
+ readonly load: readonly [keys: readonly string[]];
62
+ readonly clear: readonly [];
63
+ readonly error: readonly [error: unknown];
56
64
  };
57
65
 
58
66
  /**
@@ -522,6 +530,14 @@ export declare function isPEExecutable(path: string): boolean;
522
530
  */
523
531
  export declare function isPlatformSupported(platform?: string): boolean;
524
532
 
533
+ /**
534
+ * Check whether a number is a nonzero power of two.
535
+ *
536
+ * @param value - Number to check
537
+ * @returns True when the value is a positive power of two
538
+ */
539
+ export declare function isPowerOfTwo(value: number): boolean;
540
+
525
541
  /**
526
542
  * Whether a value is a {@link SEAError}.
527
543
  *
@@ -669,6 +685,14 @@ export declare function platformConfig(platform?: string): SEAPlatform | undefin
669
685
  */
670
686
  export declare function readU16(fd: number, offset: number): number;
671
687
 
688
+ /**
689
+ * Redact password arguments from a shell command.
690
+ *
691
+ * @param command - Command arguments to redact
692
+ * @returns A copy with values following password flags replaced by a marker
693
+ */
694
+ export declare function redactCommand(command: readonly string[]): readonly string[];
695
+
672
696
  /**
673
697
  * Run a command synchronously and return stdout.
674
698
  *
@@ -841,12 +865,12 @@ export declare type SEAErrorCode = 'PLATFORM' | 'ENTRY' | 'ASSET' | 'BLOB' | 'FO
841
865
 
842
866
  /** Events emitted by a {@link SEAInterface}. */
843
867
  export declare type SEAEventMap = {
844
- compress: readonly [compression: SEACompressionManifest | undefined];
845
- progress: readonly [progress: SEAProgress];
846
- blob: readonly [blob: string];
847
- assemble: readonly [executable: string];
848
- complete: readonly [result: SEAResult];
849
- error: readonly [error: unknown];
868
+ readonly compress: readonly [compression: SEACompressionManifest | undefined];
869
+ readonly progress: readonly [progress: SEAProgress];
870
+ readonly blob: readonly [blob: string];
871
+ readonly assemble: readonly [executable: string];
872
+ readonly complete: readonly [result: SEAResult];
873
+ readonly error: readonly [error: unknown];
850
874
  };
851
875
 
852
876
  /**
@@ -2,6 +2,14 @@ import { EmitterErrorHandler } from '@orkestrel/emitter';
2
2
  import { EmitterHooks } from '@orkestrel/emitter';
3
3
  import { EmitterInterface } from '@orkestrel/emitter';
4
4
 
5
+ /**
6
+ * Align an ELF note component size to its four-byte boundary.
7
+ *
8
+ * @param value - Component size to align
9
+ * @returns The value rounded up to the next multiple of four
10
+ */
11
+ export declare function alignELFNoteSize(value: number): number;
12
+
5
13
  export declare class Asset implements AssetInterface {
6
14
  readonly key: string;
7
15
  readonly content: ArrayBuffer;
@@ -49,10 +57,10 @@ export declare class AssetManager implements AssetManagerInterface {
49
57
 
50
58
  /** Events emitted by an {@link AssetManagerInterface}. */
51
59
  export declare type AssetManagerEventMap = {
52
- register: readonly [asset: AssetInterface];
53
- load: readonly [keys: readonly string[]];
54
- clear: readonly [];
55
- error: readonly [error: unknown];
60
+ readonly register: readonly [asset: AssetInterface];
61
+ readonly load: readonly [keys: readonly string[]];
62
+ readonly clear: readonly [];
63
+ readonly error: readonly [error: unknown];
56
64
  };
57
65
 
58
66
  /**
@@ -522,6 +530,14 @@ export declare function isPEExecutable(path: string): boolean;
522
530
  */
523
531
  export declare function isPlatformSupported(platform?: string): boolean;
524
532
 
533
+ /**
534
+ * Check whether a number is a nonzero power of two.
535
+ *
536
+ * @param value - Number to check
537
+ * @returns True when the value is a positive power of two
538
+ */
539
+ export declare function isPowerOfTwo(value: number): boolean;
540
+
525
541
  /**
526
542
  * Whether a value is a {@link SEAError}.
527
543
  *
@@ -669,6 +685,14 @@ export declare function platformConfig(platform?: string): SEAPlatform | undefin
669
685
  */
670
686
  export declare function readU16(fd: number, offset: number): number;
671
687
 
688
+ /**
689
+ * Redact password arguments from a shell command.
690
+ *
691
+ * @param command - Command arguments to redact
692
+ * @returns A copy with values following password flags replaced by a marker
693
+ */
694
+ export declare function redactCommand(command: readonly string[]): readonly string[];
695
+
672
696
  /**
673
697
  * Run a command synchronously and return stdout.
674
698
  *
@@ -841,12 +865,12 @@ export declare type SEAErrorCode = 'PLATFORM' | 'ENTRY' | 'ASSET' | 'BLOB' | 'FO
841
865
 
842
866
  /** Events emitted by a {@link SEAInterface}. */
843
867
  export declare type SEAEventMap = {
844
- compress: readonly [compression: SEACompressionManifest | undefined];
845
- progress: readonly [progress: SEAProgress];
846
- blob: readonly [blob: string];
847
- assemble: readonly [executable: string];
848
- complete: readonly [result: SEAResult];
849
- error: readonly [error: unknown];
868
+ readonly compress: readonly [compression: SEACompressionManifest | undefined];
869
+ readonly progress: readonly [progress: SEAProgress];
870
+ readonly blob: readonly [blob: string];
871
+ readonly assemble: readonly [executable: string];
872
+ readonly complete: readonly [result: SEAResult];
873
+ readonly error: readonly [error: unknown];
850
874
  };
851
875
 
852
876
  /**
@@ -91,8 +91,6 @@ var PE_SCN_MEM_READ = 1073741824;
91
91
  var SEA_PLATFORMS = Object.freeze({
92
92
  win32: Object.freeze({
93
93
  executable: "node.exe",
94
- remove: void 0,
95
- sign: void 0,
96
94
  verify: Object.freeze([
97
95
  "signtool",
98
96
  "verify",
@@ -113,12 +111,7 @@ var SEA_PLATFORMS = Object.freeze({
113
111
  "--strict"
114
112
  ])
115
113
  }),
116
- linux: Object.freeze({
117
- executable: "node",
118
- remove: void 0,
119
- sign: void 0,
120
- verify: void 0
121
- })
114
+ linux: Object.freeze({ executable: "node" })
122
115
  });
123
116
  /** Maps a {@link SEACompressionMode} to its numeric Brotli mode value */
124
117
  var SEA_COMPRESSION_MODE_VALUES = Object.freeze({
@@ -153,7 +146,7 @@ var SEAError = class extends Error {
153
146
  super(message);
154
147
  this.name = "SEAError";
155
148
  this.code = code;
156
- this.context = context;
149
+ if (context !== void 0) this.context = context;
157
150
  }
158
151
  };
159
152
  /**
@@ -287,6 +280,24 @@ function walkDirectory(directory, base) {
287
280
  return result;
288
281
  }
289
282
  /**
283
+ * Redact password arguments from a shell command.
284
+ *
285
+ * @param command - Command arguments to redact
286
+ * @returns A copy with values following password flags replaced by a marker
287
+ */
288
+ function redactCommand(command) {
289
+ const secretFlags = /* @__PURE__ */ new Set([
290
+ "/p",
291
+ "-p",
292
+ "--password"
293
+ ]);
294
+ return command.map((token, index) => {
295
+ const previous = command[index - 1];
296
+ if (previous !== void 0 && secretFlags.has(previous.toLowerCase())) return "***";
297
+ return token;
298
+ });
299
+ }
300
+ /**
290
301
  * Run a command synchronously and return stdout.
291
302
  *
292
303
  * @param command - Command to execute (first element is the binary)
@@ -298,18 +309,6 @@ function walkDirectory(directory, base) {
298
309
  * @throws ShellError when the command exits with non-zero status
299
310
  */
300
311
  function runShell(command, options) {
301
- function redactCommand(argv) {
302
- const secretFlags = /* @__PURE__ */ new Set([
303
- "/p",
304
- "-p",
305
- "--password"
306
- ]);
307
- return argv.map((token, index) => {
308
- const previous = argv[index - 1];
309
- if (previous !== void 0 && secretFlags.has(previous.toLowerCase())) return "***";
310
- return token;
311
- });
312
- }
313
312
  const [cmd, ...args] = command;
314
313
  if (cmd === void 0) throw new SEAError("STATE", "Command array must not be empty");
315
314
  if (options?.signal?.aborted === true) throw new SEAError("ABORT", "Shell command aborted", { command: redactCommand(command) });
@@ -413,6 +412,15 @@ function compressDirectory(directory, options, progress) {
413
412
  };
414
413
  }
415
414
  /**
415
+ * Check whether a number is a nonzero power of two.
416
+ *
417
+ * @param value - Number to check
418
+ * @returns True when the value is a positive power of two
419
+ */
420
+ function isPowerOfTwo(value) {
421
+ return value > 0 && (value & value - 1) === 0;
422
+ }
423
+ /**
416
424
  * Parse the PE header offset from a Windows executable.
417
425
  *
418
426
  * @param fd - Open file descriptor
@@ -510,7 +518,8 @@ function stripPESignature(path) {
510
518
  if (certOffset <= fileSize && certOffset + certSize === fileSize) ftruncateSync(fd, certOffset);
511
519
  }
512
520
  }
513
- writeSync(fd, Buffer.alloc(8), 0, 8, securityDirOffset);
521
+ const zeroes = Buffer.alloc(8);
522
+ writeSync(fd, zeroes, 0, 8, securityDirOffset);
514
523
  } finally {
515
524
  closeSync(fd);
516
525
  }
@@ -591,8 +600,8 @@ function createSignCommand(sign, target) {
591
600
  */
592
601
  function formatSize(bytes) {
593
602
  if (bytes < 1024) return `${String(bytes)} B`;
594
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
595
- return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
603
+ if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
604
+ return `${(bytes / 1048576).toFixed(2)} MB`;
596
605
  }
597
606
  /**
598
607
  * Assert that an asset key is safe to use as a relative filesystem/archive key.
@@ -807,6 +816,16 @@ function createBlobConfig(entry, blob, assets, options) {
807
816
  };
808
817
  }
809
818
  /**
819
+ * Align an ELF note component size to its four-byte boundary.
820
+ *
821
+ * @param value - Component size to align
822
+ * @returns The value rounded up to the next multiple of four
823
+ */
824
+ function alignELFNoteSize(value) {
825
+ const remainder = value % 4;
826
+ return remainder === 0 ? value : value + (4 - remainder);
827
+ }
828
+ /**
810
829
  * Build an ELF `PT_NOTE` entry's header bytes (namesz/descsz/type + padded
811
830
  * name) for the SEA blob note, without the blob body itself.
812
831
  *
@@ -830,18 +849,14 @@ function createBlobConfig(entry, blob, assets, options) {
830
849
  * ```
831
850
  */
832
851
  function buildELFNoteHeader(resource, blobSize) {
833
- const alignTo4 = (value) => {
834
- const remainder = value % 4;
835
- return remainder === 0 ? value : value + (4 - remainder);
836
- };
837
852
  const nameBytes = Buffer.from(`${resource}\0`, "utf-8");
838
- const alignedNameSize = alignTo4(nameBytes.length);
853
+ const alignedNameSize = alignELFNoteSize(nameBytes.length);
839
854
  const header = Buffer.alloc(12 + alignedNameSize);
840
855
  header.writeUInt32LE(nameBytes.length, 0);
841
856
  header.writeUInt32LE(blobSize, 4);
842
857
  header.writeUInt32LE(0, 8);
843
858
  nameBytes.copy(header, 12);
844
- const alignedDescSize = alignTo4(blobSize);
859
+ const alignedDescSize = alignELFNoteSize(blobSize);
845
860
  return {
846
861
  header,
847
862
  entryTotal: header.length + alignedDescSize
@@ -876,7 +891,7 @@ function buildELFNoteHeader(resource, blobSize) {
876
891
  * copyRange(srcFd, dstFd, 1024, 4096)
877
892
  * ```
878
893
  */
879
- function copyRange(source, target, start, length, chunk = 4 * 1024 * 1024) {
894
+ function copyRange(source, target, start, length, chunk = 4194304) {
880
895
  if (length <= 0) return;
881
896
  const bufferSize = Math.min(chunk, length);
882
897
  const buffer = Buffer.alloc(bufferSize);
@@ -910,7 +925,7 @@ function patchSentinelFuse(executable, fuse) {
910
925
  const fd = openSync(executable, "r+");
911
926
  try {
912
927
  const needle = Buffer.from(fuse, "utf-8");
913
- const chunkSize = 64 * 1024 * 1024;
928
+ const chunkSize = 67108864;
914
929
  const readSize = chunkSize + needle.length;
915
930
  const buffer = Buffer.alloc(readSize);
916
931
  let offset = 0;
@@ -1015,9 +1030,7 @@ var Injector = class {
1015
1030
  case "elf":
1016
1031
  this.#injectElf();
1017
1032
  break;
1018
- case "macho":
1019
- this.#injectMacho();
1020
- break;
1033
+ case "macho": this.#injectMacho();
1021
1034
  }
1022
1035
  if (this.#options.fuse !== void 0) patchSentinelFuse(this.#options.executable, this.#options.fuse);
1023
1036
  if (peOptionalOffset !== void 0) this.#patchChecksum(peOptionalOffset);
@@ -1470,12 +1483,13 @@ var Injector = class {
1470
1483
  const fd = openSync(this.#options.executable, "r+");
1471
1484
  try {
1472
1485
  const fileSize = statSync(this.#options.executable).size;
1473
- const chunkSize = 4 * 1024 * 1024;
1486
+ const chunkSize = 4194304;
1474
1487
  const chunk = Buffer.alloc(Math.min(chunkSize, fileSize));
1475
1488
  let sum = 0;
1476
1489
  let offset = 0;
1477
1490
  while (offset < fileSize) {
1478
- const bytesRead = readSync(fd, chunk, 0, Math.min(chunkSize, fileSize - offset), offset);
1491
+ const toRead = Math.min(chunkSize, fileSize - offset);
1492
+ const bytesRead = readSync(fd, chunk, 0, toRead, offset);
1479
1493
  if (bytesRead === 0) break;
1480
1494
  for (let i = 0; i < bytesRead; i += 2) {
1481
1495
  const absolute = offset + i;
@@ -1839,32 +1853,30 @@ var Injector = class {
1839
1853
  }
1840
1854
  }
1841
1855
  #shiftMachoLinkeditOffsets(buf, cmd, threshold, shift) {
1842
- const bump = (fieldOffset) => {
1843
- if (fieldOffset + 4 > buf.length) return;
1844
- const value = buf.readUInt32LE(fieldOffset);
1845
- if (value >= threshold && value > 0) buf.writeUInt32LE(value + shift, fieldOffset);
1846
- };
1847
- const base = cmd.offset;
1856
+ let offsets;
1848
1857
  switch (cmd.type) {
1849
1858
  case 2:
1850
- bump(base + 8);
1851
- bump(base + 16);
1859
+ offsets = [8, 16];
1852
1860
  break;
1853
1861
  case 11:
1854
- bump(base + 32);
1855
- bump(base + 40);
1856
- bump(base + 48);
1857
- bump(base + 56);
1858
- bump(base + 64);
1859
- bump(base + 72);
1862
+ offsets = [
1863
+ 32,
1864
+ 40,
1865
+ 48,
1866
+ 56,
1867
+ 64,
1868
+ 72
1869
+ ];
1860
1870
  break;
1861
1871
  case 34:
1862
1872
  case 2147483682:
1863
- bump(base + 8);
1864
- bump(base + 16);
1865
- bump(base + 24);
1866
- bump(base + 32);
1867
- bump(base + 40);
1873
+ offsets = [
1874
+ 8,
1875
+ 16,
1876
+ 24,
1877
+ 32,
1878
+ 40
1879
+ ];
1868
1880
  break;
1869
1881
  case 29:
1870
1882
  case 30:
@@ -1872,9 +1884,15 @@ var Injector = class {
1872
1884
  case 41:
1873
1885
  case 2147483699:
1874
1886
  case 2147483700:
1875
- bump(base + 8);
1887
+ offsets = [8];
1876
1888
  break;
1877
- default: break;
1889
+ default: return;
1890
+ }
1891
+ for (const offset of offsets) {
1892
+ const fieldOffset = cmd.offset + offset;
1893
+ if (fieldOffset + 4 > buf.length) continue;
1894
+ const value = buf.readUInt32LE(fieldOffset);
1895
+ if (value >= threshold && value > 0) buf.writeUInt32LE(value + shift, fieldOffset);
1878
1896
  }
1879
1897
  }
1880
1898
  #verifyMachoSection(exePath, segmentName, sectionName, expectedOffset, expectedSize) {
@@ -1949,7 +1967,6 @@ var Injector = class {
1949
1967
  return remainder === 0 ? value : value + (alignment - remainder);
1950
1968
  }
1951
1969
  #ensureValidPEAlignment(sectionAlignment, fileAlignment) {
1952
- const isPowerOfTwo = (n) => n > 0 && (n & n - 1) === 0;
1953
1970
  if (!isPowerOfTwo(sectionAlignment) || !isPowerOfTwo(fileAlignment)) throw new SEAError("FORMAT", "PE section/file alignment must be a nonzero power of two", {
1954
1971
  executable: this.#options.executable,
1955
1972
  sectionAlignment,
@@ -1963,14 +1980,15 @@ var Injector = class {
1963
1980
  }
1964
1981
  /** Append sourceFile to targetFile by streaming in 4 MB chunks */
1965
1982
  #appendFile(targetPath, sourcePath) {
1966
- const chunkSize = 4 * 1024 * 1024;
1983
+ const chunkSize = 4194304;
1967
1984
  const srcFd = openSync(sourcePath, "r");
1968
1985
  try {
1969
1986
  const srcSize = statSync(sourcePath).size;
1970
1987
  const chunk = Buffer.alloc(Math.min(chunkSize, srcSize));
1971
1988
  let offset = 0;
1972
1989
  while (offset < srcSize) {
1973
- const bytesRead = readSync(srcFd, chunk, 0, Math.min(chunkSize, srcSize - offset), offset);
1990
+ const toRead = Math.min(chunkSize, srcSize - offset);
1991
+ const bytesRead = readSync(srcFd, chunk, 0, toRead, offset);
1974
1992
  if (bytesRead === 0) break;
1975
1993
  appendFileSync(targetPath, chunk.subarray(0, bytesRead));
1976
1994
  offset += bytesRead;
@@ -1994,8 +2012,8 @@ var SEA = class {
1994
2012
  constructor(options) {
1995
2013
  this.#options = options;
1996
2014
  this.#emitter = new Emitter({
1997
- on: options.on,
1998
- error: options.error
2015
+ ...options.on === void 0 ? {} : { on: options.on },
2016
+ ...options.error === void 0 ? {} : { error: options.error }
1999
2017
  });
2000
2018
  }
2001
2019
  get emitter() {
@@ -2032,10 +2050,10 @@ var SEA = class {
2032
2050
  platform: process.platform,
2033
2051
  size,
2034
2052
  duration,
2035
- compression,
2036
2053
  signed: assembled.signed,
2037
2054
  stripped: assembled.stripped,
2038
- terminal: assembled.terminal
2055
+ ...compression === void 0 ? {} : { compression },
2056
+ ...assembled.terminal === void 0 ? {} : { terminal: assembled.terminal }
2039
2057
  };
2040
2058
  this.#status = "done";
2041
2059
  this.#emitter.emit("complete", result);
@@ -2081,7 +2099,8 @@ var SEA = class {
2081
2099
  const directories = [];
2082
2100
  let total = 0;
2083
2101
  for (const path of compression.paths) {
2084
- if (!existsSync(resolve(root, path))) continue;
2102
+ const candidate = resolve(root, path);
2103
+ if (!existsSync(candidate)) continue;
2085
2104
  this.#check();
2086
2105
  const directory = ensureContained(root, path);
2087
2106
  directories.push(directory);
@@ -2125,7 +2144,7 @@ var SEA = class {
2125
2144
  const blob = join(output, "sea-prep.blob");
2126
2145
  const config = createBlobConfig({
2127
2146
  path: entry,
2128
- format: this.#options.entry.format
2147
+ ...this.#options.entry.format === void 0 ? {} : { format: this.#options.entry.format }
2129
2148
  }, blob, this.#assets(root), this.#options.blob);
2130
2149
  writeFileSync(configPath, JSON.stringify(config, null, 2));
2131
2150
  runShell([
@@ -2134,7 +2153,7 @@ var SEA = class {
2134
2153
  configPath
2135
2154
  ], {
2136
2155
  cwd: output,
2137
- signal: this.#options.signal
2156
+ ...this.#options.signal === void 0 ? {} : { signal: this.#options.signal }
2138
2157
  });
2139
2158
  if (!existsSync(blob)) throw new SEAError("BLOB", "SEA blob generation failed — blob not found", { blob });
2140
2159
  this.#emitter.emit("blob", blob);
@@ -2145,8 +2164,10 @@ var SEA = class {
2145
2164
  if (platform === void 0) throw new SEAError("PLATFORM", `Unsupported platform: ${process.platform}`, { platform: process.platform });
2146
2165
  const output = resolve(root, this.#options.output);
2147
2166
  const ext = process.platform === "win32" ? ".exe" : "";
2148
- const finalOutput = join(output, process.platform === "win32" ? `${this.#options.name}.exe` : this.#options.name);
2167
+ const name = process.platform === "win32" ? `${this.#options.name}.exe` : this.#options.name;
2168
+ const finalOutput = join(output, name);
2149
2169
  const temp = join(output, `.${this.#options.name}-${randomUUID()}.tmp${ext}`);
2170
+ const shell = this.#options.signal === void 0 ? {} : { signal: this.#options.signal };
2150
2171
  let signed = false;
2151
2172
  let stripped = false;
2152
2173
  let terminal;
@@ -2158,7 +2179,7 @@ var SEA = class {
2158
2179
  if (platform.remove !== void 0) {
2159
2180
  this.#check();
2160
2181
  try {
2161
- runShell([...platform.remove, temp], { signal: this.#options.signal });
2182
+ runShell([...platform.remove, temp], shell);
2162
2183
  } catch (thrown) {
2163
2184
  throw new SEAError("SIGN", "Failed to strip existing signature", { cause: thrown instanceof Error ? thrown.message : String(thrown) });
2164
2185
  }
@@ -2175,14 +2196,14 @@ var SEA = class {
2175
2196
  if (platform.sign !== void 0) {
2176
2197
  this.#check();
2177
2198
  try {
2178
- runShell([...platform.sign, temp], { signal: this.#options.signal });
2199
+ runShell([...platform.sign, temp], shell);
2179
2200
  } catch (thrown) {
2180
2201
  throw new SEAError("SIGN", "Failed to sign executable", { cause: thrown instanceof Error ? thrown.message : String(thrown) });
2181
2202
  }
2182
2203
  if (platform.verify !== void 0) {
2183
2204
  this.#check();
2184
2205
  try {
2185
- runShell([...platform.verify, temp], { signal: this.#options.signal });
2206
+ runShell([...platform.verify, temp], shell);
2186
2207
  } catch (thrown) {
2187
2208
  throw new SEAError("SIGN", "Signature verification failed", { cause: thrown instanceof Error ? thrown.message : String(thrown) });
2188
2209
  }
@@ -2213,7 +2234,7 @@ var SEA = class {
2213
2234
  file: resolve(root, sign.file)
2214
2235
  } : sign, temp);
2215
2236
  try {
2216
- runShell(signArgs, { signal: this.#options.signal });
2237
+ runShell(signArgs, shell);
2217
2238
  } catch {
2218
2239
  throw new SEAError("SIGN", "Windows signing failed", { executable: temp });
2219
2240
  }
@@ -2221,7 +2242,7 @@ var SEA = class {
2221
2242
  if (platform.verify !== void 0) {
2222
2243
  this.#check();
2223
2244
  try {
2224
- runShell([...platform.verify, temp], { signal: this.#options.signal });
2245
+ runShell([...platform.verify, temp], shell);
2225
2246
  } catch {
2226
2247
  throw new SEAError("SIGN", "Signature verification failed", { executable: temp });
2227
2248
  }
@@ -2249,7 +2270,7 @@ var SEA = class {
2249
2270
  executable: finalOutput,
2250
2271
  signed,
2251
2272
  stripped,
2252
- terminal
2273
+ ...terminal === void 0 ? {} : { terminal }
2253
2274
  };
2254
2275
  }
2255
2276
  #assets(root) {
@@ -2287,8 +2308,8 @@ var AssetManager = class {
2287
2308
  constructor(options) {
2288
2309
  this.#root = options?.root ?? process.cwd();
2289
2310
  this.#emitter = new Emitter({
2290
- on: options?.on,
2291
- error: options?.error
2311
+ ...options?.on === void 0 ? {} : { on: options.on },
2312
+ ...options?.error === void 0 ? {} : { error: options.error }
2292
2313
  });
2293
2314
  this.#loadSea();
2294
2315
  }
@@ -2460,6 +2481,6 @@ function createAssetManager(options) {
2460
2481
  return new AssetManager(options);
2461
2482
  }
2462
2483
  //#endregion
2463
- export { Asset, AssetManager, BROTLI_EXTENSION, CLIENT_ASSET_KEY_BR, CLIENT_ASSET_KEY_RAW, DEFAULT_ENTRY_FORMAT, DEFAULT_SEA_COMPRESSION_QUALITY, ELF_CLASS_64, ELF_DATA_LSB, ELF_MAGIC, ELF_PT_NOTE, Injector, MACHO_LC_SEGMENT_64, MACHO_MAGIC_64, PE32_MAGIC, PE32_PLUS_MAGIC, PE_MAGIC, PE_RESOURCE_DATA_ENTRY_SIZE, PE_RESOURCE_DIR_SIZE, PE_RESOURCE_ENTRY_SIZE, PE_RESOURCE_NAME_FLAG, PE_RESOURCE_SUBDIR_FLAG, PE_RT_RCDATA, PE_SCN_INITIALIZED_DATA, PE_SCN_MEM_READ, PE_SECTION_HEADER_SIZE, PE_SIGNATURE, SEA, SEAError, SEA_BLOB_RESOURCE, SEA_COMPRESSION_MODE_VALUES, SEA_PLATFORMS, SEA_SENTINEL_FUSE, SKIP_EXTENSIONS, ShellError, WINDOWS_SUBSYSTEM_CONSOLE, WINDOWS_SUBSYSTEM_GUI, buildELFNoteHeader, compressDirectory, compressFile, computeSize, copyRange, createAsset, createAssetManager, createBlobConfig, createInjector, createSEA, createSignCommand, ensureContained, ensureExists, ensureSafeKey, ensureSafeName, finalizeExecutable, formatSize, isCompressible, isExecutableFormat, isPEExecutable, isPlatformSupported, isSEAError, isShellError, openBrowser, parsePEOffset, patchPESubsystem, patchSentinelFuse, platformConfig, readU16, runShell, stripPESignature, syncDirectory, walkDirectory, writeU16 };
2484
+ export { Asset, AssetManager, BROTLI_EXTENSION, CLIENT_ASSET_KEY_BR, CLIENT_ASSET_KEY_RAW, DEFAULT_ENTRY_FORMAT, DEFAULT_SEA_COMPRESSION_QUALITY, ELF_CLASS_64, ELF_DATA_LSB, ELF_MAGIC, ELF_PT_NOTE, Injector, MACHO_LC_SEGMENT_64, MACHO_MAGIC_64, PE32_MAGIC, PE32_PLUS_MAGIC, PE_MAGIC, PE_RESOURCE_DATA_ENTRY_SIZE, PE_RESOURCE_DIR_SIZE, PE_RESOURCE_ENTRY_SIZE, PE_RESOURCE_NAME_FLAG, PE_RESOURCE_SUBDIR_FLAG, PE_RT_RCDATA, PE_SCN_INITIALIZED_DATA, PE_SCN_MEM_READ, PE_SECTION_HEADER_SIZE, PE_SIGNATURE, SEA, SEAError, SEA_BLOB_RESOURCE, SEA_COMPRESSION_MODE_VALUES, SEA_PLATFORMS, SEA_SENTINEL_FUSE, SKIP_EXTENSIONS, ShellError, WINDOWS_SUBSYSTEM_CONSOLE, WINDOWS_SUBSYSTEM_GUI, alignELFNoteSize, buildELFNoteHeader, compressDirectory, compressFile, computeSize, copyRange, createAsset, createAssetManager, createBlobConfig, createInjector, createSEA, createSignCommand, ensureContained, ensureExists, ensureSafeKey, ensureSafeName, finalizeExecutable, formatSize, isCompressible, isExecutableFormat, isPEExecutable, isPlatformSupported, isPowerOfTwo, isSEAError, isShellError, openBrowser, parsePEOffset, patchPESubsystem, patchSentinelFuse, platformConfig, readU16, redactCommand, runShell, stripPESignature, syncDirectory, walkDirectory, writeU16 };
2464
2485
 
2465
2486
  //# sourceMappingURL=index.js.map