seabox 0.1.0 → 0.1.2

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
@@ -25,6 +25,16 @@ Note: **V8 snapshot includes and embedds the original source**, this is currentl
25
25
  npm install --save-dev seabox
26
26
  ```
27
27
 
28
+ ### Optional: Windows Executable Metadata
29
+
30
+ If you want to customize Windows executable metadata (icon, version info), install `rcedit`:
31
+
32
+ ```bash
33
+ npm install --save-dev rcedit
34
+ ```
35
+
36
+ This is only needed if you use the `rcedit` configuration option.
37
+
28
38
  ## Configuration
29
39
 
30
40
  Create a `seabox.config.json` file in your project root:
@@ -217,8 +227,7 @@ You can also explicitly specify library patterns in your config:
217
227
  These files are extracted on first run (like `.node` files) since they need to be loaded from the filesystem.
218
228
 
219
229
  ### Code Signature Removal
220
-
221
- Required before SEA injection. Platform-specific tools needed:
230
+ If you have sign tools available, the seabox will attempt to unsign the node exe before modifying it. This is to reduce issues afterward when you try to resign it.
222
231
  - **Windows**: `signtool.exe` (from Windows SDK)
223
232
  - **macOS**: `codesign` (included with Xcode)
224
233
  - **Linux**: Not required
package/lib/bootstrap.cjs CHANGED
@@ -478,6 +478,9 @@
478
478
  const nameWithoutExt = path.basename(binary.fileName, path.extname(binary.fileName));
479
479
  nativeModuleMap[nameWithoutExt] = targetPath;
480
480
 
481
+ // CRITICAL: Also map the asset key (the path used in requires)
482
+ nativeModuleMap[binary.assetKey] = targetPath;
483
+
481
484
  // PHASE 2: Populate global asset map for fs overrides
482
485
  assetPathMapGlobal[binary.assetKey] = targetPath;
483
486
  }
package/lib/inject.mjs CHANGED
@@ -81,8 +81,19 @@ async function applyRcedit(exePath, options, verbose) {
81
81
  diag.verbose('Applying rcedit to modify executable resources...', 2);
82
82
  diag.verbose(`Options: ${JSON.stringify(options, null, 2)}`, 2);
83
83
 
84
- // Dynamic import for rcedit (it's CommonJS)
85
- const rcedit = (await import('rcedit')).default;
84
+ // Try to import rcedit - it's a peer dependency
85
+ let rcedit;
86
+ try {
87
+ rcedit = (await import('rcedit')).default;
88
+ } catch (error) {
89
+ if (error.code === 'ERR_MODULE_NOT_FOUND') {
90
+ throw new Error(
91
+ 'rcedit is required for Windows executable metadata but not installed. ' +
92
+ 'Install it with: npm install rcedit'
93
+ );
94
+ }
95
+ throw error;
96
+ }
86
97
 
87
98
  try {
88
99
  await rcedit(exePath, options);
@@ -262,11 +262,9 @@ export class MultiTargetBuilder {
262
262
  if (moduleInfo.isPrebuild) {
263
263
  diag.verbose(`Using prebuild: ${moduleName}`, 2);
264
264
 
265
- const relativeFromProject = path.relative(this.projectRoot, moduleInfo.binaryPath).replace(/\\/g, '/');
266
-
267
265
  rebuiltAssets.push({
268
266
  sourcePath: moduleInfo.binaryPath,
269
- assetKey: relativeFromProject,
267
+ assetKey: moduleInfo.assetKey, // Use original assetKey from bundler
270
268
  isBinary: true,
271
269
  hash: await this.computeHash(moduleInfo.binaryPath)
272
270
  });
@@ -279,12 +277,9 @@ export class MultiTargetBuilder {
279
277
  if (cachedBuild) {
280
278
  diag.verbose(`Using cached build: ${moduleName}`, 2);
281
279
 
282
- // Use relative path from project root
283
- const relativeFromProject = path.relative(this.projectRoot, cachedBuild).replace(/\\/g, '/');
284
-
285
280
  rebuiltAssets.push({
286
281
  sourcePath: cachedBuild,
287
- assetKey: relativeFromProject,
282
+ assetKey: moduleInfo.assetKey, // Use original assetKey from bundler
288
283
  isBinary: true,
289
284
  hash: await this.computeHash(cachedBuild)
290
285
  });
@@ -303,12 +298,9 @@ export class MultiTargetBuilder {
303
298
  // Cache the build
304
299
  this.cache.cacheNativeBuild(moduleInfo.packageRoot, target, builtPath);
305
300
 
306
- // Use relative path from project root
307
- const relativeFromProject = path.relative(this.projectRoot, builtPath).replace(/\\/g, '/');
308
-
309
301
  rebuiltAssets.push({
310
302
  sourcePath: builtPath,
311
- assetKey: relativeFromProject,
303
+ assetKey: moduleInfo.assetKey, // Use original assetKey from bundler
312
304
  isBinary: true,
313
305
  hash: await this.computeHash(builtPath)
314
306
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seabox",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Node.js Single Executable Application (SEA) builder tool with native and library extraction",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -34,17 +34,20 @@
34
34
  },
35
35
  "homepage": "https://github.com/MeirionHughes/seabox",
36
36
  "dependencies": {
37
- "@rollup/plugin-commonjs": "^28.0.2",
38
- "@rollup/plugin-json": "^6.1.0",
39
- "@rollup/plugin-node-resolve": "^15.3.0",
40
37
  "adm-zip": "^0.5.16",
41
38
  "glob": "^10.0.0",
42
39
  "postject": "^1.0.0-alpha.6",
43
- "rcedit": "^4.0.1",
44
40
  "rolldown": "^1.0.0-beta.50",
45
- "rollup": "^4.28.1",
46
41
  "tar": "^6.2.1"
47
42
  },
43
+ "peerDependencies": {
44
+ "rcedit": "^4.0.1"
45
+ },
46
+ "peerDependenciesMeta": {
47
+ "rcedit": {
48
+ "optional": true
49
+ }
50
+ },
48
51
  "devDependencies": {
49
52
  "chai": "^6.2.1",
50
53
  "javascript-obfuscator": "^4.1.1",