@omega.js/desktop 0.51.0 → 0.53.0

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 (289) hide show
  1. package/README.md +18 -13
  2. package/dist/assets/css/core/_initialize.scss +1 -1
  3. package/dist/assets/js/core/app-shell.js +14 -15
  4. package/dist/assets/themes/_template/_theme.js +6 -6
  5. package/dist/assets/themes/base/_includes/global/sections/account.html +4 -4
  6. package/dist/assets/themes/base/_includes/global/sections/app-sidebar.html +5 -5
  7. package/dist/assets/themes/base/_layouts/frontend/pages/account/index.html +3 -3
  8. package/dist/assets/themes/base/_layouts/frontend/pages/alternatives/index.html +1 -1
  9. package/dist/assets/themes/base/_layouts/frontend/pages/blog/tags/tag.html +1 -1
  10. package/dist/assets/themes/base/_layouts/frontend/pages/payment/confirmation.html +1 -1
  11. package/dist/assets/themes/base/_sections/marketing/newsletter-cta/section.js +2 -3
  12. package/dist/assets/themes/base/_sections/verts/unit/section.html +1 -1
  13. package/dist/assets/themes/base/_sections/verts/unit/section.js +3 -4
  14. package/dist/assets/themes/base/_theme.js +4 -3
  15. package/dist/assets/themes/bootstrap/_theme.js +2 -2
  16. package/dist/assets/themes/bootstrap/overrides/_links.scss +1 -1
  17. package/dist/assets/themes/classy/_theme.js +8 -6
  18. package/dist/assets/themes/classy/css/marketing/_sections.scss +1 -2
  19. package/dist/assets/themes/classy/js/hero-demo-form.js +3 -2
  20. package/dist/assets/themes/neobrutalism/_theme.js +5 -5
  21. package/dist/assets/themes/neobrutalism/js/pages/test/libraries/layers/index.js +1 -1
  22. package/dist/assets/themes/newsflash/_theme.js +6 -6
  23. package/dist/assets/themes/newsflash/js/pages/test/libraries/layers/index.js +1 -1
  24. package/dist/build.js +87 -111
  25. package/dist/cli.js +1 -1
  26. package/dist/commands/build.js +2 -2
  27. package/dist/commands/cdp/capture.js +2 -2
  28. package/dist/commands/cdp/quit.js +2 -2
  29. package/dist/commands/cdp/relaunch.js +2 -2
  30. package/dist/commands/cdp/theme.js +1 -1
  31. package/dist/commands/clean.js +2 -2
  32. package/dist/commands/deploy.js +4 -4
  33. package/dist/commands/finalize-release.js +4 -4
  34. package/dist/commands/install.js +3 -3
  35. package/dist/commands/launch.js +2 -2
  36. package/dist/commands/lib/deploy-precheck.js +3 -3
  37. package/dist/commands/lib/ensure-target.js +6 -6
  38. package/dist/commands/package.js +2 -2
  39. package/dist/commands/publish.js +2 -2
  40. package/dist/commands/release.js +3 -3
  41. package/dist/commands/runner.js +145 -48
  42. package/dist/commands/sign-windows.js +5 -5
  43. package/dist/commands/test.js +4 -4
  44. package/dist/commands/update.js +2 -2
  45. package/dist/commands/validate-certs.js +4 -4
  46. package/dist/commands/version.js +3 -3
  47. package/dist/defaults/.github/workflows/build.yml +2 -0
  48. package/dist/defaults/AGENTS.md +17 -8
  49. package/dist/defaults/config/omega.json5 +7 -7
  50. package/dist/defaults/hooks/build/post.js +1 -1
  51. package/dist/defaults/hooks/build/pre.js +1 -1
  52. package/dist/defaults/hooks/deploy/pre.js +1 -1
  53. package/dist/defaults/hooks/release/post.js +1 -1
  54. package/dist/defaults/hooks/release/pre.js +1 -1
  55. package/dist/defaults/src/assets/js/components/about/index.js +3 -5
  56. package/dist/defaults/src/assets/js/components/main/index.js +3 -5
  57. package/dist/defaults/src/assets/js/components/settings/index.js +3 -5
  58. package/dist/defaults/src/integrations/context-menu/index.js +2 -2
  59. package/dist/defaults/src/integrations/menu/index.js +3 -3
  60. package/dist/defaults/src/integrations/tray/index.js +3 -3
  61. package/dist/defaults/src/main.js +3 -5
  62. package/dist/defaults/src/preload.js +3 -5
  63. package/dist/defaults/test/README.md +2 -2
  64. package/dist/gulp/main.js +9 -10
  65. package/dist/gulp/tasks/audit.js +7 -7
  66. package/dist/gulp/tasks/build-config.js +8 -8
  67. package/dist/gulp/tasks/bundle.js +16 -16
  68. package/dist/gulp/tasks/defaults.js +3 -3
  69. package/dist/gulp/tasks/distribute.js +2 -2
  70. package/dist/gulp/tasks/html.js +9 -9
  71. package/dist/gulp/tasks/package-quick.js +3 -3
  72. package/dist/gulp/tasks/package.js +3 -3
  73. package/dist/gulp/tasks/release.js +3 -3
  74. package/dist/gulp/tasks/sass.js +6 -6
  75. package/dist/gulp/tasks/serve.js +4 -4
  76. package/dist/hooks/notarize-artifacts.js +1 -1
  77. package/dist/hooks/notarize.js +1 -1
  78. package/dist/index.js +5 -8
  79. package/dist/lib/_environment-mixin.js +50 -0
  80. package/dist/lib/_lifecycle-mixin.js +45 -0
  81. package/dist/lib/analytics.js +33 -35
  82. package/dist/lib/app-state.js +14 -14
  83. package/dist/lib/auth-flow.js +18 -18
  84. package/dist/lib/auth-persistence.js +12 -12
  85. package/dist/lib/auth.js +421 -0
  86. package/dist/lib/auto-updater.js +49 -49
  87. package/dist/lib/context-menu.js +13 -13
  88. package/dist/lib/context.js +19 -19
  89. package/dist/lib/deep-link.js +34 -34
  90. package/dist/lib/fontawesome.js +5 -5
  91. package/dist/lib/ipc.js +4 -4
  92. package/dist/lib/menu.js +25 -25
  93. package/dist/lib/protocol.js +5 -5
  94. package/dist/lib/remote-config.js +22 -22
  95. package/dist/lib/remote-scripts.js +21 -21
  96. package/dist/lib/restart-manager/index.js +28 -28
  97. package/dist/lib/sign-helpers/exec-with-limit.js +1 -1
  98. package/dist/lib/sign-helpers/sign-events.js +1 -1
  99. package/dist/lib/startup.js +18 -13
  100. package/dist/lib/storage.js +10 -10
  101. package/dist/lib/templating.js +16 -16
  102. package/dist/lib/theme.js +10 -10
  103. package/dist/lib/tray.js +27 -27
  104. package/dist/lib/usage.js +11 -11
  105. package/dist/lib/window-manager.js +26 -26
  106. package/dist/main.js +398 -483
  107. package/dist/preload.js +236 -176
  108. package/dist/renderer.js +417 -391
  109. package/dist/runner/job-started.js +1 -1
  110. package/dist/test/fixtures/consumer-app/config/omega.json5 +1 -1
  111. package/dist/test/fixtures/consumer-app/src/assets/js/components/main/index.js +8 -11
  112. package/dist/test/fixtures/consumer-app/src/main.js +5 -7
  113. package/dist/test/fixtures/consumer-app/src/preload.js +2 -2
  114. package/dist/test/harness/boot-entry.js +22 -20
  115. package/dist/test/harness/main-entry.js +31 -30
  116. package/dist/test/harness/renderer-entry.js +5 -5
  117. package/dist/test/harness/renderer-preload.js +137 -141
  118. package/dist/test/index.js +10 -10
  119. package/dist/test/runner.js +2 -2
  120. package/dist/test/runners/boot.js +7 -6
  121. package/dist/test/runners/electron.js +3 -2
  122. package/dist/test/runners/render-event.js +2 -2
  123. package/dist/test/suites/boot/consumer-app-boots.test.js +57 -26
  124. package/dist/test/suites/boot/restart-manager.test.js +2 -2
  125. package/dist/test/suites/boot/storage-bundled.test.js +5 -5
  126. package/dist/test/suites/boot/theme.test.js +13 -13
  127. package/dist/test/suites/build/audit.test.js +1 -1
  128. package/dist/test/suites/build/auth-persistence-resolve.test.js +6 -6
  129. package/dist/test/suites/build/boot-fixture.test.js +2 -2
  130. package/dist/test/suites/build/boot-runner-timeout.test.js +6 -5
  131. package/dist/test/suites/build/brand-scss.test.js +1 -1
  132. package/dist/test/suites/build/build-json-bake.test.js +1 -1
  133. package/dist/test/suites/build/cli.test.js +2 -2
  134. package/dist/test/suites/build/config-schema.test.js +5 -5
  135. package/dist/test/suites/build/defaults-scaffold.test.js +2 -2
  136. package/dist/test/suites/build/deploy-hook.test.js +3 -3
  137. package/dist/test/suites/build/ensure-target.test.js +2 -2
  138. package/dist/test/suites/build/env-delivery.test.js +2 -2
  139. package/dist/test/suites/build/esm-only-dependency.test.js +2 -2
  140. package/dist/test/suites/build/exports.test.js +9 -8
  141. package/dist/test/suites/build/get-config.test.js +4 -4
  142. package/dist/test/suites/build/manifest-deps.test.js +1 -1
  143. package/dist/test/suites/build/merge-line-files.test.js +1 -1
  144. package/dist/test/suites/build/omega-shell.test.js +34 -2
  145. package/dist/test/suites/build/omega.test.js +350 -0
  146. package/dist/test/suites/build/renderer-auth-bridge.test.js +211 -78
  147. package/dist/test/suites/build/runner.test.js +612 -5
  148. package/dist/test/suites/build/sentry.test.js +2 -2
  149. package/dist/test/suites/build/sign-windows-e2e.test.js +2 -2
  150. package/dist/test/suites/build/templating.test.js +3 -3
  151. package/dist/test/suites/build/test-stealth.test.js +7 -9
  152. package/dist/test/suites/build/url-helpers.test.js +55 -56
  153. package/dist/test/suites/build/validate-config.test.js +2 -2
  154. package/dist/test/suites/build/wave5-pins.test.js +2 -2
  155. package/dist/test/suites/main/analytics.test.js +59 -59
  156. package/dist/test/suites/main/app-state.test.js +66 -66
  157. package/dist/test/suites/main/auth-flow.test.js +41 -41
  158. package/dist/test/suites/main/auth-persistence.test.js +54 -43
  159. package/dist/test/suites/main/{client-bridge.integration.test.js → auth.integration.test.js} +10 -9
  160. package/dist/test/suites/main/auth.test.js +336 -0
  161. package/dist/test/suites/main/auto-updater.test.js +134 -134
  162. package/dist/test/suites/main/boot-sequence.test.js +37 -49
  163. package/dist/test/suites/main/context-menu.test.js +51 -50
  164. package/dist/test/suites/main/context.test.js +25 -25
  165. package/dist/test/suites/main/deep-link.test.js +74 -74
  166. package/dist/test/suites/main/fontawesome.test.js +27 -27
  167. package/dist/test/suites/main/ipc.test.js +35 -35
  168. package/dist/test/suites/main/menu.test.js +101 -100
  169. package/dist/test/suites/main/protocol.test.js +19 -19
  170. package/dist/test/suites/main/remote-config.test.js +63 -63
  171. package/dist/test/suites/main/remote-scripts.test.js +103 -103
  172. package/dist/test/suites/main/request.test.js +71 -0
  173. package/dist/test/suites/main/restart-manager.test.js +33 -33
  174. package/dist/test/suites/main/startup-paths-and-ua.test.js +4 -4
  175. package/dist/test/suites/main/startup.test.js +26 -26
  176. package/dist/test/suites/main/stealth-window.test.js +1 -1
  177. package/dist/test/suites/main/storage.test.js +25 -25
  178. package/dist/test/suites/main/theme.test.js +34 -34
  179. package/dist/test/suites/main/tray.test.js +79 -79
  180. package/dist/test/suites/main/url-helpers.test.js +133 -133
  181. package/dist/test/suites/main/usage.test.js +25 -25
  182. package/dist/test/suites/main/window-bounds.test.js +27 -27
  183. package/dist/test/suites/main/window-manager.test.js +44 -44
  184. package/dist/test/suites/renderer/analytics-bridge.test.js +5 -5
  185. package/dist/test/suites/renderer/cross-context-helpers.test.js +37 -31
  186. package/dist/test/suites/renderer/round-trip.test.js +3 -3
  187. package/dist/test/suites/renderer/tooltips.test.js +15 -15
  188. package/dist/test/suites/renderer/{window-em-surface.test.js → window-desktop-surface.test.js} +27 -7
  189. package/dist/test/utils/extended-mode-warning.js +1 -1
  190. package/dist/utils/boot-harness.js +56 -0
  191. package/dist/utils/mode-helpers.js +2 -15
  192. package/dist/utils/ship-keys.js +3 -3
  193. package/dist/utils/signing-status.js +51 -0
  194. package/dist/utils/test-events.js +7 -0
  195. package/dist/utils/test-stealth.js +6 -6
  196. package/dist/utils/url-helpers.js +52 -42
  197. package/dist/utils/user-agent.js +44 -0
  198. package/dist/vendor/account/engine.js +3 -3
  199. package/dist/vendor/account/index.js +14 -45
  200. package/dist/vendor/account/resolve-account.js +44 -0
  201. package/dist/vendor/account/schema.js +1 -1
  202. package/dist/vendor/account/user.js +99 -0
  203. package/dist/vendor/config/client-config.js +1 -1
  204. package/dist/vendor/config/environment.js +11 -30
  205. package/dist/vendor/config/index.js +13 -12
  206. package/dist/vendor/config/load.js +1 -2
  207. package/dist/vendor/config/platforms.js +1 -1
  208. package/dist/vendor/config/repo.js +24 -0
  209. package/dist/vendor/config/retired-keys.js +2 -2
  210. package/dist/vendor/config/schema.js +5 -8
  211. package/dist/vendor/config/site-global.js +2 -3
  212. package/dist/vendor/config/validate.js +1 -2
  213. package/dist/vendor/config/winback.js +1 -1
  214. package/dist/vendor/devkit/actions-secrets.js +1 -1
  215. package/dist/vendor/devkit/attach-log-file.js +1 -1
  216. package/dist/vendor/devkit/brand-version.js +162 -1
  217. package/dist/vendor/devkit/build-json.js +1 -1
  218. package/dist/vendor/devkit/cli-router.js +3 -4
  219. package/dist/vendor/devkit/defaults-engine.js +9 -11
  220. package/dist/vendor/devkit/deploy.js +64 -4
  221. package/dist/vendor/devkit/git-remote.js +78 -1
  222. package/dist/vendor/devkit/local.js +53 -3
  223. package/dist/vendor/devkit/lockfile.js +127 -0
  224. package/dist/vendor/devkit/merge-line-files.js +2 -3
  225. package/dist/vendor/devkit/pack-local.js +4 -7
  226. package/dist/vendor/devkit/preludes/origin-heal.js +35 -49
  227. package/dist/vendor/devkit/target-secrets.js +34 -45
  228. package/dist/vendor/devkit/test/runner-core.js +6 -6
  229. package/dist/vendor/monitoring/env.js +2 -2
  230. package/dist/vendor/monitoring/index.js +1 -1
  231. package/dist/vendor/monitoring/main.js +1 -1
  232. package/dist/vendor/monitoring/preload.js +1 -1
  233. package/dist/vendor/monitoring/renderer.js +1 -1
  234. package/docs/analytics.md +8 -8
  235. package/docs/app-state.md +19 -19
  236. package/docs/audit.md +4 -4
  237. package/docs/{client-bridge.md → auth.md} +88 -73
  238. package/docs/auto-updater.md +8 -8
  239. package/docs/boot-sequence.md +11 -6
  240. package/docs/build-system.md +1 -1
  241. package/docs/cdp-debugging.md +1 -1
  242. package/docs/common-mistakes.md +7 -7
  243. package/docs/config-schema.md +1 -1
  244. package/docs/context-menu.md +13 -13
  245. package/docs/context.md +11 -11
  246. package/docs/css.md +3 -9
  247. package/docs/deep-link.md +25 -25
  248. package/docs/environment-detection.md +16 -16
  249. package/docs/fontawesome.md +7 -5
  250. package/docs/hooks.md +8 -8
  251. package/docs/index.md +39 -28
  252. package/docs/ipc.md +10 -10
  253. package/docs/lib-modules.md +9 -9
  254. package/docs/logging.md +12 -14
  255. package/docs/menu.md +18 -18
  256. package/docs/releasing.md +4 -2
  257. package/docs/remote-config.md +9 -9
  258. package/docs/remote-scripts.md +12 -12
  259. package/docs/restart-manager.md +8 -8
  260. package/docs/runner.md +12 -10
  261. package/docs/sentry.md +4 -4
  262. package/docs/shared/analytics.md +1 -1
  263. package/docs/shared/brands.md +1 -1
  264. package/docs/shared/breaking-changes.md +79 -13
  265. package/docs/shared/config.md +24 -21
  266. package/docs/shared/deploys.md +30 -7
  267. package/docs/shared/local-dev.md +5 -3
  268. package/docs/shared/logging.md +1 -1
  269. package/docs/shared/monitoring.md +5 -5
  270. package/docs/shared/testing.md +2 -2
  271. package/docs/shared/theming.md +1 -1
  272. package/docs/shared/translation.md +19 -10
  273. package/docs/signing.md +1 -1
  274. package/docs/startup.md +16 -16
  275. package/docs/storage.md +11 -11
  276. package/docs/templating.md +3 -3
  277. package/docs/test-boot-layer.md +12 -12
  278. package/docs/test-framework.md +17 -17
  279. package/docs/themes.md +7 -7
  280. package/docs/tooltips.md +2 -2
  281. package/docs/tray.md +31 -31
  282. package/docs/usage.md +7 -7
  283. package/docs/verts.md +1 -1
  284. package/docs/windows.md +22 -22
  285. package/package.json +3 -4
  286. package/dist/lib/client-bridge.js +0 -374
  287. package/dist/lib/logger.js +0 -4
  288. package/dist/test/suites/build/manager.test.js +0 -213
  289. package/dist/test/suites/main/client-bridge.test.js +0 -262
