@orkestrel/sea 0.0.15 → 0.0.17

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,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _orkestrel_contract = require("@orkestrel/contract");
2
3
  let node_fs = require("node:fs");
3
4
  let node_zlib = require("node:zlib");
4
5
  let node_path = require("node:path");
@@ -6,7 +7,6 @@ let _orkestrel_process_server = require("@orkestrel/process/server");
6
7
  let node_crypto = require("node:crypto");
7
8
  let _orkestrel_emitter = require("@orkestrel/emitter");
8
9
  let node_sea = require("node:sea");
9
- let _orkestrel_contract = require("@orkestrel/contract");
10
10
  //#region src/server/constants.ts
11
11
  /**
12
12
  * Holds the SEA sentinel fuse value embedded in the Node.js binary,
@@ -192,7 +192,7 @@ var SEAError = class extends Error {
192
192
  * ```
193
193
  */
194
194
  function isSEAError(value) {
195
- return value instanceof SEAError;
195
+ return (0, _orkestrel_contract.isInstance)(value, SEAError);
196
196
  }
197
197
  /**
198
198
  * Represents an error thrown when a shell command executed through `executeShell` exits non-zero.
@@ -237,7 +237,7 @@ var ShellError = class extends SEAError {
237
237
  * ```
238
238
  */
239
239
  function isShellError(value) {
240
- return value instanceof ShellError;
240
+ return (0, _orkestrel_contract.isInstance)(value, ShellError);
241
241
  }
242
242
  //#endregion
243
243
  //#region src/server/validators.ts
@@ -254,7 +254,7 @@ function isShellError(value) {
254
254
  * ```
255
255
  */
256
256
  function isExecutableFormat(value) {
257
- return value === "pe" || value === "elf" || value === "macho";
257
+ return (0, _orkestrel_contract.literalOf)("pe", "elf", "macho")(value);
258
258
  }
259
259
  //#endregion
260
260
  //#region src/server/helpers.ts
@@ -873,7 +873,7 @@ function ensureContained(base, path) {
873
873
  } catch (thrown) {
874
874
  throw new SEAError("ASSET", "Path not found or unresolvable", {
875
875
  path,
876
- cause: thrown instanceof Error ? thrown.message : String(thrown)
876
+ cause: (0, _orkestrel_contract.isError)(thrown) ? thrown.message : String(thrown)
877
877
  });
878
878
  }
879
879
  if (real !== realBase && !real.startsWith(realBase + node_path.sep)) throw new SEAError("ASSET", "Path escapes the build root", {
@@ -940,11 +940,11 @@ function syncDirectory(path) {
940
940
  (0, node_fs.closeSync)(fd);
941
941
  }
942
942
  } catch (thrown) {
943
- const code = thrown instanceof Error && "code" in thrown && typeof thrown.code === "string" ? thrown.code : void 0;
943
+ const code = (0, _orkestrel_contract.isError)(thrown) && "code" in thrown && (0, _orkestrel_contract.isString)(thrown.code) ? thrown.code : void 0;
944
944
  if (code === "EINVAL" || code === "ENOTSUP" || code === "EISDIR" || code === "EPERM" || code === "EACCES") return;
945
945
  throw new SEAError("OUTPUT", "Failed to sync output directory", {
946
946
  path,
947
- cause: thrown instanceof Error ? thrown.message : String(thrown)
947
+ cause: (0, _orkestrel_contract.isError)(thrown) ? thrown.message : String(thrown)
948
948
  });
949
949
  }
950
950
  }
@@ -981,7 +981,7 @@ function finalizeExecutable(source, target) {
981
981
  throw new SEAError("OUTPUT", "Failed to finalize executable", {
982
982
  source,
983
983
  target,
984
- cause: thrown instanceof Error ? thrown.message : String(thrown)
984
+ cause: (0, _orkestrel_contract.isError)(thrown) ? thrown.message : String(thrown)
985
985
  });
986
986
  }
987
987
  syncDirectory((0, node_path.dirname)(target));
@@ -2379,7 +2379,7 @@ var SEA = class {
2379
2379
  try {
2380
2380
  executeShell([...platform.remove, temp], shell);
2381
2381
  } catch (thrown) {
2382
- throw new SEAError("SIGN", "Failed to strip existing signature", { cause: thrown instanceof Error ? thrown.message : String(thrown) });
2382
+ throw new SEAError("SIGN", "Failed to strip existing signature", { cause: (0, _orkestrel_contract.isError)(thrown) ? thrown.message : String(thrown) });
2383
2383
  }
2384
2384
  stripped = true;
2385
2385
  }
@@ -2396,14 +2396,14 @@ var SEA = class {
2396
2396
  try {
2397
2397
  executeShell([...platform.sign, temp], shell);
2398
2398
  } catch (thrown) {
2399
- throw new SEAError("SIGN", "Failed to sign executable", { cause: thrown instanceof Error ? thrown.message : String(thrown) });
2399
+ throw new SEAError("SIGN", "Failed to sign executable", { cause: (0, _orkestrel_contract.isError)(thrown) ? thrown.message : String(thrown) });
2400
2400
  }
2401
2401
  if (platform.verify !== void 0) {
2402
2402
  this.#check();
2403
2403
  try {
2404
2404
  executeShell([...platform.verify, temp], shell);
2405
2405
  } catch (thrown) {
2406
- throw new SEAError("SIGN", "Signature verification failed", { cause: thrown instanceof Error ? thrown.message : String(thrown) });
2406
+ throw new SEAError("SIGN", "Signature verification failed", { cause: (0, _orkestrel_contract.isError)(thrown) ? thrown.message : String(thrown) });
2407
2407
  }
2408
2408
  }
2409
2409
  signed = true;