@orkestrel/sea 0.0.2 → 0.0.4
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/src/server/index.cjs +84 -63
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +34 -10
- package/dist/src/server/index.d.ts +34 -10
- package/dist/src/server/index.js +82 -64
- package/dist/src/server/index.js.map +1 -1
- package/package.json +20 -16
|
@@ -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
|
/**
|
package/dist/src/server/index.js
CHANGED
|
@@ -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
|
|
@@ -807,6 +815,16 @@ function createBlobConfig(entry, blob, assets, options) {
|
|
|
807
815
|
};
|
|
808
816
|
}
|
|
809
817
|
/**
|
|
818
|
+
* Align an ELF note component size to its four-byte boundary.
|
|
819
|
+
*
|
|
820
|
+
* @param value - Component size to align
|
|
821
|
+
* @returns The value rounded up to the next multiple of four
|
|
822
|
+
*/
|
|
823
|
+
function alignELFNoteSize(value) {
|
|
824
|
+
const remainder = value % 4;
|
|
825
|
+
return remainder === 0 ? value : value + (4 - remainder);
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
810
828
|
* Build an ELF `PT_NOTE` entry's header bytes (namesz/descsz/type + padded
|
|
811
829
|
* name) for the SEA blob note, without the blob body itself.
|
|
812
830
|
*
|
|
@@ -830,18 +848,14 @@ function createBlobConfig(entry, blob, assets, options) {
|
|
|
830
848
|
* ```
|
|
831
849
|
*/
|
|
832
850
|
function buildELFNoteHeader(resource, blobSize) {
|
|
833
|
-
const alignTo4 = (value) => {
|
|
834
|
-
const remainder = value % 4;
|
|
835
|
-
return remainder === 0 ? value : value + (4 - remainder);
|
|
836
|
-
};
|
|
837
851
|
const nameBytes = Buffer.from(`${resource}\0`, "utf-8");
|
|
838
|
-
const alignedNameSize =
|
|
852
|
+
const alignedNameSize = alignELFNoteSize(nameBytes.length);
|
|
839
853
|
const header = Buffer.alloc(12 + alignedNameSize);
|
|
840
854
|
header.writeUInt32LE(nameBytes.length, 0);
|
|
841
855
|
header.writeUInt32LE(blobSize, 4);
|
|
842
856
|
header.writeUInt32LE(0, 8);
|
|
843
857
|
nameBytes.copy(header, 12);
|
|
844
|
-
const alignedDescSize =
|
|
858
|
+
const alignedDescSize = alignELFNoteSize(blobSize);
|
|
845
859
|
return {
|
|
846
860
|
header,
|
|
847
861
|
entryTotal: header.length + alignedDescSize
|
|
@@ -1839,32 +1853,30 @@ var Injector = class {
|
|
|
1839
1853
|
}
|
|
1840
1854
|
}
|
|
1841
1855
|
#shiftMachoLinkeditOffsets(buf, cmd, threshold, shift) {
|
|
1842
|
-
|
|
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
|
-
|
|
1851
|
-
bump(base + 16);
|
|
1859
|
+
offsets = [8, 16];
|
|
1852
1860
|
break;
|
|
1853
1861
|
case 11:
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
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
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
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
|
-
|
|
1887
|
+
offsets = [8];
|
|
1876
1888
|
break;
|
|
1877
|
-
default:
|
|
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,
|
|
@@ -1994,8 +2011,8 @@ var SEA = class {
|
|
|
1994
2011
|
constructor(options) {
|
|
1995
2012
|
this.#options = options;
|
|
1996
2013
|
this.#emitter = new Emitter({
|
|
1997
|
-
on: options.on,
|
|
1998
|
-
error: options.error
|
|
2014
|
+
...options.on === void 0 ? {} : { on: options.on },
|
|
2015
|
+
...options.error === void 0 ? {} : { error: options.error }
|
|
1999
2016
|
});
|
|
2000
2017
|
}
|
|
2001
2018
|
get emitter() {
|
|
@@ -2032,10 +2049,10 @@ var SEA = class {
|
|
|
2032
2049
|
platform: process.platform,
|
|
2033
2050
|
size,
|
|
2034
2051
|
duration,
|
|
2035
|
-
compression,
|
|
2036
2052
|
signed: assembled.signed,
|
|
2037
2053
|
stripped: assembled.stripped,
|
|
2038
|
-
|
|
2054
|
+
...compression === void 0 ? {} : { compression },
|
|
2055
|
+
...assembled.terminal === void 0 ? {} : { terminal: assembled.terminal }
|
|
2039
2056
|
};
|
|
2040
2057
|
this.#status = "done";
|
|
2041
2058
|
this.#emitter.emit("complete", result);
|
|
@@ -2125,7 +2142,7 @@ var SEA = class {
|
|
|
2125
2142
|
const blob = join(output, "sea-prep.blob");
|
|
2126
2143
|
const config = createBlobConfig({
|
|
2127
2144
|
path: entry,
|
|
2128
|
-
format: this.#options.entry.format
|
|
2145
|
+
...this.#options.entry.format === void 0 ? {} : { format: this.#options.entry.format }
|
|
2129
2146
|
}, blob, this.#assets(root), this.#options.blob);
|
|
2130
2147
|
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
2131
2148
|
runShell([
|
|
@@ -2134,7 +2151,7 @@ var SEA = class {
|
|
|
2134
2151
|
configPath
|
|
2135
2152
|
], {
|
|
2136
2153
|
cwd: output,
|
|
2137
|
-
signal: this.#options.signal
|
|
2154
|
+
...this.#options.signal === void 0 ? {} : { signal: this.#options.signal }
|
|
2138
2155
|
});
|
|
2139
2156
|
if (!existsSync(blob)) throw new SEAError("BLOB", "SEA blob generation failed — blob not found", { blob });
|
|
2140
2157
|
this.#emitter.emit("blob", blob);
|
|
@@ -2147,6 +2164,7 @@ var SEA = class {
|
|
|
2147
2164
|
const ext = process.platform === "win32" ? ".exe" : "";
|
|
2148
2165
|
const finalOutput = join(output, process.platform === "win32" ? `${this.#options.name}.exe` : this.#options.name);
|
|
2149
2166
|
const temp = join(output, `.${this.#options.name}-${randomUUID()}.tmp${ext}`);
|
|
2167
|
+
const shell = this.#options.signal === void 0 ? {} : { signal: this.#options.signal };
|
|
2150
2168
|
let signed = false;
|
|
2151
2169
|
let stripped = false;
|
|
2152
2170
|
let terminal;
|
|
@@ -2158,7 +2176,7 @@ var SEA = class {
|
|
|
2158
2176
|
if (platform.remove !== void 0) {
|
|
2159
2177
|
this.#check();
|
|
2160
2178
|
try {
|
|
2161
|
-
runShell([...platform.remove, temp],
|
|
2179
|
+
runShell([...platform.remove, temp], shell);
|
|
2162
2180
|
} catch (thrown) {
|
|
2163
2181
|
throw new SEAError("SIGN", "Failed to strip existing signature", { cause: thrown instanceof Error ? thrown.message : String(thrown) });
|
|
2164
2182
|
}
|
|
@@ -2175,14 +2193,14 @@ var SEA = class {
|
|
|
2175
2193
|
if (platform.sign !== void 0) {
|
|
2176
2194
|
this.#check();
|
|
2177
2195
|
try {
|
|
2178
|
-
runShell([...platform.sign, temp],
|
|
2196
|
+
runShell([...platform.sign, temp], shell);
|
|
2179
2197
|
} catch (thrown) {
|
|
2180
2198
|
throw new SEAError("SIGN", "Failed to sign executable", { cause: thrown instanceof Error ? thrown.message : String(thrown) });
|
|
2181
2199
|
}
|
|
2182
2200
|
if (platform.verify !== void 0) {
|
|
2183
2201
|
this.#check();
|
|
2184
2202
|
try {
|
|
2185
|
-
runShell([...platform.verify, temp],
|
|
2203
|
+
runShell([...platform.verify, temp], shell);
|
|
2186
2204
|
} catch (thrown) {
|
|
2187
2205
|
throw new SEAError("SIGN", "Signature verification failed", { cause: thrown instanceof Error ? thrown.message : String(thrown) });
|
|
2188
2206
|
}
|
|
@@ -2213,7 +2231,7 @@ var SEA = class {
|
|
|
2213
2231
|
file: resolve(root, sign.file)
|
|
2214
2232
|
} : sign, temp);
|
|
2215
2233
|
try {
|
|
2216
|
-
runShell(signArgs,
|
|
2234
|
+
runShell(signArgs, shell);
|
|
2217
2235
|
} catch {
|
|
2218
2236
|
throw new SEAError("SIGN", "Windows signing failed", { executable: temp });
|
|
2219
2237
|
}
|
|
@@ -2221,7 +2239,7 @@ var SEA = class {
|
|
|
2221
2239
|
if (platform.verify !== void 0) {
|
|
2222
2240
|
this.#check();
|
|
2223
2241
|
try {
|
|
2224
|
-
runShell([...platform.verify, temp],
|
|
2242
|
+
runShell([...platform.verify, temp], shell);
|
|
2225
2243
|
} catch {
|
|
2226
2244
|
throw new SEAError("SIGN", "Signature verification failed", { executable: temp });
|
|
2227
2245
|
}
|
|
@@ -2249,7 +2267,7 @@ var SEA = class {
|
|
|
2249
2267
|
executable: finalOutput,
|
|
2250
2268
|
signed,
|
|
2251
2269
|
stripped,
|
|
2252
|
-
terminal
|
|
2270
|
+
...terminal === void 0 ? {} : { terminal }
|
|
2253
2271
|
};
|
|
2254
2272
|
}
|
|
2255
2273
|
#assets(root) {
|
|
@@ -2287,8 +2305,8 @@ var AssetManager = class {
|
|
|
2287
2305
|
constructor(options) {
|
|
2288
2306
|
this.#root = options?.root ?? process.cwd();
|
|
2289
2307
|
this.#emitter = new Emitter({
|
|
2290
|
-
on: options
|
|
2291
|
-
error: options
|
|
2308
|
+
...options?.on === void 0 ? {} : { on: options.on },
|
|
2309
|
+
...options?.error === void 0 ? {} : { error: options.error }
|
|
2292
2310
|
});
|
|
2293
2311
|
this.#loadSea();
|
|
2294
2312
|
}
|
|
@@ -2460,6 +2478,6 @@ function createAssetManager(options) {
|
|
|
2460
2478
|
return new AssetManager(options);
|
|
2461
2479
|
}
|
|
2462
2480
|
//#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 };
|
|
2481
|
+
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
2482
|
|
|
2465
2483
|
//# sourceMappingURL=index.js.map
|