@orkestrel/sea 0.0.14 → 0.0.16

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 CHANGED
@@ -1,9 +1,13 @@
1
1
  # @orkestrel/sea
2
2
 
3
- A pure-TypeScript Node.js [Single Executable Application (SEA)](https://nodejs.org/api/single-executable-applications.html)
4
- builder for the `@orkestrel` line — compress assets, assemble the SEA blob,
5
- and inject it into a standalone binary, entirely in TypeScript with no
6
- external tools.
3
+ > The Node.js single executable application (SEA) builder: a pure-TypeScript pipeline
4
+ > that compresses assets, assembles the SEA blob, injects it into a copy of the host
5
+ > Node binary, and signs the result, with no WASM and no external tools.
6
+
7
+ Build a [Single Executable Application](https://nodejs.org/api/single-executable-applications.html)
8
+ with the `createSEA` function: point it at your entry script and an output
9
+ directory, then `await sea.execute()` for the finished binary. Part of the
10
+ `@orkestrel` line.
7
11
 
8
12
  ## Install
9
13
 
@@ -73,7 +77,7 @@ process.stdout.write(
73
77
  (`codesign --verify --strict`) as the final build step. An ad-hoc signature
74
78
  satisfies local Gatekeeper checks but is not a trusted, distributable
75
79
  signature — re-sign with a real Apple Developer ID for distribution.
76
- - **Windows** — signing is **optional**, via `windows.sign`. Provide exactly
80
+ - **Windows** — signing is **optional**, through `windows.sign`. Provide exactly
77
81
  one of `file` (a `.pfx` path + `password`) or `thumbprint` (a cert-store
78
82
  SHA1 hash), plus an optional RFC 3161 `timestamp` URL and `digest`
79
83
  (defaults to `sha256`):
@@ -137,7 +141,7 @@ of those flows provide out of the box.
137
141
  AV/EDR heuristics flag for modified executables. Code-sign the output (see
138
142
  Code signing above) and, if needed, submit it to your vendor's allowlist.
139
143
  - **Windows SmartScreen warns on first launch.** The `.exe` is unsigned —
140
- sign it via `windows.sign` (see Code signing above) to avoid the warning.
144
+ sign it through `windows.sign` (see Code signing above) to avoid the warning.
141
145
  - **macOS Gatekeeper blocks the app.** Gatekeeper requires a valid signature;
142
146
  the automatic ad-hoc signature (`codesign --sign -`) satisfies local
143
147
  Gatekeeper checks so it runs on the machine that built it, but for
@@ -148,7 +152,7 @@ of those flows provide out of the box.
148
152
 
149
153
  ## Example: embedded local UI
150
154
 
151
- A SEA whose entry starts a local server, serves a bundled `client.html` via
155
+ A SEA whose entry starts a local server, serves a bundled `client.html` through
152
156
  `AssetManager`, and opens the system browser once ready:
153
157
 
154
158
  ```ts
@@ -8,19 +8,28 @@ let _orkestrel_emitter = require("@orkestrel/emitter");
8
8
  let node_sea = require("node:sea");
9
9
  let _orkestrel_contract = require("@orkestrel/contract");
10
10
  //#region src/server/constants.ts
11
- /** Holds the SEA sentinel fuse value embedded in the Node.js binary */
11
+ /**
12
+ * Holds the SEA sentinel fuse value embedded in the Node.js binary,
13
+ * `NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2`.
14
+ */
12
15
  var SEA_SENTINEL_FUSE = "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2";
13
- /** Names the SEA blob resource in the executable */
16
+ /** Names the SEA blob resource in the executable, `NODE_SEA_BLOB`. */
14
17
  var SEA_BLOB_RESOURCE = "NODE_SEA_BLOB";
15
- /** Holds the default Brotli compression quality level (maximum) */
18
+ /** Holds the default Brotli compression quality level, 11, the maximum Brotli accepts. */
16
19
  var DEFAULT_SEA_COMPRESSION_QUALITY = 11;
17
- /** Holds the Windows PE subsystem value for a GUI application (no terminal window) */
20
+ /**
21
+ * Holds the Windows PE subsystem value for a GUI application, 2, which launches
22
+ * without a terminal window.
23
+ */
18
24
  var WINDOWS_SUBSYSTEM_GUI = 2;
19
- /** Holds the Windows PE subsystem value for a console application */
25
+ /** Holds the Windows PE subsystem value for a console application, 3. */
20
26
  var WINDOWS_SUBSYSTEM_CONSOLE = 3;
21
- /** Names the file extension indicating Brotli compression */
27
+ /** Names the file extension indicating Brotli compression, `.br`. */
22
28
  var BROTLI_EXTENSION = ".br";
23
- /** Lists the file extensions Brotli compression skips */
29
+ /**
30
+ * Lists the file extensions Brotli compression skips, the already-compressed
31
+ * archive, image, font, and media formats.
32
+ */
24
33
  var SKIP_EXTENSIONS = /* @__PURE__ */ new Set([
25
34
  ".br",
26
35
  ".gz",
@@ -44,55 +53,67 @@ var SKIP_EXTENSIONS = /* @__PURE__ */ new Set([
44
53
  ".zip",
45
54
  ".tar"
46
55
  ]);
47
- /** Names the default SEA entry point module format when none is specified */
56
+ /** Names the default SEA entry point module format when none is specified, `cjs`. */
48
57
  var DEFAULT_ENTRY_FORMAT = "cjs";
49
- /** Holds the DOS MZ header magic (first 2 bytes of a PE file) */
58
+ /** Holds the DOS MZ header magic, 0x5a4d, the first two bytes of a PE file. */
50
59
  var PE_MAGIC = 23117;
51
- /** Holds the PE signature, "PE\0\0" as a 32-bit value */
60
+ /** Holds the PE signature, 0x00004550, the bytes `PE\0\0` read as a 32-bit value. */
52
61
  var PE_SIGNATURE = 17744;
53
- /** Holds the PE32 optional header magic */
62
+ /** Holds the PE32 optional header magic, 0x10b. */
54
63
  var PE32_MAGIC = 267;
55
- /** Holds the PE32+ (64-bit) optional header magic */
64
+ /** Holds the PE32+ optional header magic, 0x20b, the 64-bit form. */
56
65
  var PE32_PLUS_MAGIC = 523;
57
- /** Holds the ELF magic, 0x7F 'E' 'L' 'F' as a 32-bit big-endian value */
66
+ /**
67
+ * Holds the ELF magic, 0x7f454c46, the bytes 0x7F `E` `L` `F` read as a 32-bit
68
+ * big-endian value.
69
+ */
58
70
  var ELF_MAGIC = 2135247942;
59
- /** Holds the ELF 64-bit class identifier */
71
+ /** Holds the ELF 64-bit class identifier, 2. */
60
72
  var ELF_CLASS_64 = 2;
61
- /** Holds the ELF little-endian data encoding */
73
+ /** Holds the ELF little-endian data encoding, 1. */
62
74
  var ELF_DATA_LSB = 1;
63
- /** Holds the ELF program header type for a note segment */
75
+ /** Holds the ELF program header type for a note segment, 4. */
64
76
  var ELF_PT_NOTE = 4;
65
- /** Holds the ELF program header type for a loadable segment */
77
+ /** Holds the ELF program header type for a loadable segment, 1. */
66
78
  var ELF_PT_LOAD = 1;
67
- /** Holds the ELF program header type for the program header table itself */
79
+ /** Holds the ELF program header type for the program header table itself, 6. */
68
80
  var ELF_PT_PHDR = 6;
69
- /** Holds the ELF segment permission flag marking a segment readable */
81
+ /** Holds the ELF segment permission flag marking a segment readable, 4. */
70
82
  var ELF_PF_R = 4;
71
- /** Holds the page size an injected ELF segment is aligned to */
83
+ /** Holds the page size an injected ELF segment is aligned to, 0x1000. */
72
84
  var ELF_PAGE_SIZE = 4096;
73
- /** Holds the Mach-O 64-bit magic (little-endian) */
85
+ /** Holds the Mach-O 64-bit magic, 0xfeedfacf, in little-endian byte order. */
74
86
  var MACHO_MAGIC_64 = 4277009103;
75
- /** Holds the Mach-O LC_SEGMENT_64 load command */
87
+ /** Holds the Mach-O `LC_SEGMENT_64` load command, 0x19. */
76
88
  var MACHO_LC_SEGMENT_64 = 25;
77
- /** Holds the PE resource type RT_RCDATA (raw data) */
89
+ /** Holds the PE resource type `RT_RCDATA` for raw data, 10. */
78
90
  var PE_RT_RCDATA = 10;
79
- /** Holds the size of IMAGE_RESOURCE_DIRECTORY in bytes */
91
+ /** Holds the size of `IMAGE_RESOURCE_DIRECTORY` in bytes, 16. */
80
92
  var PE_RESOURCE_DIR_SIZE = 16;
81
- /** Holds the size of IMAGE_RESOURCE_DIRECTORY_ENTRY in bytes */
93
+ /** Holds the size of `IMAGE_RESOURCE_DIRECTORY_ENTRY` in bytes, 8. */
82
94
  var PE_RESOURCE_ENTRY_SIZE = 8;
83
- /** Holds the size of IMAGE_RESOURCE_DATA_ENTRY in bytes */
95
+ /** Holds the size of `IMAGE_RESOURCE_DATA_ENTRY` in bytes, 16. */
84
96
  var PE_RESOURCE_DATA_ENTRY_SIZE = 16;
85
- /** Holds the PE section header size in bytes */
97
+ /** Holds the PE section header size in bytes, 40. */
86
98
  var PE_SECTION_HEADER_SIZE = 40;
87
- /** Holds the high bit mask for a resource directory entry offset (indicates subdirectory) */
99
+ /**
100
+ * Holds the high bit mask marking a resource directory entry offset as a
101
+ * subdirectory, 0x80000000.
102
+ */
88
103
  var PE_RESOURCE_SUBDIR_FLAG = 2147483648;
89
- /** Holds the high bit mask for a resource name entry (indicates named vs integer ID) */
104
+ /**
105
+ * Holds the high bit mask marking a resource entry as named rather than
106
+ * integer-identified, 0x80000000.
107
+ */
90
108
  var PE_RESOURCE_NAME_FLAG = 2147483648;
91
- /** Marks a section as containing initialized data */
109
+ /** Marks a section as containing initialized data, 0x00000040. */
92
110
  var PE_SCN_INITIALIZED_DATA = 64;
93
- /** Marks a section as readable */
111
+ /** Marks a section as readable, 0x40000000. */
94
112
  var PE_SCN_MEM_READ = 1073741824;
95
- /** Holds the platform-specific SEA build configurations */
113
+ /**
114
+ * Holds the platform-specific SEA build configurations, keyed by
115
+ * `process.platform` for `win32`, `darwin`, and `linux`.
116
+ */
96
117
  var SEA_PLATFORMS = Object.freeze({
97
118
  win32: Object.freeze({
98
119
  executable: "node.exe",
@@ -118,7 +139,10 @@ var SEA_PLATFORMS = Object.freeze({
118
139
  }),
119
140
  linux: Object.freeze({ executable: "node" })
120
141
  });
121
- /** Maps a {@link SEACompressionMode} to its numeric Brotli mode value */
142
+ /**
143
+ * Maps a {@link SEACompressionMode} to its numeric Brotli mode value: `generic`
144
+ * to 0, `text` to 1, and `font` to 2.
145
+ */
122
146
  var SEA_COMPRESSION_MODE_VALUES = Object.freeze({
123
147
  generic: 0,
124
148
  text: 1,
@@ -218,7 +242,7 @@ function isShellError(value) {
218
242
  //#endregion
219
243
  //#region src/server/validators.ts
220
244
  /**
221
- * Checks if a value is a valid {@link ExecutableFormat}.
245
+ * Checks whether a value is a valid {@link ExecutableFormat}.
222
246
  *
223
247
  * @param value - Value to check
224
248
  * @returns True if value is `'pe'`, `'elf'`, or `'macho'`; false otherwise
@@ -244,7 +268,7 @@ function resolvePlatform(platform) {
244
268
  return SEA_PLATFORMS[platform ?? process.platform];
245
269
  }
246
270
  /**
247
- * Checks if the current or specified platform is supported for SEA builds.
271
+ * Checks whether the current or named platform is supported for SEA builds.
248
272
  *
249
273
  * @param platform - Platform identifier to check
250
274
  * @returns True if the platform has a known configuration; false otherwise
@@ -275,7 +299,8 @@ function isCompressible(path) {
275
299
  return !SKIP_EXTENSIONS.has(ext);
276
300
  }
277
301
  /**
278
- * Walks a directory recursively and returns all file paths.
302
+ * Walks a directory recursively and returns every file path it finds, relative to
303
+ * the base and skipping symlinks.
279
304
  *
280
305
  * @param directory - Directory to walk
281
306
  * @param base - Base directory for relative path calculation
@@ -295,7 +320,8 @@ function walkDirectory(directory, base) {
295
320
  return result;
296
321
  }
297
322
  /**
298
- * Redacts password arguments from a shell command.
323
+ * Redacts password arguments from a shell command, so the command is safe to
324
+ * include in an error message.
299
325
  *
300
326
  * @param command - Command arguments to redact
301
327
  * @returns A copy with values following password flags replaced by a marker
@@ -563,7 +589,7 @@ function appendFile(target, source, chunk = 4194304) {
563
589
  }
564
590
  }
565
591
  /**
566
- * Truncates a string at its first NUL character.
592
+ * Truncates a NUL-padded binary name field at its first NUL character.
567
593
  *
568
594
  * @remarks
569
595
  * Binary name fields (PE section names, Mach-O segment and section names, ELF
@@ -639,7 +665,7 @@ function writeU16(fd, offset, value) {
639
665
  (0, node_fs.writeSync)(fd, buf, 0, 2, offset);
640
666
  }
641
667
  /**
642
- * Checks if a file is a Windows PE executable.
668
+ * Checks whether a file is a Windows PE executable.
643
669
  *
644
670
  * @param path - Path to the file
645
671
  * @returns True if the file has a valid PE signature; false otherwise
@@ -679,11 +705,11 @@ function patchPESubsystem(path, subsystem) {
679
705
  * @remarks
680
706
  * If the certificate overlay described by the security directory sits at the
681
707
  * very end of the file (the common case for `signtool`-signed binaries), the
682
- * file is truncated to the certificate's start FIRST so the overlay bytes are
708
+ * file is truncated to the certificate's start first so the overlay bytes are
683
709
  * discarded rather than left as dead weight for a downstream injector to
684
710
  * bury mid-file. The directory read is bounds-checked so a malformed or
685
- * truncated security directory cannot throw unexpectedly — it is simply
686
- * skipped and only the directory entry is zeroed.
711
+ * truncated security directory cannot throw unexpectedly — it is skipped
712
+ * and only the directory entry is zeroed.
687
713
  *
688
714
  * @param path - Path to the executable
689
715
  */
@@ -711,13 +737,13 @@ function stripPESignature(path) {
711
737
  * Builds the `signtool sign` argv for signing a Windows executable.
712
738
  *
713
739
  * @remarks
714
- * Requires EXACTLY ONE certificate source — `sign.file` (a `.pfx`/`.p12`
740
+ * Requires exactly one certificate source — `sign.file` (a `.pfx`/`.p12`
715
741
  * file, paired with `sign.password` when present) XOR `sign.thumbprint` (a
716
742
  * certificate already installed in the Windows store). When `sign.timestamp`
717
743
  * is set it is parsed with the `URL` constructor and must be an `http:` or
718
744
  * `https:` URL. The returned argv is passed directly to `executeShell` — never
719
745
  * through a shell — so nothing in `sign` can be interpreted as a flag or
720
- * injected into a command line. `sign.password` is NEVER included in a
746
+ * injected into a command line. `sign.password` is never included in a
721
747
  * thrown error's message or `context`.
722
748
  *
723
749
  * @param sign - Windows signing options
@@ -779,7 +805,7 @@ function buildSignCommand(sign, target) {
779
805
  * Formats a byte count as a human-readable string.
780
806
  *
781
807
  * @param bytes - Byte count
782
- * @returns Formatted string (e.g. `"1.23 MB"`, `"456 KB"`)
808
+ * @returns Formatted string (for example `"1.23 MB"`, `"456 KB"`)
783
809
  */
784
810
  function formatSize(bytes) {
785
811
  if (bytes < 1024) return `${String(bytes)} B`;
@@ -791,7 +817,7 @@ function formatSize(bytes) {
791
817
  *
792
818
  * @remarks
793
819
  * Rejects an empty key, an absolute path, a key containing a backslash, a
794
- * Windows drive-relative specifier (e.g. `'C:foo'`), or any `/`-separated
820
+ * Windows drive-relative specifier (for example `'C:foo'`), or any `/`-separated
795
821
  * segment equal to `'..'` — all of which could escape the intended asset root.
796
822
  *
797
823
  * @param key - Asset key to validate
@@ -819,10 +845,10 @@ function ensureSafeKey(key) {
819
845
  * Resolves `path` against `base`, then dereferences both the resolved path
820
846
  * and `base` with `realpathSync` and requires the real resolved path to
821
847
  * equal the real base or begin with the real base plus a path separator.
822
- * Dereferencing BOTH sides means a symlinked base itself (e.g. macOS `/tmp`
848
+ * Dereferencing both sides means a symlinked base itself (for example macOS `/tmp`
823
849
  * -> `/private/tmp`) still matches, while a symlink inside the tree that
824
850
  * points outside the real base is correctly rejected. A `realpathSync`
825
- * failure (e.g. `ENOENT`) is wrapped as a coded `SEAError` rather than
851
+ * failure (for example `ENOENT`) is wrapped as a coded `SEAError` rather than
826
852
  * leaking the raw Node error.
827
853
  *
828
854
  * @param base - Absolute path to the containing root
@@ -862,8 +888,8 @@ function ensureContained(base, path) {
862
888
  *
863
889
  * @remarks
864
890
  * Rejects an empty name, `'.'`, `'..'`, a name containing a `/` or `\`
865
- * separator, an absolute path, or a Windows drive-relative specifier (e.g.
866
- * `'C:foo'`) — all of which could redirect the output executable outside
891
+ * separator, an absolute path, or a Windows drive-relative specifier (for
892
+ * example `'C:foo'`) — all of which could redirect the output executable outside
867
893
  * the intended output directory.
868
894
  *
869
895
  * @param name - Output executable base name to validate
@@ -885,14 +911,14 @@ function ensureSafeName(name) {
885
911
  * Fsyncs a directory to durably persist a prior file rename/create within it.
886
912
  *
887
913
  * @remarks
888
- * A `rename`/`create` is only durable once its CONTAINING directory entry is
914
+ * A `rename`/`create` is only durable once its containing directory entry is
889
915
  * flushed — fsyncing the file itself is not enough. `path` is the directory
890
916
  * to fsync (callers pass `dirname(target)`, not the file itself). On Windows
891
917
  * there is no directory file handle to fsync, so this is a no-op there (the
892
918
  * platform lacks the primitive, not a failure). Some filesystems/platforms
893
919
  * return a benign errno for a directory fsync attempt (`EINVAL`, `ENOTSUP`,
894
920
  * `EISDIR`, `EPERM`, `EACCES`) — those are treated as "fsync unsupported
895
- * here" and swallowed; anything else (e.g. `ENOENT`, meaning the directory
921
+ * here" and swallowed; anything else (for example `ENOENT`, meaning the directory
896
922
  * itself is missing) is a genuine failure and is thrown as a coded `SEAError`.
897
923
  *
898
924
  * @param path - Directory path to fsync
@@ -966,7 +992,7 @@ function finalizeExecutable(source, target) {
966
992
  * @remarks
967
993
  * A pure leaf extracted from the SEA build orchestrator. The `mainFormat`
968
994
  * field (`'commonjs' | 'module'`) exists only in Node >= 25.7 — for a `'cjs'`
969
- * entry (the default) `mainFormat` is OMITTED entirely so the config still
995
+ * entry (the default) `mainFormat` is omitted entirely so the config still
970
996
  * builds on older Node hosts where `'commonjs'` is already the implicit
971
997
  * default; for an `'esm'` entry `mainFormat: 'module'` is set explicitly
972
998
  * (this requires a Node >= 25.7 build host). Node also documents that
@@ -1021,7 +1047,7 @@ function alignELFNoteSize(value) {
1021
1047
  * (`strncmp(name, "NODE_SEA", 8)`), so `resource` is written in full but
1022
1048
  * only needs to begin with those 8 bytes to be found at runtime.
1023
1049
  *
1024
- * @param resource - Note name (SEA resource identifier, e.g. `NODE_SEA_BLOB`)
1050
+ * @param resource - Note name (SEA resource identifier, for example `NODE_SEA_BLOB`)
1025
1051
  * @param blobSize - Size in bytes of the SEA blob that will follow the header
1026
1052
  * @returns The note header bytes and the total on-disk size of header + blob
1027
1053
  *
@@ -1095,10 +1121,11 @@ function copyRange(source, target, start, length, chunk = 4194304) {
1095
1121
  /**
1096
1122
  * Patches the sentinel fuse in a binary from `:0` to `:1`.
1097
1123
  *
1098
- * Searches the file in 64 MB chunks with overlap to handle any file size.
1099
- * The fuse signals to the Node.js runtime that a SEA blob is present.
1100
- * This is normally handled by the Injector but is also available standalone
1101
- * when using native PE resource injection.
1124
+ * @remarks
1125
+ * Searches the file in 64 MB chunks with overlap to handle any file size. The fuse
1126
+ * signals to the Node.js runtime that a SEA blob is present. The `Injector` class
1127
+ * normally applies this patch, and it stays available standalone for a build that
1128
+ * injects the PE resource natively instead.
1102
1129
  *
1103
1130
  * @param executable - Absolute path to the executable
1104
1131
  * @param fuse - Sentinel fuse string (without the `:0` suffix)
@@ -1159,7 +1186,7 @@ function patchSentinelFuse(executable, fuse) {
1159
1186
  * outlives the host app and never keeps it alive, and it swallows the async
1160
1187
  * host fault an absent opener binary raises. Only `http:` and `https:` URLs
1161
1188
  * are accepted — any other scheme (including a string that merely looks like a
1162
- * CLI flag, e.g. `'-e ...'`) fails to parse as an http(s) URL and is rejected
1189
+ * CLI flag, for example `'-e ...'`) fails to parse as an http(s) URL and is rejected
1163
1190
  * before anything is spawned.
1164
1191
  *
1165
1192
  * @param url - Absolute http or https URL to open
@@ -2601,32 +2628,43 @@ var AssetManager = class {
2601
2628
  //#endregion
2602
2629
  //#region src/server/factories.ts
2603
2630
  /**
2604
- * Creates a new SEA build orchestrator.
2631
+ * Creates a SEA build orchestrator over the given options and returns it as a
2632
+ * `SEAInterface`, the published contract a caller holds instead of the `SEA` class.
2605
2633
  *
2606
2634
  * @param options - SEA build options
2607
2635
  * @returns a new `SEAInterface`
2608
2636
  *
2609
- * @example
2637
+ * @example Build a single executable
2610
2638
  * ```ts
2639
+ * import { createSEA, formatSize } from '@orkestrel/sea'
2640
+ *
2611
2641
  * const sea = createSEA({
2612
- * name: 'orkestrel',
2613
- * entry: { path: 'dist/bin/serve.cjs' },
2614
- * output: 'dist/sea',
2615
- * assets: { 'index.html.br': 'dist/client/index.html.br' },
2616
- * compression: { paths: ['dist/client'] },
2642
+ * name: 'myapp',
2643
+ * entry: { path: 'dist/server/serve.cjs' },
2644
+ * output: 'dist/sea',
2645
+ * assets: { 'model.gguf': 'models/model.gguf' },
2646
+ * compression: { paths: ['dist/app/browser'], mode: 'text' },
2647
+ * windows: { terminal: false },
2648
+ * timeout: 30_000,
2617
2649
  * })
2650
+ *
2618
2651
  * const result = await sea.execute()
2652
+ * process.stdout.write(
2653
+ * `${result.executable} ${formatSize(result.size)} ${String(result.duration)}ms\n`,
2654
+ * )
2619
2655
  * ```
2620
2656
  */
2621
2657
  function createSEA(options) {
2622
2658
  return new SEA(options);
2623
2659
  }
2624
2660
  /**
2625
- * Creates a cross-platform binary resource injector.
2661
+ * Creates a resource injector bound to one target executable and returns it as an
2662
+ * `InjectorInterface`, with the executable's format already detected from its header.
2626
2663
  *
2627
- * Detects the executable format (PE, ELF, Mach-O) from the file header
2628
- * and injects the blob using pure TypeScript file I/O — no WASM, no
2629
- * external tools.
2664
+ * @remarks
2665
+ * The format detected at construction — PE, ELF, or Mach-O — selects the strategy
2666
+ * `inject` takes. Every write runs through pure TypeScript file I/O, so the injector
2667
+ * needs no WASM and no external tool.
2630
2668
  *
2631
2669
  * @param options - Injector options
2632
2670
  * @returns a new `InjectorInterface`
@@ -2646,7 +2684,9 @@ function createInjector(options) {
2646
2684
  return new Injector(options);
2647
2685
  }
2648
2686
  /**
2649
- * Creates a single named asset.
2687
+ * Creates one named asset from a key and a content buffer and returns it as an
2688
+ * `AssetInterface`, with `compressed` inferred from the key where the input leaves
2689
+ * it unset.
2650
2690
  *
2651
2691
  * @param input - Asset key, content, and optional compression flag
2652
2692
  * @returns a new `AssetInterface`
@@ -2660,7 +2700,8 @@ function createAsset(input) {
2660
2700
  return new Asset(input);
2661
2701
  }
2662
2702
  /**
2663
- * Creates an asset manager for SEA-embedded or disk-loaded assets.
2703
+ * Creates an asset collection and returns it as an `AssetManagerInterface`, already
2704
+ * carrying whatever assets the running SEA blob embeds.
2664
2705
  *
2665
2706
  * @param options - Asset manager options (root, event hooks)
2666
2707
  * @returns a new `AssetManagerInterface`