@camstack/system 1.2.2 → 1.2.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.
Files changed (51) hide show
  1. package/dist/addon-runner.js +2 -2
  2. package/dist/addon-runner.mjs +2 -2
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/device-manager/device-manager.addon.js +6 -2
  14. package/dist/builtins/device-manager/device-manager.addon.mjs +6 -2
  15. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  16. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  17. package/dist/builtins/hub-forwarder/index.js +1 -1
  18. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  19. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  20. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  21. package/dist/builtins/local-network/local-network.addon.js +1 -1
  22. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  23. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  24. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  25. package/dist/builtins/platform-probe/index.js +1 -1
  26. package/dist/builtins/platform-probe/index.mjs +1 -1
  27. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  28. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  29. package/dist/builtins/snapshot/index.js +1 -1
  30. package/dist/builtins/snapshot/index.mjs +1 -1
  31. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  32. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  33. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
  34. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
  35. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  36. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  37. package/dist/builtins/system-config/system-config.addon.js +1 -1
  38. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  39. package/dist/builtins/winston-logging/index.js +1 -1
  40. package/dist/builtins/winston-logging/index.mjs +1 -1
  41. package/dist/{dist-DTTTjPCL.mjs → dist-72yufD8v.mjs} +2 -1
  42. package/dist/{dist-CkdNC8US.js → dist-CQZxGJ8u.js} +2 -1
  43. package/dist/index.d.ts +2 -0
  44. package/dist/index.js +289 -12
  45. package/dist/index.mjs +286 -14
  46. package/dist/kernel/deps/ensure-addon-natives.d.ts +41 -0
  47. package/dist/kernel/deps/ensure-native-prebuilds.d.ts +40 -0
  48. package/dist/kernel/deps/manifest-native-deps.d.ts +17 -0
  49. package/dist/{manifest-python-deps-s_-uULmp.mjs → manifest-python-deps-6__QF75g.mjs} +88 -2
  50. package/dist/{manifest-python-deps-DRq5MreI.js → manifest-python-deps-Cd7ocUBi.js} +93 -1
  51. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-CkdNC8US.js");
2
+ const require_dist = require("./dist-CQZxGJ8u.js");
3
3
  let _camstack_types_node = require("@camstack/types/node");
4
4
  let node_http = require("node:http");
5
5
  let node_fs = require("node:fs");
@@ -439,6 +439,92 @@ function copyPrebuiltNativeDep(name, addonDir, logger) {
439
439
  }
440
440
  return false;
441
441
  }