package/dist/build.js CHANGED
@@ -1,96 +1,71 @@
1
+ // The build-time module: one plain object of functions every gulp task, verb
2
+ // and consumer hook reads (`const build = require('@omega.js/desktop/build')`).
3
+ // No class and no `new`, the shape @omega.js/web's and @omega.js/extension's
4
+ // build modules share.
5
+
1
6
  // Libraries
2
7
  const path = require('path');
3
8
  const jetpack = require('fs-jetpack');
4
9
  const { setEnvironment, buildLaneEnvironment } = require('./vendor/config/environment.js');
5
10
  const fs = require('fs');
6
11
  const JSON5 = require('json5');
7
- const { force, execute } = require('node-powertools');
12
+ const { force } = require('node-powertools');
8
13
  const { parseArgv } = require('./vendor/devkit/argv.js');
14
+ const { getEnvironment, isDevelopment, isProduction, isTesting, getVersion } = require('./utils/mode-helpers.js');
9
15
 
10
- // Class
11
- function Manager() {
12
- const self = this;
13
-
14
- // Properties
15
- self._logger = null;
16
-
17
- // Return
18
- return self;
16
+ // Logger: a named build logger
17
+ function logger(name) {
18
+ return new (require('./vendor/devkit/logger.js'))(name);
19
19
  }
20
20
 
21
- // Initialize (build-time hook)
22
- Manager.prototype.initialize = function () {
23
- console.log('initialize:');
24
- };
25
-
26
- // Logger
27
- Manager.prototype.logger = function (name) {
28
- // Static-style call
29
- if (!(this instanceof Manager)) {
30
- return new (require('./lib/logger'))(name);
31
- }
32
-
33
- // Cache one logger per Manager instance
34
- if (!this._logger) {
35
- this._logger = new (require('./lib/logger'))(name);
36
- }
37
-
38
- return this._logger;
39
- };
40
-
41
21
  // argv: the gulp lane's own parse. It is spawned with the TASK NAME alone
42
22
  // (`npm run gulp -- build`), so `debug` is the one flag it declares.
43
- Manager.getArguments = function () {
23
+ function getArguments() {
44
24
  const options = parseArgv(process.argv.slice(2), { booleans: ['debug'] });
45
25
 
46
26
  options.debug = force(options.debug === undefined ? false : options.debug, 'boolean');
47
27
 
48
28
  return options;
49
- };
50
- Manager.prototype.getArguments = Manager.getArguments;
29
+ }
51
30
 
52
- // Report build errors with notification (parity with BXM)
53
- Manager.reportBuildError = function (error, callback) {
54
- const logger = new (require('./lib/logger'))('build-error');
31
+ // Report build errors with notification (parity with @omega.js/extension)
32
+ function reportBuildError(error, callback) {
33
+ const log = logger('build-error');
55
34
  const errorMessage = error.message || error.toString() || 'Unknown error';
56
35
  const errorPlugin = error.plugin || 'Build';
57
36
 
58
- logger.error(`[${errorPlugin}] ${errorMessage}`);
37
+ log.error(`[${errorPlugin}] ${errorMessage}`);
59
38
 
60
39
  if (callback) {
61
40
  return callback(error);
62
41
  }
63
42
 
64
43
  return (cb) => cb ? cb(error) : error;
65
- };
66
- Manager.prototype.reportBuildError = Manager.reportBuildError;
44
+ }
67
45
 
68
46
  // Mode flags
69
- Manager.isBuildMode = function () {
47
+ function isBuildMode() {
70
48
  return process.env.OMEGA_BUILD_MODE === 'true';
71
- };
72
- Manager.prototype.isBuildMode = Manager.isBuildMode;
49
+ }
73
50
 
74
- Manager.isPublishMode = function () {
51
+ function isPublishMode() {
75
52
  return process.env.OMEGA_IS_PUBLISH === 'true';
76
- };
77
- Manager.prototype.isPublishMode = Manager.isPublishMode;
53
+ }
78
54
 
79
- Manager.isServerMode = function () {
55
+ function isServerMode() {
80
56
  return process.env.OMEGA_IS_SERVER === 'true';
81
- };
82
- Manager.prototype.isServerMode = Manager.isServerMode;
57
+ }
83
58
 
84
- Manager.actLikeProduction = function () {
85
- return Boolean(Manager.isBuildMode() || process.env.OMEGA_AUDIT_FORCE === 'true');
86
- };
87
- Manager.prototype.actLikeProduction = Manager.actLikeProduction;
59
+ function actLikeProduction() {
60
+ return Boolean(isBuildMode() || process.env.OMEGA_AUDIT_FORCE === 'true');
61
+ }
88
62
 
89
63
  // The environment is the ONE module's (@omega.js/config's environment.js,
90
64
  // [#817](https://github.com/Omega-JS-Stack/omega/issues/817)), reachable from
91
- // all four @omega.js/desktop Manager entry points (main / renderer / preload /
92
- // build) through the mode-helpers attachTo() call at the bottom of each, so
93
- // every context resolves it identically. It reads ONE input and never guesses.
65
+ // all four @omega.js/desktop entry points (the main / renderer / preload `Omega`
66
+ // classes and this build module) through the same plain functions in
67
+ // utils/mode-helpers.js, so every context resolves it identically. It reads ONE
68
+ // input and never guesses.
94
69
  //
95
70
  // THIS FILE IS THE NODE LANE'S ONE SETTER, and it runs at load, before any
96
71
  // gulp task, verb or getConfig() asks. Two rules, no sniffing:
@@ -108,19 +83,18 @@ Manager.prototype.actLikeProduction = Manager.actLikeProduction;
108
83
  // The electron app this lane spawns inherits the variable; a PACKAGED app has
109
84
  // no parent env, so main.js sets it from the baked config instead (the same
110
85
  // word, written into the artifact by the bundle task).
111
- setEnvironment(buildLaneEnvironment(Manager.isBuildMode()));
86
+ setEnvironment(buildLaneEnvironment(isBuildMode()));
112
87
 
113
- Manager.getMode = function () {
88
+ function getMode() {
114
89
  return {
115
- build: Manager.isBuildMode(),
116
- publish: Manager.isPublishMode(),
117
- server: Manager.isServerMode(),
118
- environment: Manager.getEnvironment(),
90
+ build: isBuildMode(),
91
+ publish: isPublishMode(),
92
+ server: isServerMode(),
93
+ environment: getEnvironment(),
119
94
  };
120
- };
121
- Manager.prototype.getMode = Manager.getMode;
95
+ }
122
96
 
123
- // Config — the consumer's config/omega.json5 resolved for the desktop target via
97
+ // Config: the consumer's config/omega.json5 resolved for the desktop target via
124
98
  // @omega.js/config: shared sections (brand, cloud, analytics, payment, monitoring,
125
99
  // theme) at the top level, targets.desktop overlaid onto them (so app/platforms/startup/
126
100
  // releases/... land at the top level here), and in a brand monorepo the brand root's
@@ -136,7 +110,7 @@ Manager.prototype.getMode = Manager.getMode;
136
110
  // app.productName ← brand.name if not set
137
111
  // These keep the consumer's config minimal: setting `brand: { id: 'foo', name: 'Foo',
138
112
  // url: 'https://foo.com' }` is enough; appId/productName flow through automatically.
139
- Manager.getConfig = function () {
113
+ function getConfig() {
140
114
  const { hasOmegaConfig, loadConfig, composeBundleId, deriveBundleIdPrefix } = require('./vendor/config/index.js');
141
115
 
142
116
  // WHICH environment overlay composes
@@ -147,7 +121,7 @@ Manager.getConfig = function () {
147
121
  // every other read in the process answers from, so the overlay that composes
148
122
  // and the environment the artifact records can never be two different words.
149
123
  // Same rule, same shape, in @omega.js/extension's getConfig.
150
- const environment = Manager.getEnvironment();
124
+ const environment = getEnvironment();
151
125
 
152
126
  // No config at all (fresh dir, non-consumer cwd) → seeded empty shape below; the
153
127
  // schema validation in audit/boot reports what's actually missing.
@@ -184,11 +158,10 @@ Manager.getConfig = function () {
184
158
  if (!config.app.productName && config.brand.name) config.app.productName = config.brand.name;
185
159
 
186
160
  return config;
187
- };
188
- Manager.prototype.getConfig = Manager.getConfig;
161
+ }
189
162
 
190
163
  // package.json
191
- Manager.getPackage = function (type) {
164
+ function getPackage(type) {
192
165
  const basePath = type === 'project'
193
166
  ? process.cwd()
194
167
  : path.resolve(__dirname, '..');
@@ -201,35 +174,31 @@ Manager.getPackage = function (type) {
201
174
  }
202
175
 
203
176
  return JSON5.parse(raw);
204
- };
205
- Manager.prototype.getPackage = Manager.getPackage;
177
+ }
206
178
 
207
179
  // Root path
208
- Manager.getRootPath = function (type) {
180
+ function getRootPath(type) {
209
181
  return type === 'project'
210
182
  ? process.cwd()
211
183
  : path.resolve(__dirname, '..');
212
- };
213
- Manager.prototype.getRootPath = Manager.getRootPath;
184
+ }
214
185
 
215
186
  // Live reload port
216
- Manager.getLiveReloadPort = function () {
187
+ function getLiveReloadPort() {
217
188
  process.env.OMEGA_LIVERELOAD_PORT = process.env.OMEGA_LIVERELOAD_PORT || 35729;
218
189
  return parseInt(process.env.OMEGA_LIVERELOAD_PORT, 10);
219
- };
220
- Manager.prototype.getLiveReloadPort = Manager.getLiveReloadPort;
190
+ }
221
191
 
222
192
  // Windows signing strategy. Config-only: `platforms.windows.signing.strategy`
223
193
  // (targets.desktop.platforms.windows in the raw omega.json5). Default 'self-hosted'.
224
- Manager.getWindowsSignStrategy = function () {
225
- const config = Manager.getConfig();
194
+ function getWindowsSignStrategy() {
195
+ const config = getConfig();
226
196
  return config?.platforms?.windows?.signing?.strategy || 'self-hosted';
227
- };
228
- Manager.prototype.getWindowsSignStrategy = Manager.getWindowsSignStrategy;
197
+ }
229
198
 
230
199
  // Touch files to trigger a rebuild watcher
231
- Manager.triggerRebuild = function (files, logger) {
232
- logger = this?._logger || logger || console;
200
+ function triggerRebuild(files, log) {
201
+ log = log || console;
233
202
 
234
203
  if (typeof files === 'string') {
235
204
  files = [files];
@@ -238,7 +207,7 @@ Manager.triggerRebuild = function (files, logger) {
238
207
  } else if (typeof files === 'object' && files !== null) {
239
208
  files = Object.keys(files);
240
209
  } else {
241
- logger.error('Invalid files for triggerRebuild()');
210
+ log.error('Invalid files for triggerRebuild()');
242
211
  return;
243
212
  }
244
213
 
@@ -247,24 +216,15 @@ Manager.triggerRebuild = function (files, logger) {
247
216
  files.forEach((file) => {
248
217
  try {
249
218
  fs.utimesSync(file, now, now);
250
- logger.log(`Triggered build: ${file}`);
219
+ log.log(`Triggered build: ${file}`);
251
220
  } catch (e) {
252
- logger.error(`Failed to trigger build ${file}`, e);
221
+ log.error(`Failed to trigger build ${file}`, e);
253
222
  }
254
223
  });
255
- };
256
- Manager.prototype.triggerRebuild = Manager.triggerRebuild;
257
-
258
- // Generic require passthrough (lets gulp tasks dynamically load lib modules).
259
- // Only ever called from gulp tasks (release / package / bundle), which run
260
- // un-bundled — so plain require is fine.
261
- Manager.require = function (p) {
262
- return require(p);
263
- };
264
- Manager.prototype.require = Manager.require;
224
+ }
265
225
 
266
226
  // Memory usage
267
- Manager.getMemoryUsage = function () {
227
+ function getMemoryUsage() {
268
228
  const used = process.memoryUsage();
269
229
  return {
270
230
  rss: Math.round(used.rss / 1024 / 1024),
@@ -272,19 +232,35 @@ Manager.getMemoryUsage = function () {
272
232
  heapUsed: Math.round(used.heapUsed / 1024 / 1024),
273
233
  external: Math.round(used.external / 1024 / 1024),
274
234
  };
275
- };
276
- Manager.prototype.getMemoryUsage = Manager.getMemoryUsage;
277
-
278
- Manager.logMemory = function (logger, label) {
279
- const mem = Manager.getMemoryUsage();
280
- logger.log(`[Memory ${label}] RSS: ${mem.rss}MB | Heap Used: ${mem.heapUsed}MB / ${mem.heapTotal}MB | External: ${mem.external}MB`);
281
- };
282
- Manager.prototype.logMemory = Manager.logMemory;
235
+ }
283
236
 
284
- // Mix in shared cross-context helpers — same code path used in main, renderer, preload.
285
- // All four contexts share the exact same implementation.
286
- require('./utils/mode-helpers.js').attachTo(Manager);
287
- require('./utils/url-helpers.js').attachTo(Manager);
237
+ function logMemory(log, label) {
238
+ const mem = getMemoryUsage();
239
+ log.log(`[Memory ${label}] RSS: ${mem.rss}MB | Heap Used: ${mem.heapUsed}MB / ${mem.heapTotal}MB | External: ${mem.external}MB`);
240
+ }
288
241
 
289
- // Export
290
- module.exports = Manager;
242
+ // Export: the environment four + getVersion() come from the same plain
243
+ // functions the runtime `Omega` classes call
244
+ module.exports = {
245
+ logger,
246
+ getArguments,
247
+ reportBuildError,
248
+ isBuildMode,
249
+ isPublishMode,
250
+ isServerMode,
251
+ actLikeProduction,
252
+ getMode,
253
+ getConfig,
254
+ getPackage,
255
+ getRootPath,
256
+ getLiveReloadPort,
257
+ getWindowsSignStrategy,
258
+ triggerRebuild,
259
+ getMemoryUsage,
260
+ logMemory,
261
+ getEnvironment,
262
+ isDevelopment,
263
+ isProduction,
264
+ isTesting,
265
+ getVersion,
266
+ };
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ const { isBoxVerbArgv } = require('./vendor/devkit/omega-bin.js');
19
19
  // reading of it, covering the bare verb and its `--` flag spelling alike.
20
20
  if (!isBoxVerbArgv(process.argv.slice(2))) {
21
21
  require('./utils/load-env.js').loadDesktopEnv(process.cwd(), {
22
- logger: new (require('./lib/logger.js'))('env'),
22
+ logger: new (require('./vendor/devkit/logger.js'))('env'),
23
23
  });
24
24
  }
25
25
 
@@ -1,6 +1,6 @@
1
1
  // Libraries
2
- const Manager = new (require('../build.js'));
3
- const logger = Manager.logger('build');
2
+ const build = require('../build.js');
3
+ const logger = build.logger('build');
4
4
  const { runPipeline } = require('../utils/build-pipeline.js');
5
5
  const { ensureTarget } = require('./lib/ensure-target.js');
6
6
 
@@ -21,7 +21,7 @@
21
21
  const { execFileSync } = require('child_process');
22
22
  const client = require('./client');
23
23
 
24
- const Manager = new (require('../../build.js'))();
24
+ const build = require('../../build.js');
25
25
 
26
26
  const SRGB_PROFILE = '/System/Library/ColorSync/Profiles/sRGB Profile.icc';
27
27
 
@@ -65,7 +65,7 @@ module.exports = async function (options) {
65
65
  throw new Error('mgr cdp capture is macOS-only (screencapture/sips/osascript)');
66
66
  }
67
67
 
68
- const names = client.appNames(Manager.getConfig());
68
+ const names = client.appNames(build.getConfig());
69
69
 
70
70
  if (options['find-window-id'] || options.findWindowId) {
71
71
  console.log(findWindowIds(names) || `no windows found (tried: ${names.join(', ')})`);
@@ -9,7 +9,7 @@
9
9
  const { execFileSync } = require('child_process');
10
10
  const client = require('./client');
11
11
 
12
- const Manager = new (require('../../build.js'))();
12
+ const build = require('../../build.js');
13
13
 
14
14
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
15
15
 
@@ -77,7 +77,7 @@ async function quitAndDrain(names) {
77
77
  }
78
78
 
79
79
  module.exports = async function (options) {
80
- const wasRunning = await quitAndDrain(client.appNames(Manager.getConfig()));
80
+ const wasRunning = await quitAndDrain(client.appNames(build.getConfig()));
81
81
  console.log(wasRunning ? 'quit running app' : 'app was not running');
82
82
  };
83
83
 
@@ -17,7 +17,7 @@ const { spawn } = require('child_process');
17
17
  const client = require('./client');
18
18
  const { quitAndDrain } = require('./quit');
19
19
 
20
- const Manager = new (require('../../build.js'))();
20
+ const build = require('../../build.js');
21
21
 
22
22
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
23
23
 
@@ -42,7 +42,7 @@ async function waitForBoot(matcher) {
42
42
  }
43
43
 
44
44
  module.exports = async function (options) {
45
- const config = Manager.getConfig();
45
+ const config = build.getConfig();
46
46
 
47
47
  const wasRunning = await quitAndDrain(client.appNames(config));
48
48
  console.log(wasRunning ? 'quit running app' : 'app was not running');
@@ -1,5 +1,5 @@
1
1
  // `npx omega cdp theme <dark|light|system>` — flip the app's theme live
2
- // (manager.theme via the main window's renderer).
2
+ // (omega.theme via the main window's renderer).
3
3
  //
4
4
  // Flips every renderer (BrowserWindows AND WebContentsViews) with no restart —
5
5
  // nativeTheme.themeSource → prefers-color-scheme → the preload applier
@@ -1,6 +1,6 @@
1
1
  // Libraries
2
- const Manager = new (require('../build.js'));
3
- const logger = Manager.logger('clean');
2
+ const build = require('../build.js');
3
+ const logger = build.logger('clean');
4
4
  const { cleanDirs } = require('../vendor/devkit/clean-dirs.js');
5
5
  const { ensureTarget } = require('./lib/ensure-target.js');
6
6
 
@@ -18,8 +18,8 @@
18
18
  * most; a linked brand now packs its frameworks into the snapshot instead.
19
19
  */
20
20
  const path = require('node:path');
21
- const Manager = new (require('../build.js'));
22
- const logger = Manager.logger('deploy');
21
+ const build = require('../build.js');
22
+ const logger = build.logger('deploy');
23
23
  const attachLogFile = require('../utils/attach-log-file.js');
24
24
  const { assertBrandVersion } = require('../vendor/devkit/brand-version.js');
25
25
  const { targetNameFromDir } = require('../vendor/config/index.js');
@@ -62,9 +62,9 @@ module.exports = async function (options) {
62
62
  if (dryRun) {
63
63
  logger.log('DRY RUN, skipping hook "deploy/pre"');
64
64
  } else {
65
- // The one ctx shape every OMEGA hook takes, `{ manager, projectRoot, mode }`,
65
+ // The one ctx shape every OMEGA hook takes, `{ build, projectRoot, mode }`,
66
66
  // and a deploy's mode is PRODUCTION: what it is about to publish is a release.
67
- await runConsumerHook('deploy/pre', { manager: Manager, projectRoot: projectDir, mode: 'production' });
67
+ await runConsumerHook('deploy/pre', { build, projectRoot: projectDir, mode: 'production' });
68
68
  }
69
69
 
70
70
  // The direct lane: build + sign + publish from THIS machine, for this
@@ -27,9 +27,9 @@ const jetpack = require('fs-jetpack');
27
27
 
28
28
  const { getOctokit } = require('../utils/github.js');
29
29
  const { releasesRepo } = require('../vendor/config/index.js');
30
- const Manager = new (require('../build.js'));
30
+ const build = require('../build.js');
31
31
 
32
- const logger = Manager.logger('finalize-release');
32
+ const logger = build.logger('finalize-release');
33
33
 
34
34
  module.exports = async function finalizeRelease(options = {}) {
35
35
  const argv = options._ || [];
@@ -42,8 +42,8 @@ module.exports = async function finalizeRelease(options = {}) {
42
42
  }
43
43
 
44
44
  const projectRoot = process.cwd();
45
- const config = Manager.getConfig() || {};
46
- const pkgVersion = (Manager.getPackage('project') || {}).version;
45
+ const config = build.getConfig() || {};
46
+ const pkgVersion = (build.getPackage('project') || {}).version;
47
47
 
48
48
  if (!pkgVersion) {
49
49
  throw new Error('finalize-release: package.json version not found');
@@ -1,9 +1,9 @@
1
1
  // Libraries
2
- const Manager = new (require('../build.js'));
3
- const logger = Manager.logger('install');
2
+ const build = require('../build.js');
3
+ const logger = build.logger('install');
4
4
  const local = require('../vendor/devkit/local.js');
5
5
 
6
- const package = Manager.getPackage('main');
6
+ const package = build.getPackage('main');
7
7
 
8
8
  module.exports = async function (options) {
9
9
  logger.log(`Installing ${package.name}...`);
@@ -31,8 +31,8 @@ const fs = require('fs');
31
31
  const jetpack = require('fs-jetpack');
32
32
  const { spawn } = require('child_process');
33
33
 
34
- const Manager = new (require('../build.js'));
35
- const logger = Manager.logger('launch');
34
+ const build = require('../build.js');
35
+ const logger = build.logger('launch');
36
36
 
37
37
  module.exports = async function (options) {
38
38
  options = options || {};
@@ -22,14 +22,14 @@
22
22
  * The RUNNER is `@omega.js/devkit/deploy-precheck` (one copy for every
23
23
  * framework); this file is desktop's STEPS.
24
24
  */
25
- const Manager = new (require('../../build.js'));
25
+ const build = require('../../build.js');
26
26
  const { runDeployPrecheck } = require('../../vendor/devkit/deploy-precheck.js');
27
27
  const { releasesRepo } = require('../../vendor/config/index.js');
28
28
  const { publishTargetSecrets } = require('../../vendor/devkit/target-secrets.js');
29
29
  const { resolveToken } = require('../../vendor/devkit/deploy.js');
30
30
  const { updateManager } = require('./dependencies.js');
31
31
 
32
- const package = Manager.getPackage('main');
32
+ const package = build.getPackage('main');
33
33
 
34
34
  /**
35
35
  * Auto-provision the brand's ONE public releases repo, addressed by
@@ -57,7 +57,7 @@ const package = Manager.getPackage('main');
57
57
  async function provisionReleaseRepos({ log, warn, config, execFn, dryRun }) {
58
58
  const { ensureRepo } = require('../../vendor/devkit/github-repo.js');
59
59
 
60
- const resolved = config || Manager.getConfig() || {};
60
+ const resolved = config || build.getConfig() || {};
61
61
  if (resolved.releases?.enabled === false) return;
62
62
 
63
63
  const releases = releasesRepo(resolved);
@@ -31,14 +31,14 @@
31
31
  const path = require('path');
32
32
  const jetpack = require('fs-jetpack');
33
33
  const version = require('wonderful-version');
34
- const Manager = new (require('../../build.js'));
34
+ const build = require('../../build.js');
35
35
  const { ensurePeerDependencies, readProject } = require('./dependencies.js');
36
36
  const { renderSecretsBlock } = require('../../vendor/config/env-delivery.js');
37
37
  const { composeTargetWorkflows, renderInstallFirewall, renderInstallWorkspace } = require('../../vendor/devkit/ci-workflows.js');
38
38
  const { assertScaffoldable } = require('../../vendor/devkit/scaffold-guard.js');
39
39
 
40
- const logger = Manager.logger('ensure-target');
41
- const package = Manager.getPackage('main');
40
+ const logger = build.logger('ensure-target');
41
+ const package = build.getPackage('main');
42
42
 
43
43
  /**
44
44
  * Sync the consumer manifest: the omega verb scripts, the npm-private latch,
@@ -47,7 +47,7 @@ const package = Manager.getPackage('main');
47
47
  * Identical content is not a write (#590).
48
48
  */
49
49
  function setupScripts(projectDir, result) {
50
- projectDir = projectDir || Manager.getRootPath('project');
50
+ projectDir = projectDir || build.getRootPath('project');
51
51
  result = result || { changed: [] };
52
52
 
53
53
  const project = readProject(projectDir);
@@ -128,7 +128,7 @@ function checkNodeVersion(projectDir, requiredMajor, warn) {
128
128
  * @param {object} log - `{ log, warn, error }` handed to the engine.
129
129
  */
130
130
  async function copyDefaults(projectDir, engineLogger) {
131
- projectDir = projectDir || Manager.getRootPath('project');
131
+ projectDir = projectDir || build.getRootPath('project');
132
132
  engineLogger = engineLogger || logger;
133
133
 
134
134
  const defaultsDir = path.resolve(__dirname, '..', '..', 'defaults');
@@ -311,7 +311,7 @@ function checkLocality(projectDir) {
311
311
  */
312
312
  async function ensureTarget(options) {
313
313
  options = options || {};
314
- const projectDir = options.projectDir || Manager.getRootPath('project');
314
+ const projectDir = options.projectDir || build.getRootPath('project');
315
315
  const log = options.log || (() => {});
316
316
  const warn = options.warn || (() => {});
317
317
  const result = { written: [], merged: [], changed: [] };
@@ -1,6 +1,6 @@
1
1
  // Libraries
2
- const Manager = new (require('../build.js'));
3
- const logger = Manager.logger('package');
2
+ const build = require('../build.js');
3
+ const logger = build.logger('package');
4
4
  const { runPipeline } = require('../utils/build-pipeline.js');
5
5
 
6
6
  // `npx omega package` (the consumer's `package` script) builds the full installer
@@ -1,6 +1,6 @@
1
1
  // Libraries
2
- const Manager = new (require('../build.js'));
3
- const logger = Manager.logger('publish');
2
+ const build = require('../build.js');
3
+ const logger = build.logger('publish');
4
4
  const { runPipeline } = require('../utils/build-pipeline.js');
5
5
 
6
6
  // `npx omega publish` publishes from an already-built tree (the CI lane calls it
@@ -24,9 +24,9 @@ const attachLogFile = require('../utils/attach-log-file.js');
24
24
  const { deployViaDispatch, dispatchTarget, laneLabel, resolveToken } = require('../vendor/devkit/deploy.js');
25
25
  const { followRun } = require('../vendor/devkit/deploy-follow.js');
26
26
  const { targetNameFromDir } = require('../vendor/config/index.js');
27
- const Manager = new (require('../build.js'));
27
+ const build = require('../build.js');
28
28
 
29
- const logger = Manager.logger('release');
29
+ const logger = build.logger('release');
30
30
 
31
31
  module.exports = async function release(options = {}) {
32
32
  const projectRoot = process.cwd();
@@ -58,7 +58,7 @@ module.exports = async function release(options = {}) {
58
58
  // `build.yml` standalone). ONE helper for all four targets
59
59
  // ([#847](https://github.com/Omega-JS-Stack/omega/issues/847)), where this
60
60
  // file used to keep desktop's own copy of it.
61
- const { owner, repo, workflow: WORKFLOW_FILE } = dispatchTarget({ projectRoot, config: Manager.getConfig(), workflow: 'build.yml' });
61
+ const { owner, repo, workflow: WORKFLOW_FILE } = dispatchTarget({ projectRoot, config: build.getConfig(), workflow: 'build.yml' });
62
62
 
63
63
  // Optional --platforms / --platform flag forwarded as a workflow input. Accepts a
64
64
  // single value ('windows') or comma-separated list ('mac,linux'). Special value