442
+ /**
443
+ * Native packages the packaged desktop ships PREBUILT inside each bundled addon
444
+ * copy (`scripts/stage-deps.mjs` plants them), keyed to the platform SIBLING
445
+ * scopes that hold the N-API binary. The traditional `better-sqlite3` carries
446
+ * its `.node` in its own dir; `sharp`/`node-av` carry it in a `@img`/`@seydx`
447
+ * sibling.
448
+ */
449
+ var BUNDLED_NATIVE_SIBLING_SCOPES = {
450
+ "better-sqlite3": [],
451
+ sharp: ["@img"],
452
+ "node-av": ["@seydx"]
453
+ };
454
+ /** Bounded recursive scan for ANY `*.node` under `dir`. */
455
+ function hasAnyDotNode(dir, maxDepth) {
456
+ let entries;
457
+ try {
458
+ entries = node_fs.readdirSync(dir, { withFileTypes: true });
459
+ } catch {
460
+ return false;
461
+ }
462
+ for (const entry of entries) if (entry.isFile() && entry.name.endsWith(".node")) return true;
463
+ if (maxDepth <= 0) return false;
464
+ for (const entry of entries) if (entry.isDirectory() && hasAnyDotNode(node_path.join(dir, entry.name), maxDepth - 1)) return true;
465
+ return false;
466
+ }
467
+ /** Copy `<src>` → `<dst>` when `<src>` carries a `.node`. Best-effort. */
468
+ function copyPrebuiltModuleDir(src, dst, label, logger) {
469
+ if (!hasAnyDotNode(src, 5)) return;
470
+ if (hasAnyDotNode(dst, 5)) return;
471
+ try {
472
+ node_fs.rmSync(dst, {
473
+ recursive: true,
474
+ force: true
475
+ });
476
+ node_fs.mkdirSync(node_path.dirname(dst), { recursive: true });
477
+ node_fs.cpSync(src, dst, {
478
+ recursive: true,
479
+ dereference: true
480
+ });
481
+ logger.info("Prebuilt native module propagated from bundled addon copy", { meta: {
482
+ module: label,
483
+ src,
484
+ dst
485
+ } });
486
+ } catch (err) {
487
+ logger.warn("Prebuilt native module propagation failed (npm install will retry)", { meta: {
488
+ module: label,
489
+ src,
490
+ error: (0, _camstack_types_addon.errMsg)(err)
491
+ } });
492
+ }
493
+ }
494
+ /**
495
+ * Propagate PREBUILT native modules from a bundled addon copy's own
496
+ * `node_modules` (the packaged-desktop 'local' source at
497
+ * `<resources>/addons/<addon>`) into the freshly-copied target
498
+ * (`<data>/addons/@camstack/<addon>`), BEFORE the target's `npm install` runs.
499
+ *
500
+ * Why (Mac desktop first-boot FATAL, 2026-07-21): `installCopy` copies only
501
+ * `dist/` then `npm install`s the addon's runtime deps. On a toolchain-less Mac
502
+ * that install leaves the traditional native `better-sqlite3` SOURCE-ONLY in
503
+ * `<addon>/node_modules` — a broken copy that then SHADOWS the good hoisted
504
+ * `.node` NODE_PATH would otherwise resolve, crashing the runner with "Could
505
+ * not locate the bindings file". Seeding the prebuilt copy here makes the npm
506
+ * install treat the native as satisfied (no re-run of `prebuild-install`), so
507
+ * the good `.node` stays in place. A no-op in dev / docker where the source
508
+ * carries no bundled natives.
509
+ */
510
+ function copyBundledNativeModules(sourceDir, targetDir, logger) {
511
+ const srcNm = node_path.join(sourceDir, "node_modules");
512
+ if (!node_fs.existsSync(srcNm)) return;
513
+ const dstNm = node_path.join(targetDir, "node_modules");
514
+ for (const [name, scopes] of Object.entries(BUNDLED_NATIVE_SIBLING_SCOPES)) {
515
+ copyPrebuiltModuleDir(node_path.join(srcNm, name), node_path.join(dstNm, name), name, logger);
516
+ for (const scope of scopes) {
517
+ const scopeSrc = node_path.join(srcNm, scope);
518
+ let siblings;
519
+ try {
520
+ siblings = node_fs.readdirSync(scopeSrc);
521
+ } catch {
522
+ continue;
523
+ }
524
+ for (const sibling of siblings) copyPrebuiltModuleDir(node_path.join(scopeSrc, sibling), node_path.join(dstNm, scope, sibling), `${scope}/${sibling}`, logger);
525
+ }
526
+ }
527
+ }
442
528
  /** A package dir is "built" when it carries a compiled `.node` or a prebuilds tree. */
443
529
  function hasBuiltBinary(pkgDir) {
444
530
  if (!node_fs.existsSync(node_path.join(pkgDir, "package.json"))) return false;
@@ -7526,6 +7612,12 @@ Object.defineProperty(exports, "clusterEventTopic", {
7526
7612
  return clusterEventTopic;
7527
7613
  }
7528
7614
  });
7615
+ Object.defineProperty(exports, "copyBundledNativeModules", {
7616
+ enumerable: true,
7617
+ get: function() {
7618
+ return copyBundledNativeModules;
7619
+ }
7620
+ });
7529
7621
  Object.defineProperty(exports, "createAddonContext", {
7530
7622
  enumerable: true,
7531
7623
  get: function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",