@hyperfrontend/builder 0.1.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 (561) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/FUNDING.md +141 -0
  3. package/LICENSE.md +21 -0
  4. package/README.md +162 -0
  5. package/SECURITY.md +82 -0
  6. package/THIRD_PARTY_LICENSES.md +13 -0
  7. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.cjs.js +7 -0
  8. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.esm.js +5 -0
  9. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.cjs.js +13 -0
  10. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.esm.js +8 -0
  11. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.cjs.js +5 -0
  12. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.esm.js +4 -0
  13. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/encoding/index.cjs.js +1 -0
  14. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/encoding/index.esm.js +1 -0
  15. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js +6 -0
  16. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js +5 -0
  17. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/function/index.cjs.js +1 -0
  18. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/function/index.esm.js +1 -0
  19. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.cjs.js +7 -0
  20. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.esm.js +5 -0
  21. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.cjs.js +6 -0
  22. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.esm.js +5 -0
  23. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js +7 -0
  24. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.esm.js +5 -0
  25. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/messaging/index.cjs.js +1 -0
  26. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/messaging/index.esm.js +1 -0
  27. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.cjs.js +1 -0
  28. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.esm.js +1 -0
  29. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js +13 -0
  30. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.esm.js +8 -0
  31. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.cjs.js +6 -0
  32. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.esm.js +5 -0
  33. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/reflect/index.cjs.js +1 -0
  34. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/reflect/index.esm.js +1 -0
  35. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/regexp/index.cjs.js +6 -0
  36. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/regexp/index.esm.js +5 -0
  37. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js +6 -0
  38. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js +5 -0
  39. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/string/index.cjs.js +1 -0
  40. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/string/index.esm.js +1 -0
  41. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/symbol/index.cjs.js +1 -0
  42. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/symbol/index.esm.js +1 -0
  43. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.cjs.js +13 -0
  44. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.esm.js +10 -0
  45. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/typed-arrays/index.cjs.js +1 -0
  46. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/typed-arrays/index.esm.js +1 -0
  47. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/url/index.cjs.js +6 -0
  48. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/url/index.esm.js +5 -0
  49. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/weak-map/index.cjs.js +1 -0
  50. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/weak-map/index.esm.js +1 -0
  51. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/weak-set/index.cjs.js +1 -0
  52. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/weak-set/index.esm.js +1 -0
  53. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/websocket/index.cjs.js +1 -0
  54. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/websocket/index.esm.js +1 -0
  55. package/_dependencies/@hyperfrontend/immutable-api-utils/index.cjs.js +1 -0
  56. package/_dependencies/@hyperfrontend/immutable-api-utils/index.esm.js +1 -0
  57. package/_dependencies/@hyperfrontend/immutable-api-utils/locked/index.cjs.js +1 -0
  58. package/_dependencies/@hyperfrontend/immutable-api-utils/locked/index.esm.js +1 -0
  59. package/_dependencies/@hyperfrontend/immutable-api-utils/locked-prop-descriptors/index.cjs.js +1 -0
  60. package/_dependencies/@hyperfrontend/immutable-api-utils/locked-prop-descriptors/index.esm.js +1 -0
  61. package/_dependencies/@hyperfrontend/immutable-api-utils/locked-props/index.cjs.js +1 -0
  62. package/_dependencies/@hyperfrontend/immutable-api-utils/locked-props/index.esm.js +1 -0
  63. package/_dependencies/@hyperfrontend/logging/index.cjs.js +191 -0
  64. package/_dependencies/@hyperfrontend/logging/index.esm.js +186 -0
  65. package/_dependencies/@hyperfrontend/project-scope/cli/index.cjs.js +196 -0
  66. package/_dependencies/@hyperfrontend/project-scope/cli/index.esm.js +196 -0
  67. package/_dependencies/@hyperfrontend/project-scope/core/encoding/index.cjs.js +82 -0
  68. package/_dependencies/@hyperfrontend/project-scope/core/encoding/index.esm.js +82 -0
  69. package/_dependencies/@hyperfrontend/project-scope/core/fs/index.cjs.js +154 -0
  70. package/_dependencies/@hyperfrontend/project-scope/core/fs/index.esm.js +149 -0
  71. package/_dependencies/@hyperfrontend/project-scope/core/index.cjs.js +459 -0
  72. package/_dependencies/@hyperfrontend/project-scope/core/index.esm.js +440 -0
  73. package/_dependencies/@hyperfrontend/project-scope/core/logger/index.cjs.js +84 -0
  74. package/_dependencies/@hyperfrontend/project-scope/core/logger/index.esm.js +80 -0
  75. package/_dependencies/@hyperfrontend/project-scope/core/path/index.cjs.js +26 -0
  76. package/_dependencies/@hyperfrontend/project-scope/core/path/index.esm.js +22 -0
  77. package/_dependencies/@hyperfrontend/project-scope/core/platform/index.cjs.js +1 -0
  78. package/_dependencies/@hyperfrontend/project-scope/core/platform/index.esm.js +1 -0
  79. package/_dependencies/@hyperfrontend/project-scope/heuristics/dependencies/index.cjs.js +90 -0
  80. package/_dependencies/@hyperfrontend/project-scope/heuristics/dependencies/index.esm.js +90 -0
  81. package/_dependencies/@hyperfrontend/project-scope/heuristics/entry-points/index.cjs.js +174 -0
  82. package/_dependencies/@hyperfrontend/project-scope/heuristics/entry-points/index.esm.js +174 -0
  83. package/_dependencies/@hyperfrontend/project-scope/heuristics/framework/index.cjs.js +174 -0
  84. package/_dependencies/@hyperfrontend/project-scope/heuristics/framework/index.esm.js +172 -0
  85. package/_dependencies/@hyperfrontend/project-scope/heuristics/index.cjs.js +184 -0
  86. package/_dependencies/@hyperfrontend/project-scope/heuristics/index.esm.js +184 -0
  87. package/_dependencies/@hyperfrontend/project-scope/heuristics/project-type/index.cjs.js +172 -0
  88. package/_dependencies/@hyperfrontend/project-scope/heuristics/project-type/index.esm.js +172 -0
  89. package/_dependencies/@hyperfrontend/project-scope/index.cjs.js +222 -0
  90. package/_dependencies/@hyperfrontend/project-scope/index.esm.js +219 -0
  91. package/_dependencies/@hyperfrontend/project-scope/models/index.cjs.js +2 -0
  92. package/_dependencies/@hyperfrontend/project-scope/models/index.esm.js +1 -0
  93. package/_dependencies/@hyperfrontend/project-scope/nx/index.cjs.js +94 -0
  94. package/_dependencies/@hyperfrontend/project-scope/nx/index.esm.js +94 -0
  95. package/_dependencies/@hyperfrontend/project-scope/project/config/index.cjs.js +172 -0
  96. package/_dependencies/@hyperfrontend/project-scope/project/config/index.esm.js +172 -0
  97. package/_dependencies/@hyperfrontend/project-scope/project/index.cjs.js +176 -0
  98. package/_dependencies/@hyperfrontend/project-scope/project/index.esm.js +176 -0
  99. package/_dependencies/@hyperfrontend/project-scope/project/package/index.cjs.js +88 -0
  100. package/_dependencies/@hyperfrontend/project-scope/project/package/index.esm.js +88 -0
  101. package/_dependencies/@hyperfrontend/project-scope/project/root/index.cjs.js +154 -0
  102. package/_dependencies/@hyperfrontend/project-scope/project/root/index.esm.js +153 -0
  103. package/_dependencies/@hyperfrontend/project-scope/project/traversal/index.cjs.js +91 -0
  104. package/_dependencies/@hyperfrontend/project-scope/project/traversal/index.esm.js +89 -0
  105. package/_dependencies/@hyperfrontend/project-scope/tech/backend/index.cjs.js +88 -0
  106. package/_dependencies/@hyperfrontend/project-scope/tech/backend/index.esm.js +88 -0
  107. package/_dependencies/@hyperfrontend/project-scope/tech/build/index.cjs.js +88 -0
  108. package/_dependencies/@hyperfrontend/project-scope/tech/build/index.esm.js +88 -0
  109. package/_dependencies/@hyperfrontend/project-scope/tech/frontend/index.cjs.js +88 -0
  110. package/_dependencies/@hyperfrontend/project-scope/tech/frontend/index.esm.js +88 -0
  111. package/_dependencies/@hyperfrontend/project-scope/tech/index.cjs.js +171 -0
  112. package/_dependencies/@hyperfrontend/project-scope/tech/index.esm.js +169 -0
  113. package/_dependencies/@hyperfrontend/project-scope/tech/legacy/index.cjs.js +88 -0
  114. package/_dependencies/@hyperfrontend/project-scope/tech/legacy/index.esm.js +88 -0
  115. package/_dependencies/@hyperfrontend/project-scope/tech/linting/index.cjs.js +88 -0
  116. package/_dependencies/@hyperfrontend/project-scope/tech/linting/index.esm.js +88 -0
  117. package/_dependencies/@hyperfrontend/project-scope/tech/monorepo/index.cjs.js +88 -0
  118. package/_dependencies/@hyperfrontend/project-scope/tech/monorepo/index.esm.js +88 -0
  119. package/_dependencies/@hyperfrontend/project-scope/tech/testing/index.cjs.js +88 -0
  120. package/_dependencies/@hyperfrontend/project-scope/tech/testing/index.esm.js +88 -0
  121. package/_dependencies/@hyperfrontend/project-scope/tech/types/index.cjs.js +88 -0
  122. package/_dependencies/@hyperfrontend/project-scope/tech/types/index.esm.js +88 -0
  123. package/_dependencies/@hyperfrontend/project-scope/vfs/index.cjs.js +102 -0
  124. package/_dependencies/@hyperfrontend/project-scope/vfs/index.esm.js +102 -0
  125. package/_dependencies/@hyperfrontend/versioning/changelog/compare/index.cjs.js +1 -0
  126. package/_dependencies/@hyperfrontend/versioning/changelog/compare/index.esm.js +1 -0
  127. package/_dependencies/@hyperfrontend/versioning/changelog/index.cjs.js +1 -0
  128. package/_dependencies/@hyperfrontend/versioning/changelog/index.esm.js +1 -0
  129. package/_dependencies/@hyperfrontend/versioning/changelog/models/index.cjs.js +1 -0
  130. package/_dependencies/@hyperfrontend/versioning/changelog/models/index.esm.js +1 -0
  131. package/_dependencies/@hyperfrontend/versioning/changelog/operations/index.cjs.js +1 -0
  132. package/_dependencies/@hyperfrontend/versioning/changelog/operations/index.esm.js +1 -0
  133. package/_dependencies/@hyperfrontend/versioning/changelog/parse/index.cjs.js +1 -0
  134. package/_dependencies/@hyperfrontend/versioning/changelog/parse/index.esm.js +1 -0
  135. package/_dependencies/@hyperfrontend/versioning/changelog/serialize/index.cjs.js +1 -0
  136. package/_dependencies/@hyperfrontend/versioning/changelog/serialize/index.esm.js +1 -0
  137. package/_dependencies/@hyperfrontend/versioning/commits/author/index.cjs.js +2403 -0
  138. package/_dependencies/@hyperfrontend/versioning/commits/author/index.esm.js +2381 -0
  139. package/_dependencies/@hyperfrontend/versioning/commits/classify/index.cjs.js +38 -0
  140. package/_dependencies/@hyperfrontend/versioning/commits/classify/index.esm.js +30 -0
  141. package/_dependencies/@hyperfrontend/versioning/commits/format/index.cjs.js +1 -0
  142. package/_dependencies/@hyperfrontend/versioning/commits/format/index.esm.js +1 -0
  143. package/_dependencies/@hyperfrontend/versioning/commits/index.cjs.js +2457 -0
  144. package/_dependencies/@hyperfrontend/versioning/commits/index.esm.js +2407 -0
  145. package/_dependencies/@hyperfrontend/versioning/commits/models/index.cjs.js +1 -0
  146. package/_dependencies/@hyperfrontend/versioning/commits/models/index.esm.js +1 -0
  147. package/_dependencies/@hyperfrontend/versioning/commits/parse/index.cjs.js +1 -0
  148. package/_dependencies/@hyperfrontend/versioning/commits/parse/index.esm.js +1 -0
  149. package/_dependencies/@hyperfrontend/versioning/commits/validate/index.cjs.js +27 -0
  150. package/_dependencies/@hyperfrontend/versioning/commits/validate/index.esm.js +25 -0
  151. package/_dependencies/@hyperfrontend/versioning/flow/executor/index.cjs.js +36 -0
  152. package/_dependencies/@hyperfrontend/versioning/flow/executor/index.esm.js +36 -0
  153. package/_dependencies/@hyperfrontend/versioning/flow/index.cjs.js +51 -0
  154. package/_dependencies/@hyperfrontend/versioning/flow/index.esm.js +51 -0
  155. package/_dependencies/@hyperfrontend/versioning/flow/models/index.cjs.js +30 -0
  156. package/_dependencies/@hyperfrontend/versioning/flow/models/index.esm.js +28 -0
  157. package/_dependencies/@hyperfrontend/versioning/flow/presets/index.cjs.js +47 -0
  158. package/_dependencies/@hyperfrontend/versioning/flow/presets/index.esm.js +45 -0
  159. package/_dependencies/@hyperfrontend/versioning/flow/steps/index.cjs.js +47 -0
  160. package/_dependencies/@hyperfrontend/versioning/flow/steps/index.esm.js +45 -0
  161. package/_dependencies/@hyperfrontend/versioning/git/index.cjs.js +8 -0
  162. package/_dependencies/@hyperfrontend/versioning/git/index.esm.js +9 -0
  163. package/_dependencies/@hyperfrontend/versioning/git/models/index.cjs.js +1 -0
  164. package/_dependencies/@hyperfrontend/versioning/git/models/index.esm.js +1 -0
  165. package/_dependencies/@hyperfrontend/versioning/git/operations/index.cjs.js +3 -0
  166. package/_dependencies/@hyperfrontend/versioning/git/operations/index.esm.js +3 -0
  167. package/_dependencies/@hyperfrontend/versioning/index.cjs.js +2481 -0
  168. package/_dependencies/@hyperfrontend/versioning/index.esm.js +2423 -0
  169. package/_dependencies/@hyperfrontend/versioning/registry/index.cjs.js +1 -0
  170. package/_dependencies/@hyperfrontend/versioning/registry/index.esm.js +1 -0
  171. package/_dependencies/@hyperfrontend/versioning/registry/models/index.cjs.js +1 -0
  172. package/_dependencies/@hyperfrontend/versioning/registry/models/index.esm.js +1 -0
  173. package/_dependencies/@hyperfrontend/versioning/registry/npm/index.cjs.js +1 -0
  174. package/_dependencies/@hyperfrontend/versioning/registry/npm/index.esm.js +1 -0
  175. package/_dependencies/@hyperfrontend/versioning/repository/index.cjs.js +18 -0
  176. package/_dependencies/@hyperfrontend/versioning/repository/index.esm.js +17 -0
  177. package/_dependencies/@hyperfrontend/versioning/repository/models/index.cjs.js +11 -0
  178. package/_dependencies/@hyperfrontend/versioning/repository/models/index.esm.js +10 -0
  179. package/_dependencies/@hyperfrontend/versioning/repository/parse/index.cjs.js +184 -0
  180. package/_dependencies/@hyperfrontend/versioning/repository/parse/index.esm.js +185 -0
  181. package/_dependencies/@hyperfrontend/versioning/repository/url/index.cjs.js +10 -0
  182. package/_dependencies/@hyperfrontend/versioning/repository/url/index.esm.js +8 -0
  183. package/_dependencies/@hyperfrontend/versioning/semver/compare/index.cjs.js +1 -0
  184. package/_dependencies/@hyperfrontend/versioning/semver/compare/index.esm.js +1 -0
  185. package/_dependencies/@hyperfrontend/versioning/semver/format/index.cjs.js +1 -0
  186. package/_dependencies/@hyperfrontend/versioning/semver/format/index.esm.js +1 -0
  187. package/_dependencies/@hyperfrontend/versioning/semver/increment/index.cjs.js +1 -0
  188. package/_dependencies/@hyperfrontend/versioning/semver/increment/index.esm.js +1 -0
  189. package/_dependencies/@hyperfrontend/versioning/semver/index.cjs.js +1 -0
  190. package/_dependencies/@hyperfrontend/versioning/semver/index.esm.js +1 -0
  191. package/_dependencies/@hyperfrontend/versioning/semver/models/index.cjs.js +1 -0
  192. package/_dependencies/@hyperfrontend/versioning/semver/models/index.esm.js +1 -0
  193. package/_dependencies/@hyperfrontend/versioning/semver/parse/index.cjs.js +1 -0
  194. package/_dependencies/@hyperfrontend/versioning/semver/parse/index.esm.js +1 -0
  195. package/_dependencies/@hyperfrontend/versioning/workspace/discovery/index.cjs.js +29 -0
  196. package/_dependencies/@hyperfrontend/versioning/workspace/discovery/index.esm.js +29 -0
  197. package/_dependencies/@hyperfrontend/versioning/workspace/index.cjs.js +29 -0
  198. package/_dependencies/@hyperfrontend/versioning/workspace/index.esm.js +29 -0
  199. package/_dependencies/@hyperfrontend/versioning/workspace/models/index.cjs.js +1 -0
  200. package/_dependencies/@hyperfrontend/versioning/workspace/models/index.esm.js +1 -0
  201. package/_dependencies/@hyperfrontend/versioning/workspace/operations/index.cjs.js +2 -0
  202. package/_dependencies/@hyperfrontend/versioning/workspace/operations/index.esm.js +2 -0
  203. package/_dependencies/@rollup/plugin-commonjs/index.cjs.js +6629 -0
  204. package/_dependencies/@rollup/plugin-commonjs/index.esm.js +6608 -0
  205. package/_dependencies/@rollup/plugin-json/index.cjs.js +2324 -0
  206. package/_dependencies/@rollup/plugin-json/index.esm.js +2322 -0
  207. package/_dependencies/@rollup/plugin-node-resolve/index.cjs.js +5430 -0
  208. package/_dependencies/@rollup/plugin-node-resolve/index.esm.js +5424 -0
  209. package/_dependencies/@rollup/plugin-terser/index.cjs.js +33220 -0
  210. package/_dependencies/@rollup/plugin-terser/index.esm.js +33217 -0
  211. package/_dependencies/@rollup/plugin-typescript/index.cjs.js +4840 -0
  212. package/_dependencies/@rollup/plugin-typescript/index.esm.js +4819 -0
  213. package/_dependencies/postject/index.cjs.js +5140 -0
  214. package/_dependencies/postject/index.esm.js +5131 -0
  215. package/_dependencies/rollup/index.cjs.js +24668 -0
  216. package/_dependencies/rollup/index.d.ts +1921 -0
  217. package/_dependencies/rollup/index.esm.js +24652 -0
  218. package/_dependencies/rollup-plugin-dts/index.cjs.js +6547 -0
  219. package/_dependencies/rollup-plugin-dts/index.esm.js +6537 -0
  220. package/_shared/bin/format/index.cjs.js +7 -0
  221. package/_shared/bin/format/index.esm.js +5 -0
  222. package/_shared/bin/native/codesign/index.cjs.js +30 -0
  223. package/_shared/bin/native/codesign/index.esm.js +26 -0
  224. package/_shared/bin/native/host-binary/index.cjs.js +13 -0
  225. package/_shared/bin/native/host-binary/index.esm.js +11 -0
  226. package/_shared/bin/native/inject/index.cjs.js +25 -0
  227. package/_shared/bin/native/inject/index.esm.js +18 -0
  228. package/_shared/bin/native/platform-check/index.cjs.js +13 -0
  229. package/_shared/bin/native/platform-check/index.esm.js +10 -0
  230. package/_shared/bin/native/sea-blob/index.cjs.js +21 -0
  231. package/_shared/bin/native/sea-blob/index.esm.js +19 -0
  232. package/_shared/bin/native/sea-config/index.cjs.js +9 -0
  233. package/_shared/bin/native/sea-config/index.esm.js +7 -0
  234. package/_shared/bin/script/bootstrap-footer/index.cjs.js +22 -0
  235. package/_shared/bin/script/bootstrap-footer/index.esm.js +19 -0
  236. package/_shared/bundle/declarations/flatten-paths/index.cjs.js +34 -0
  237. package/_shared/bundle/declarations/flatten-paths/index.esm.js +29 -0
  238. package/_shared/bundle/dependencies/collect-workspace-deps/index.cjs.js +24 -0
  239. package/_shared/bundle/dependencies/collect-workspace-deps/index.esm.js +21 -0
  240. package/_shared/bundle/dependencies/externalize-plugin/index.cjs.js +93 -0
  241. package/_shared/bundle/dependencies/externalize-plugin/index.esm.js +86 -0
  242. package/_shared/bundle/dependencies/prune/ast-utils/index.esm.js +31 -0
  243. package/_shared/bundle/dependencies/prune/namespace-usage/index.esm.js +208 -0
  244. package/_shared/bundle/dependencies/prune/specifiers/index.cjs.js +62 -0
  245. package/_shared/bundle/dependencies/prune/specifiers/index.esm.js +53 -0
  246. package/_shared/bundle/entries/discover-entries/index.cjs.js +87 -0
  247. package/_shared/bundle/entries/discover-entries/index.esm.js +80 -0
  248. package/_shared/bundle/entries/resolve-entries/index.cjs.js +38 -0
  249. package/_shared/bundle/entries/resolve-entries/index.esm.js +34 -0
  250. package/_shared/bundle/externals/validate-globals/index.cjs.js +14 -0
  251. package/_shared/bundle/externals/validate-globals/index.esm.js +12 -0
  252. package/_shared/bundle/fs/deps-root/index.cjs.js +7 -0
  253. package/_shared/bundle/fs/deps-root/index.esm.js +5 -0
  254. package/_shared/bundle/fs/empty-dirs/index.cjs.js +23 -0
  255. package/_shared/bundle/fs/empty-dirs/index.esm.js +21 -0
  256. package/_shared/bundle/fs/entry-dir/index.cjs.js +7 -0
  257. package/_shared/bundle/fs/entry-dir/index.esm.js +5 -0
  258. package/_shared/bundle/fs/posix-path/index.cjs.js +9 -0
  259. package/_shared/bundle/fs/posix-path/index.esm.js +4 -0
  260. package/_shared/bundle/fs/under-dir/index.cjs.js +5 -0
  261. package/_shared/bundle/fs/under-dir/index.esm.js +3 -0
  262. package/_shared/memory/recover/index.cjs.js +15 -0
  263. package/_shared/memory/recover/index.esm.js +14 -0
  264. package/_shared/package/finalize-files/index.cjs.js +16 -0
  265. package/_shared/package/finalize-files/index.esm.js +15 -0
  266. package/_shared/package/json/cdn-paths/index.cjs.js +13 -0
  267. package/_shared/package/json/cdn-paths/index.esm.js +11 -0
  268. package/_shared/package/json/filter-deps/index.cjs.js +37 -0
  269. package/_shared/package/json/filter-deps/index.esm.js +34 -0
  270. package/_shared/package/json/generate-exports/index.cjs.js +56 -0
  271. package/_shared/package/json/generate-exports/index.esm.js +52 -0
  272. package/_shared/package/json/inherit-fields/index.cjs.js +19 -0
  273. package/_shared/package/json/inherit-fields/index.esm.js +17 -0
  274. package/_shared/package/json/read-package-json/index.cjs.js +7 -0
  275. package/_shared/package/json/read-package-json/index.esm.js +6 -0
  276. package/_shared/package/json/reflect-files-allowlist/index.cjs.js +39 -0
  277. package/_shared/package/json/reflect-files-allowlist/index.esm.js +33 -0
  278. package/_shared/package/json/synthesize/index.cjs.js +72 -0
  279. package/_shared/package/json/synthesize/index.esm.js +68 -0
  280. package/_shared/package/json/write/index.cjs.js +9 -0
  281. package/_shared/package/json/write/index.esm.js +8 -0
  282. package/_shared/package/licenses/generate-content/index.cjs.js +17 -0
  283. package/_shared/package/licenses/generate-content/index.esm.js +17 -0
  284. package/_shared/package/licenses/license-url/index.esm.js +29 -0
  285. package/_shared/package/licenses/write/index.cjs.js +9 -0
  286. package/_shared/package/licenses/write/index.esm.js +8 -0
  287. package/_shared/presets/by-names/index.cjs.js +10 -0
  288. package/_shared/presets/by-names/index.esm.js +8 -0
  289. package/_shared/presets/by-prefix/index.cjs.js +7 -0
  290. package/_shared/presets/by-prefix/index.esm.js +5 -0
  291. package/bin/format.d.ts +18 -0
  292. package/bin/format.d.ts.map +1 -0
  293. package/bin/hf-build.d.ts +81 -0
  294. package/bin/hf-build.d.ts.map +1 -0
  295. package/bin/hf-build.js +208533 -0
  296. package/bin/hf-build.linux-x64 +0 -0
  297. package/bin/index.cjs.js +548 -0
  298. package/bin/index.d.ts +26 -0
  299. package/bin/index.d.ts.map +1 -0
  300. package/bin/index.esm.js +546 -0
  301. package/bin/native/build-native.d.ts +44 -0
  302. package/bin/native/build-native.d.ts.map +1 -0
  303. package/bin/native/codesign.d.ts +65 -0
  304. package/bin/native/codesign.d.ts.map +1 -0
  305. package/bin/native/dispatch.d.ts +75 -0
  306. package/bin/native/dispatch.d.ts.map +1 -0
  307. package/bin/native/host-binary.d.ts +36 -0
  308. package/bin/native/host-binary.d.ts.map +1 -0
  309. package/bin/native/index.cjs.js +264 -0
  310. package/bin/native/index.d.ts +407 -0
  311. package/bin/native/index.d.ts.map +1 -0
  312. package/bin/native/index.esm.js +249 -0
  313. package/bin/native/inject.d.ts +61 -0
  314. package/bin/native/inject.d.ts.map +1 -0
  315. package/bin/native/platform-check.d.ts +39 -0
  316. package/bin/native/platform-check.d.ts.map +1 -0
  317. package/bin/native/sea-blob.d.ts +40 -0
  318. package/bin/native/sea-blob.d.ts.map +1 -0
  319. package/bin/native/sea-config.d.ts +45 -0
  320. package/bin/native/sea-config.d.ts.map +1 -0
  321. package/bin/native/worker/index.cjs.js +88 -0
  322. package/bin/native/worker/index.d.ts +68 -0
  323. package/bin/native/worker/index.d.ts.map +1 -0
  324. package/bin/native/worker/index.esm.js +86 -0
  325. package/bin/native/worker/job-runner.d.ts +29 -0
  326. package/bin/native/worker/job-runner.d.ts.map +1 -0
  327. package/bin/native/worker/types.d.ts +38 -0
  328. package/bin/native/worker/types.d.ts.map +1 -0
  329. package/bin/run-bin-phase.d.ts +24 -0
  330. package/bin/run-bin-phase.d.ts.map +1 -0
  331. package/bin/script/bootstrap-footer.d.ts +41 -0
  332. package/bin/script/bootstrap-footer.d.ts.map +1 -0
  333. package/bin/script/build-bin.d.ts +36 -0
  334. package/bin/script/build-bin.d.ts.map +1 -0
  335. package/bin/script/index.cjs.js +265 -0
  336. package/bin/script/index.d.ts +79 -0
  337. package/bin/script/index.d.ts.map +1 -0
  338. package/bin/script/index.esm.js +262 -0
  339. package/build.d.ts +56 -0
  340. package/build.d.ts.map +1 -0
  341. package/bundle/declarations/dts-per-entry.d.ts +27 -0
  342. package/bundle/declarations/dts-per-entry.d.ts.map +1 -0
  343. package/bundle/declarations/dts-pre-pass.d.ts +18 -0
  344. package/bundle/declarations/dts-pre-pass.d.ts.map +1 -0
  345. package/bundle/declarations/flatten-paths.d.ts +28 -0
  346. package/bundle/declarations/flatten-paths.d.ts.map +1 -0
  347. package/bundle/declarations/generate-declarations.d.ts +33 -0
  348. package/bundle/declarations/generate-declarations.d.ts.map +1 -0
  349. package/bundle/declarations/index.cjs.js +868 -0
  350. package/bundle/declarations/index.d.ts +262 -0
  351. package/bundle/declarations/index.d.ts.map +1 -0
  352. package/bundle/declarations/index.esm.js +857 -0
  353. package/bundle/declarations/prune-orphan-dts.d.ts +33 -0
  354. package/bundle/declarations/prune-orphan-dts.d.ts.map +1 -0
  355. package/bundle/declarations/sibling-resolver.d.ts +125 -0
  356. package/bundle/declarations/sibling-resolver.d.ts.map +1 -0
  357. package/bundle/dedupe/attribute-modules.d.ts +178 -0
  358. package/bundle/dedupe/attribute-modules.d.ts.map +1 -0
  359. package/bundle/dedupe/extract-chunk.d.ts +103 -0
  360. package/bundle/dedupe/extract-chunk.d.ts.map +1 -0
  361. package/bundle/dedupe/hoist-shared.d.ts +37 -0
  362. package/bundle/dedupe/hoist-shared.d.ts.map +1 -0
  363. package/bundle/dedupe/index.cjs.js +818 -0
  364. package/bundle/dedupe/index.d.ts +400 -0
  365. package/bundle/dedupe/index.d.ts.map +1 -0
  366. package/bundle/dedupe/index.esm.js +766 -0
  367. package/bundle/dedupe/plan-hoists.d.ts +46 -0
  368. package/bundle/dedupe/plan-hoists.d.ts.map +1 -0
  369. package/bundle/dedupe/rewrite-entry.d.ts +39 -0
  370. package/bundle/dedupe/rewrite-entry.d.ts.map +1 -0
  371. package/bundle/dependencies/collect-workspace-deps.d.ts +34 -0
  372. package/bundle/dependencies/collect-workspace-deps.d.ts.map +1 -0
  373. package/bundle/dependencies/externalize-plugin.d.ts +100 -0
  374. package/bundle/dependencies/externalize-plugin.d.ts.map +1 -0
  375. package/bundle/dependencies/index.cjs.js +964 -0
  376. package/bundle/dependencies/index.d.ts +388 -0
  377. package/bundle/dependencies/index.d.ts.map +1 -0
  378. package/bundle/dependencies/index.esm.js +947 -0
  379. package/bundle/dependencies/pre-pass.d.ts +154 -0
  380. package/bundle/dependencies/pre-pass.d.ts.map +1 -0
  381. package/bundle/dependencies/prune/ast-utils.d.ts +121 -0
  382. package/bundle/dependencies/prune/ast-utils.d.ts.map +1 -0
  383. package/bundle/dependencies/prune/chunk-graph.d.ts +175 -0
  384. package/bundle/dependencies/prune/chunk-graph.d.ts.map +1 -0
  385. package/bundle/dependencies/prune/dead-export-pass.d.ts +32 -0
  386. package/bundle/dependencies/prune/dead-export-pass.d.ts.map +1 -0
  387. package/bundle/dependencies/prune/dead-exports.d.ts +36 -0
  388. package/bundle/dependencies/prune/dead-exports.d.ts.map +1 -0
  389. package/bundle/dependencies/prune/destructure-requires-pass.d.ts +31 -0
  390. package/bundle/dependencies/prune/destructure-requires-pass.d.ts.map +1 -0
  391. package/bundle/dependencies/prune/destructure-requires.d.ts +42 -0
  392. package/bundle/dependencies/prune/destructure-requires.d.ts.map +1 -0
  393. package/bundle/dependencies/prune/edits.d.ts +30 -0
  394. package/bundle/dependencies/prune/edits.d.ts.map +1 -0
  395. package/bundle/dependencies/prune/namespace-usage.d.ts +104 -0
  396. package/bundle/dependencies/prune/namespace-usage.d.ts.map +1 -0
  397. package/bundle/dependencies/prune/orphan-chunks.d.ts +69 -0
  398. package/bundle/dependencies/prune/orphan-chunks.d.ts.map +1 -0
  399. package/bundle/dependencies/prune/property-strip-pass.d.ts +38 -0
  400. package/bundle/dependencies/prune/property-strip-pass.d.ts.map +1 -0
  401. package/bundle/dependencies/prune/property-strip.d.ts +69 -0
  402. package/bundle/dependencies/prune/property-strip.d.ts.map +1 -0
  403. package/bundle/dependencies/prune/prune-dependencies.d.ts +52 -0
  404. package/bundle/dependencies/prune/prune-dependencies.d.ts.map +1 -0
  405. package/bundle/dependencies/prune/reachability.d.ts +36 -0
  406. package/bundle/dependencies/prune/reachability.d.ts.map +1 -0
  407. package/bundle/dependencies/prune/specifiers.d.ts +39 -0
  408. package/bundle/dependencies/prune/specifiers.d.ts.map +1 -0
  409. package/bundle/dependencies/prune/strip-comments.d.ts +47 -0
  410. package/bundle/dependencies/prune/strip-comments.d.ts.map +1 -0
  411. package/bundle/dependencies/prune/used-exports.d.ts +32 -0
  412. package/bundle/dependencies/prune/used-exports.d.ts.map +1 -0
  413. package/bundle/dependencies/resolve-bundled-deps.d.ts +37 -0
  414. package/bundle/dependencies/resolve-bundled-deps.d.ts.map +1 -0
  415. package/bundle/dependencies/resolve-dep-entry.d.ts +38 -0
  416. package/bundle/dependencies/resolve-dep-entry.d.ts.map +1 -0
  417. package/bundle/dependencies/resolve-workspace-bundled-deps.d.ts +96 -0
  418. package/bundle/dependencies/resolve-workspace-bundled-deps.d.ts.map +1 -0
  419. package/bundle/dependencies/worker/index.cjs.js +524 -0
  420. package/bundle/dependencies/worker/index.d.ts +102 -0
  421. package/bundle/dependencies/worker/index.d.ts.map +1 -0
  422. package/bundle/dependencies/worker/index.esm.js +515 -0
  423. package/bundle/dependencies/worker/job-runner.d.ts +115 -0
  424. package/bundle/dependencies/worker/job-runner.d.ts.map +1 -0
  425. package/bundle/entries/by-platform.d.ts +27 -0
  426. package/bundle/entries/by-platform.d.ts.map +1 -0
  427. package/bundle/entries/discover-entries.d.ts +24 -0
  428. package/bundle/entries/discover-entries.d.ts.map +1 -0
  429. package/bundle/entries/index.cjs.js +38 -0
  430. package/bundle/entries/index.d.ts +70 -0
  431. package/bundle/entries/index.d.ts.map +1 -0
  432. package/bundle/entries/index.esm.js +33 -0
  433. package/bundle/entries/resolve-entries.d.ts +19 -0
  434. package/bundle/entries/resolve-entries.d.ts.map +1 -0
  435. package/bundle/externals/index.cjs.js +54 -0
  436. package/bundle/externals/index.d.ts +74 -0
  437. package/bundle/externals/index.d.ts.map +1 -0
  438. package/bundle/externals/index.esm.js +51 -0
  439. package/bundle/externals/resolve-externals.d.ts +52 -0
  440. package/bundle/externals/resolve-externals.d.ts.map +1 -0
  441. package/bundle/externals/validate-globals.d.ts +19 -0
  442. package/bundle/externals/validate-globals.d.ts.map +1 -0
  443. package/bundle/fs/deps-root.d.ts +17 -0
  444. package/bundle/fs/deps-root.d.ts.map +1 -0
  445. package/bundle/fs/empty-dirs.d.ts +18 -0
  446. package/bundle/fs/empty-dirs.d.ts.map +1 -0
  447. package/bundle/fs/entry-dir.d.ts +21 -0
  448. package/bundle/fs/entry-dir.d.ts.map +1 -0
  449. package/bundle/fs/posix-path.d.ts +30 -0
  450. package/bundle/fs/posix-path.d.ts.map +1 -0
  451. package/bundle/fs/under-dir.d.ts +19 -0
  452. package/bundle/fs/under-dir.d.ts.map +1 -0
  453. package/bundle/index.cjs.js +4046 -0
  454. package/bundle/index.d.ts +25 -0
  455. package/bundle/index.d.ts.map +1 -0
  456. package/bundle/index.esm.js +3689 -0
  457. package/bundle/rollup/descriptor.d.ts +99 -0
  458. package/bundle/rollup/descriptor.d.ts.map +1 -0
  459. package/bundle/rollup/dispatch.d.ts +72 -0
  460. package/bundle/rollup/dispatch.d.ts.map +1 -0
  461. package/bundle/rollup/index.cjs.js +715 -0
  462. package/bundle/rollup/index.d.ts +174 -0
  463. package/bundle/rollup/index.d.ts.map +1 -0
  464. package/bundle/rollup/index.esm.js +698 -0
  465. package/bundle/rollup/worker/index.cjs.js +290 -0
  466. package/bundle/rollup/worker/index.d.ts +131 -0
  467. package/bundle/rollup/worker/index.d.ts.map +1 -0
  468. package/bundle/rollup/worker/index.esm.js +280 -0
  469. package/bundle/rollup/worker/job-runner.d.ts +18 -0
  470. package/bundle/rollup/worker/job-runner.d.ts.map +1 -0
  471. package/bundle/rollup/worker/types.d.ts +111 -0
  472. package/bundle/rollup/worker/types.d.ts.map +1 -0
  473. package/bundle/run-bundle-phase.d.ts +23 -0
  474. package/bundle/run-bundle-phase.d.ts.map +1 -0
  475. package/clean-output.d.ts +26 -0
  476. package/clean-output.d.ts.map +1 -0
  477. package/index.cjs.js +5317 -0
  478. package/index.d.ts +64 -0
  479. package/index.d.ts.map +1 -0
  480. package/index.esm.js +4910 -0
  481. package/memory/index.cjs.js +101 -0
  482. package/memory/index.d.ts +81 -0
  483. package/memory/index.d.ts.map +1 -0
  484. package/memory/index.esm.js +98 -0
  485. package/memory/monitor.d.ts +59 -0
  486. package/memory/monitor.d.ts.map +1 -0
  487. package/memory/recover.d.ts +19 -0
  488. package/memory/recover.d.ts.map +1 -0
  489. package/models/build-config.d.ts +266 -0
  490. package/models/build-config.d.ts.map +1 -0
  491. package/models/build-context.d.ts +68 -0
  492. package/models/build-context.d.ts.map +1 -0
  493. package/models/build-result.d.ts +43 -0
  494. package/models/build-result.d.ts.map +1 -0
  495. package/models/entry-point.d.ts +45 -0
  496. package/models/entry-point.d.ts.map +1 -0
  497. package/models/format-output.d.ts +34 -0
  498. package/models/format-output.d.ts.map +1 -0
  499. package/models/index.cjs.js +2 -0
  500. package/models/index.d.ts +581 -0
  501. package/models/index.d.ts.map +1 -0
  502. package/models/index.esm.js +1 -0
  503. package/models/package-json.d.ts +130 -0
  504. package/models/package-json.d.ts.map +1 -0
  505. package/package/assets/copy-assets.d.ts +31 -0
  506. package/package/assets/copy-assets.d.ts.map +1 -0
  507. package/package/assets/index.cjs.js +84 -0
  508. package/package/assets/index.d.ts +33 -0
  509. package/package/assets/index.d.ts.map +1 -0
  510. package/package/assets/index.esm.js +82 -0
  511. package/package/finalize-files.d.ts +25 -0
  512. package/package/finalize-files.d.ts.map +1 -0
  513. package/package/index.cjs.js +276 -0
  514. package/package/index.d.ts +56 -0
  515. package/package/index.d.ts.map +1 -0
  516. package/package/index.esm.js +231 -0
  517. package/package/json/cdn-paths.d.ts +41 -0
  518. package/package/json/cdn-paths.d.ts.map +1 -0
  519. package/package/json/filter-deps.d.ts +39 -0
  520. package/package/json/filter-deps.d.ts.map +1 -0
  521. package/package/json/generate-exports.d.ts +29 -0
  522. package/package/json/generate-exports.d.ts.map +1 -0
  523. package/package/json/index.cjs.js +24 -0
  524. package/package/json/index.d.ts +252 -0
  525. package/package/json/index.d.ts.map +1 -0
  526. package/package/json/index.esm.js +14 -0
  527. package/package/json/inherit-fields.d.ts +25 -0
  528. package/package/json/inherit-fields.d.ts.map +1 -0
  529. package/package/json/read-package-json.d.ts +18 -0
  530. package/package/json/read-package-json.d.ts.map +1 -0
  531. package/package/json/reflect-files-allowlist.d.ts +32 -0
  532. package/package/json/reflect-files-allowlist.d.ts.map +1 -0
  533. package/package/json/synthesize.d.ts +53 -0
  534. package/package/json/synthesize.d.ts.map +1 -0
  535. package/package/json/write.d.ts +18 -0
  536. package/package/json/write.d.ts.map +1 -0
  537. package/package/licenses/collect.d.ts +25 -0
  538. package/package/licenses/collect.d.ts.map +1 -0
  539. package/package/licenses/generate-content.d.ts +20 -0
  540. package/package/licenses/generate-content.d.ts.map +1 -0
  541. package/package/licenses/index.cjs.js +135 -0
  542. package/package/licenses/index.d.ts +73 -0
  543. package/package/licenses/index.d.ts.map +1 -0
  544. package/package/licenses/index.esm.js +89 -0
  545. package/package/licenses/license-url.d.ts +20 -0
  546. package/package/licenses/license-url.d.ts.map +1 -0
  547. package/package/licenses/types.d.ts +12 -0
  548. package/package/licenses/types.d.ts.map +1 -0
  549. package/package/licenses/write.d.ts +16 -0
  550. package/package/licenses/write.d.ts.map +1 -0
  551. package/package/run-package-phase.d.ts +30 -0
  552. package/package/run-package-phase.d.ts.map +1 -0
  553. package/package.json +347 -0
  554. package/presets/by-names.d.ts +20 -0
  555. package/presets/by-names.d.ts.map +1 -0
  556. package/presets/by-prefix.d.ts +22 -0
  557. package/presets/by-prefix.d.ts.map +1 -0
  558. package/presets/index.cjs.js +8 -0
  559. package/presets/index.d.ts +43 -0
  560. package/presets/index.d.ts.map +1 -0
  561. package/presets/index.esm.js +5 -0
@@ -0,0 +1,407 @@
1
+ import { BinConfig, BuildContext, BinOutput, SeaPlatform } from '../../models';
2
+ import { MemoryMonitor } from '../../memory';
3
+ import { InjectWorkerJob, InjectWorkerReport } from './worker';
4
+ export { InjectWorkerJob, InjectWorkerReport } from './worker';
5
+
6
+ /**
7
+ * Inputs to {@link buildNativeBin}.
8
+ */
9
+ interface BuildNativeBinInputs {
10
+ /** Bin declaration. Must include a `sea` block; otherwise the function throws. */
11
+ bin: BinConfig;
12
+ /** Resolved build context. */
13
+ ctx: BuildContext;
14
+ /** Absolute path to the CJS bundle the SEA blob will execute. Must already be written to disk. */
15
+ cjsOutputPath: string;
16
+ }
17
+ /**
18
+ * Builds the Node SEA native binary for a single bin declaration.
19
+ *
20
+ * Pipeline (current-platform-only — cross-platform matrices are orchestrated externally):
21
+ * 1. Validate the bin declares CJS — SEA requires a CJS bundle as the embedded script.
22
+ * 2. Skip silently with an info log if the current host doesn't match any declared platform.
23
+ * 3. Generate the SEA config JSON and write it to disk.
24
+ * 4. Spawn `node --experimental-sea-config <path>` to emit the SEA preparation blob.
25
+ * 5. Resolve the Node host binary for the current platform (defaults to `process.execPath`).
26
+ * 6. Dispatch a forked inject worker that clones the host, embeds the blob via
27
+ * postject, and writes the output binary.
28
+ * 7. On macOS, strip the signature the injection invalidated so the unsigned binary still runs.
29
+ * 8. Delete the SEA build intermediates (config JSON + prep blob) so only the
30
+ * runtime binary remains in the publishable output.
31
+ *
32
+ * Native binaries are not auto-wired into `package.json#bin` — they are shipped
33
+ * as separate release artifacts.
34
+ *
35
+ * @param inputs - Bin declaration, resolved context, and the path to the already-built CJS bundle.
36
+ * @returns A single {@link BinOutput} of kind `native` for the current platform, or `[]` if skipped.
37
+ *
38
+ * @example Producing the SEA binary for the current runner
39
+ * ```typescript
40
+ * const outputs = await buildNativeBin({
41
+ * bin: { name: 'hf-build', format: 'cjs', sea: { platforms: ['linux-x64'] } },
42
+ * ctx: context,
43
+ * cjsOutputPath: '/abs/dist/libs/builder/bin/hf-build.js',
44
+ * })
45
+ * ```
46
+ */
47
+ declare const buildNativeBin: (inputs: BuildNativeBinInputs) => Promise<BinOutput[]>;
48
+
49
+ /**
50
+ * Inputs to {@link removeCodesign}.
51
+ */
52
+ interface RemoveCodesignInputs {
53
+ /** Absolute path to the binary whose existing macOS signature should be removed. */
54
+ binary: string;
55
+ }
56
+ /**
57
+ * Inputs to {@link applyCodesign}.
58
+ */
59
+ interface ApplyCodesignInputs {
60
+ /** Absolute path to the binary to sign. */
61
+ binary: string;
62
+ /** Signing identity passed to `codesign --sign`. Use `'-'` for an ad-hoc signature. */
63
+ identity?: string;
64
+ }
65
+ /**
66
+ * Result of a codesign invocation.
67
+ */
68
+ interface CodesignResult {
69
+ /** Whether the codesign command was attempted (skipped silently on non-macOS hosts). */
70
+ ran: boolean;
71
+ /** Exit status of the codesign command, or `null` if it was skipped or did not start. */
72
+ status: number | null;
73
+ /** Captured stderr, useful for surfacing diagnostics. */
74
+ stderr: string;
75
+ }
76
+ /**
77
+ * Strips the macOS code signature from `inputs.binary` (via
78
+ * `codesign --remove-signature`) after postject's blob injection has
79
+ * invalidated it, leaving an unsigned binary that runs locally. No-op on
80
+ * non-macOS hosts.
81
+ *
82
+ * Re-signing the produced binary (with a real Apple Developer ID) is left to
83
+ * release tooling; this step only produces an unsigned executable that runs
84
+ * locally.
85
+ *
86
+ * @param inputs - Path to the binary to clean up.
87
+ * @returns Whether the command ran, its exit status, and captured stderr.
88
+ *
89
+ * @example Removing the signature on macOS before postject inject
90
+ * ```typescript
91
+ * removeCodesign({ binary: '/abs/dist/libs/builder/bin/hf-build.darwin-arm64' })
92
+ * ```
93
+ */
94
+ declare const removeCodesign: (inputs: RemoveCodesignInputs) => CodesignResult;
95
+ /**
96
+ * Applies an ad-hoc (or identity-based) macOS code signature to the produced
97
+ * SEA binary. No-op on non-macOS hosts.
98
+ *
99
+ * Defaults to `--sign -` (ad-hoc signing), which is sufficient for local
100
+ * execution and satisfies macOS Catalina+ launch requirements without an
101
+ * Apple Developer identity. Release tooling can pass a real identity via
102
+ * `inputs.identity`.
103
+ *
104
+ * @param inputs - Binary path and optional signing identity.
105
+ * @returns Whether the command ran, its exit status, and captured stderr.
106
+ *
107
+ * @example Ad-hoc signing the produced SEA binary on macOS
108
+ * ```typescript
109
+ * applyCodesign({ binary: '/abs/dist/libs/builder/bin/hf-build.darwin-arm64' })
110
+ * ```
111
+ */
112
+ declare const applyCodesign: (inputs: ApplyCodesignInputs) => CodesignResult;
113
+
114
+ /**
115
+ * Caller-supplied options threaded through {@link dispatchInjectWorker}.
116
+ */
117
+ interface DispatchInjectWorkerOptions {
118
+ /** Absolute path to the worker entry script. Required — see {@link resolveDefaultInjectWorkerPath}. */
119
+ workerPath: string;
120
+ /** Optional memory monitor invoked before and after the spawned worker. */
121
+ monitor?: MemoryMonitor;
122
+ /** Override `process.execPath` for the spawned worker (used by tests). */
123
+ execPath?: string;
124
+ /** Extra arguments prepended to the worker invocation (e.g. `['--require', '@swc-node/register']`). */
125
+ execArgv?: string[];
126
+ /** Human-readable label for log lines and monitor checkpoints (e.g. `hf-build`). */
127
+ label?: string;
128
+ }
129
+ /**
130
+ * Resolved worker invocation: absolute path + any extra Node args (e.g. `--require \@swc-node/register`
131
+ * when the worker is loaded from TypeScript source during a bootstrap build).
132
+ */
133
+ interface InjectWorkerInvocation {
134
+ /** Absolute path to the worker entry script. */
135
+ path: string;
136
+ /** Extra args prepended to the spawned child's argv. */
137
+ execArgv: string[];
138
+ }
139
+ /**
140
+ * Default worker-path resolution: prefers the built-and-published artifact, falls
141
+ * back to the workspace dist path, and finally to the in-source TypeScript file
142
+ * via `@swc-node/register` (bootstrap case where builder is building itself for
143
+ * the first time and the dist worker doesn't exist yet).
144
+ *
145
+ * Looks at, in order:
146
+ * 1. `<workspaceRoot>/dist/libs/builder/bin/native/worker/index.cjs.js`
147
+ * 2. `<workspaceRoot>/node_modules/@hyperfrontend/builder/bin/native/worker/index.cjs.js`
148
+ * 3. `<workspaceRoot>/libs/builder/src/bin/native/worker/index.ts` (with `--require \@swc-node/register`)
149
+ *
150
+ * @param workspaceRoot - Absolute workspace root.
151
+ * @returns Worker invocation descriptor, or `undefined` if no candidate exists.
152
+ *
153
+ * @example Locating the worker for an in-workspace consumer
154
+ * ```typescript
155
+ * const invocation = resolveDefaultInjectWorkerPath('/abs/repo')
156
+ * if (!invocation) throw new Error('builder inject worker artifact not found')
157
+ * ```
158
+ */
159
+ declare const resolveDefaultInjectWorkerPath: (workspaceRoot: string) => InjectWorkerInvocation | undefined;
160
+ /**
161
+ * Forks a single inject worker for the supplied job and waits for it to exit.
162
+ * The caller-provided job's `reportPath` is overwritten with a temp-dir path
163
+ * created by this function.
164
+ *
165
+ * The worker writes a JSON report at the temp path; this function reads it
166
+ * after the child exits and returns the per-job statistics. If the worker
167
+ * exits non-zero or fails to produce a report, the function throws with a
168
+ * label-rich message.
169
+ *
170
+ * The temp report directory is cleaned up before returning, regardless of
171
+ * success or failure.
172
+ *
173
+ * @param job - Inject job to dispatch.
174
+ * @param options - Worker path + optional memory monitor.
175
+ * @returns Worker report (output size + memory + duration) for the dispatched job.
176
+ *
177
+ * @example Dispatching a SEA inject for hf-build
178
+ * ```typescript
179
+ * const report = await dispatchInjectWorker(
180
+ * { hostBinary, outputBinary, blobPath, resourceName, machoSegmentName, sentinelFuse, reportPath: '' },
181
+ * { workerPath: '/abs/dist/.../worker.cjs.js', label: 'hf-build' }
182
+ * )
183
+ * ```
184
+ */
185
+ declare const dispatchInjectWorker: (job: InjectWorkerJob, options: DispatchInjectWorkerOptions) => Promise<InjectWorkerReport>;
186
+
187
+ /**
188
+ * Inputs to {@link resolveHostBinary}.
189
+ */
190
+ interface ResolveHostBinaryInputs {
191
+ /** Target platform identifier (`<platform>-<arch>`). */
192
+ platform: SeaPlatform;
193
+ /** Override for the path of the current Node executable; defaults to `process.execPath`. */
194
+ currentExecPath?: string;
195
+ /** Override for the current platform identifier; defaults to `<process.platform>-<process.arch>`. */
196
+ currentPlatform?: string;
197
+ }
198
+ /**
199
+ * Resolves the path of the Node host binary that will be cloned and have the
200
+ * SEA blob injected into it.
201
+ *
202
+ * The resolver is current-platform-only: the host binary is always
203
+ * `process.execPath`. Cross-platform builds are orchestrated by an external
204
+ * CI matrix where each runner produces the binary for its own platform.
205
+ *
206
+ * Calling this function with a target platform that doesn't match the current
207
+ * host throws — the caller is expected to gate via {@link currentPlatformMatches}
208
+ * before invoking the SEA pipeline. The throw exists as a defense-in-depth
209
+ * check should that gate be bypassed.
210
+ *
211
+ * @param inputs - Target platform and optional current-host overrides for testability.
212
+ * @returns Absolute path to a Node host binary suitable as a postject template.
213
+ * @throws {Error} When the requested platform doesn't match the current process platform.
214
+ *
215
+ * @example Resolving the host for the current runner
216
+ * ```typescript
217
+ * const host = resolveHostBinary({ platform: 'linux-x64' }) // process.execPath
218
+ * ```
219
+ */
220
+ declare const resolveHostBinary: (inputs: ResolveHostBinaryInputs) => string;
221
+
222
+ /**
223
+ * Inputs to {@link injectBlob}.
224
+ */
225
+ interface InjectBlobInputs {
226
+ /** Absolute path to the Node host binary to clone as the injection target. */
227
+ hostBinary: string;
228
+ /** Absolute path where the cloned + injected binary should land. */
229
+ outputBinary: string;
230
+ /** Absolute path to the SEA preparation blob produced by `node --experimental-sea-config`. */
231
+ blobPath: string;
232
+ /** Resource name for the injected SEA section. Defaults to Node's expected `NODE_SEA_BLOB`. */
233
+ resourceName?: string;
234
+ /** Mach-O segment name for macOS injection. Defaults to Node's expected `NODE_SEA`. */
235
+ machoSegmentName?: string;
236
+ /** SEA fuse string searched for in the binary. Defaults to Node's standard SEA fuse. */
237
+ sentinelFuse?: string;
238
+ }
239
+ /**
240
+ * Node's expected SEA resource name. Hardcoded by the runtime when looking up
241
+ * the embedded blob, so this value is required for the resulting binary to
242
+ * function as a single-executable application.
243
+ */
244
+ declare const NODE_SEA_RESOURCE_NAME = "NODE_SEA_BLOB";
245
+ /**
246
+ * Node's expected Mach-O segment name for SEA blobs on macOS.
247
+ */
248
+ declare const NODE_SEA_MACHO_SEGMENT = "NODE_SEA";
249
+ /**
250
+ * Sentinel fuse string Node's runtime flips from `0` → `1` to mark a SEA-injected binary.
251
+ *
252
+ * Built at runtime from two parts so the contiguous sentinel literal never appears
253
+ * in the bundled JS of a bin that imports this module: that JS is embedded in the
254
+ * SEA blob, and a contiguous copy there collides with the host binary's own sentinel,
255
+ * making postject reject the inject with "Multiple occurences of sentinel". Keep it
256
+ * split — do not inline into a single string literal.
257
+ */
258
+ declare const NODE_SEA_FUSE: string;
259
+ /**
260
+ * Clones the Node host binary to `outputBinary` and injects the SEA preparation
261
+ * blob via [postject](https://www.npmjs.com/package/postject)'s programmatic API.
262
+ *
263
+ * The host binary itself is never modified — postject mutates the cloned copy
264
+ * at `outputBinary`. The injection uses Node's expected SEA resource name and
265
+ * fuse so the produced executable is recognized by Node's SEA runtime.
266
+ *
267
+ * Callers are responsible for adjusting code-signing afterwards (see
268
+ * {@link removeCodesign} for macOS).
269
+ *
270
+ * @param inputs - Host binary, target output path, and blob path.
271
+ *
272
+ * @example Producing a SEA binary on a Linux runner
273
+ * ```typescript
274
+ * await injectBlob({
275
+ * hostBinary: process.execPath,
276
+ * outputBinary: '/abs/dist/libs/builder/bin/hf-build.linux-x64',
277
+ * blobPath: '/abs/dist/libs/builder/bin/hf-build.sea-prep.blob',
278
+ * })
279
+ * ```
280
+ */
281
+ declare const injectBlob: (inputs: InjectBlobInputs) => Promise<void>;
282
+
283
+ /**
284
+ * Inputs to {@link generateSeaBlob}.
285
+ */
286
+ interface GenerateSeaBlobInputs {
287
+ /** Absolute path to a SEA configuration JSON written to disk. */
288
+ seaConfigPath: string;
289
+ /** Absolute path the SEA configuration's `output` field points at; returned for caller convenience. */
290
+ outputBlobPath: string;
291
+ /** Override for the Node executable used to run the SEA-config command. Defaults to `process.execPath`. */
292
+ nodeExecutable?: string;
293
+ }
294
+ /**
295
+ * Outcome of a SEA blob generation attempt.
296
+ */
297
+ interface GenerateSeaBlobResult {
298
+ /** Absolute path of the emitted blob (echoes `inputs.outputBlobPath`). */
299
+ blobPath: string;
300
+ /** Exit status returned by the `node --experimental-sea-config` invocation. */
301
+ status: number;
302
+ }
303
+ /**
304
+ * Spawns `node --experimental-sea-config <seaConfigPath>` to produce the SEA
305
+ * preparation blob declared by the config's `output` field.
306
+ *
307
+ * Spawn errors and non-zero exit codes are surfaced as thrown `Error`s with the
308
+ * captured stderr included; this function does not retry.
309
+ *
310
+ * @param inputs - Resolved SEA config path + the blob path declared in that config.
311
+ * @returns The blob path (for chaining) and the spawn status.
312
+ *
313
+ * @example Generating the SEA prep blob
314
+ * ```typescript
315
+ * const result = generateSeaBlob({
316
+ * seaConfigPath: '/abs/dist/libs/builder/bin/hf-build.sea-config.json',
317
+ * outputBlobPath: '/abs/dist/libs/builder/bin/hf-build.sea-prep.blob',
318
+ * })
319
+ * ```
320
+ */
321
+ declare const generateSeaBlob: (inputs: GenerateSeaBlobInputs) => GenerateSeaBlobResult;
322
+
323
+ /**
324
+ * Inputs to {@link generateSeaConfig}.
325
+ */
326
+ interface SeaConfigInputs {
327
+ /** Absolute path to the bundled CJS entry the SEA blob will execute. */
328
+ mainPath: string;
329
+ /** Absolute path where the SEA blob should be emitted by `node --experimental-sea-config`. */
330
+ outputPath: string;
331
+ }
332
+ /**
333
+ * Shape of the JSON document consumed by `node --experimental-sea-config`.
334
+ *
335
+ * Mirrors the [Node SEA configuration schema]
336
+ * (https://nodejs.org/api/single-executable-applications.html). Builder always
337
+ * sets `disableExperimentalSEAWarning` so the produced binary doesn't print
338
+ * the warning banner on every invocation.
339
+ */
340
+ interface SeaConfigDocument {
341
+ /** Absolute path to the script the SEA bundle will execute. */
342
+ main: string;
343
+ /** Absolute path to the blob that `node --experimental-sea-config` will write. */
344
+ output: string;
345
+ /** Suppresses the runtime "this is an experimental feature" warning. Always `true`. */
346
+ disableExperimentalSEAWarning: true;
347
+ }
348
+ /**
349
+ * Builds the JSON document consumed by `node --experimental-sea-config <path>`.
350
+ *
351
+ * Builder always emits `disableExperimentalSEAWarning: true` to silence the
352
+ * runtime warning banner on every native binary invocation — published bins
353
+ * are expected to behave like first-class executables.
354
+ *
355
+ * @param inputs - Resolved absolute paths for the SEA `main` script and `output` blob.
356
+ * @returns SEA config document ready to be JSON-serialized to disk.
357
+ *
358
+ * @example Generating a SEA config for a bin
359
+ * ```typescript
360
+ * const config = generateSeaConfig({
361
+ * mainPath: '/abs/dist/libs/builder/bin/hf-build.cjs.js',
362
+ * outputPath: '/abs/dist/libs/builder/bin/hf-build.sea-prep.blob',
363
+ * })
364
+ * ```
365
+ */
366
+ declare const generateSeaConfig: (inputs: SeaConfigInputs) => SeaConfigDocument;
367
+
368
+ /**
369
+ * Returns the target identifier for the current Node process in the form
370
+ * `<process.platform>-<process.arch>` (e.g., `linux-x64`).
371
+ *
372
+ * The string is shaped to match {@link SeaPlatform} but is returned as a plain
373
+ * string because callers commonly compare against arbitrary user-declared
374
+ * platform lists, which may legally include values not in the supported union.
375
+ *
376
+ * @returns `<platform>-<arch>` for the current process.
377
+ *
378
+ * @example Identifying the current target
379
+ * ```typescript
380
+ * const target = currentPlatformTarget() // 'linux-x64'
381
+ * ```
382
+ */
383
+ declare const currentPlatformTarget: () => string;
384
+ /**
385
+ * Returns `true` when the current Node process matches one of the declared
386
+ * SEA target platforms — i.e., when `<process.platform>-<process.arch>` is
387
+ * present in `declaredPlatforms`.
388
+ *
389
+ * Builder uses this gate to skip native emission silently on runners that
390
+ * weren't asked to produce a binary for the current host. CI orchestrates the
391
+ * matrix so each declared platform is built on the matching runner.
392
+ *
393
+ * @param declaredPlatforms - Platforms declared on the bin's `sea` config.
394
+ * @returns Whether the current host matches any declared platform.
395
+ *
396
+ * @example Gating native emission to declared targets
397
+ * ```typescript
398
+ * if (!currentPlatformMatches(bin.sea?.platforms ?? [])) {
399
+ * log.info(`skipping native build for ${bin.name} on ${currentPlatformTarget()}`)
400
+ * return []
401
+ * }
402
+ * ```
403
+ */
404
+ declare const currentPlatformMatches: (declaredPlatforms: readonly SeaPlatform[]) => boolean;
405
+
406
+ export { NODE_SEA_FUSE, NODE_SEA_MACHO_SEGMENT, NODE_SEA_RESOURCE_NAME, applyCodesign, buildNativeBin, currentPlatformMatches, currentPlatformTarget, dispatchInjectWorker, generateSeaBlob, generateSeaConfig, injectBlob, removeCodesign, resolveDefaultInjectWorkerPath, resolveHostBinary };
407
+ export type { ApplyCodesignInputs, BuildNativeBinInputs, CodesignResult, DispatchInjectWorkerOptions, GenerateSeaBlobInputs, GenerateSeaBlobResult, InjectBlobInputs, InjectWorkerInvocation, RemoveCodesignInputs, ResolveHostBinaryInputs, SeaConfigDocument, SeaConfigInputs };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/builder/src/bin/native/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAC3F,YAAY,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACrF,YAAY,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChD,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAC9E,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACtE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAA;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACpG,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,249 @@
1
+ import { rmSync, existsSync, mkdtempSync, readFileSync, copyFileSync, unlinkSync } from 'node:fs';
2
+ import { tmpdir, freemem } from 'node:os';
3
+ import { dateNow } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.esm.js';
4
+ import { createError } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js';
5
+ import { logger } from '../../_dependencies/@hyperfrontend/logging/index.esm.js';
6
+ import { join, ensureDir, writeJsonFile, exists } from '../../_dependencies/@hyperfrontend/project-scope/core/index.esm.js';
7
+ import { isArray } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.esm.js';
8
+ import { spawnSync, spawn } from 'node:child_process';
9
+ import { stringify, parse } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.esm.js';
10
+ import { createPromise } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.esm.js';
11
+ import { inject } from '../../_dependencies/postject/index.esm.js';
12
+ import { normalizeFormats } from '../../_shared/bin/format/index.esm.js';
13
+ import { removeCodesign, applyCodesign } from '../../_shared/bin/native/codesign/index.esm.js';
14
+ import { resolveHostBinary } from '../../_shared/bin/native/host-binary/index.esm.js';
15
+ import { NODE_SEA_RESOURCE_NAME, NODE_SEA_MACHO_SEGMENT, NODE_SEA_FUSE, injectBlob } from '../../_shared/bin/native/inject/index.esm.js';
16
+ import { currentPlatformTarget, currentPlatformMatches } from '../../_shared/bin/native/platform-check/index.esm.js';
17
+ import { generateSeaBlob } from '../../_shared/bin/native/sea-blob/index.esm.js';
18
+ import { generateSeaConfig } from '../../_shared/bin/native/sea-config/index.esm.js';
19
+
20
+ const log$1 = logger.channel('builder:bin:native:dispatch');
21
+ const REPORT_DIR_PREFIX = 'hf-builder-inject-';
22
+ const SWC_NODE_REGISTER = '@swc-node/register';
23
+ const swcNodeAvailable = (workspaceRoot) => existsSync(join(workspaceRoot, 'node_modules', '@swc-node', 'register', 'index.js'));
24
+ /**
25
+ * Default worker-path resolution: prefers the built-and-published artifact, falls
26
+ * back to the workspace dist path, and finally to the in-source TypeScript file
27
+ * via `@swc-node/register` (bootstrap case where builder is building itself for
28
+ * the first time and the dist worker doesn't exist yet).
29
+ *
30
+ * Looks at, in order:
31
+ * 1. `<workspaceRoot>/dist/libs/builder/bin/native/worker/index.cjs.js`
32
+ * 2. `<workspaceRoot>/node_modules/@hyperfrontend/builder/bin/native/worker/index.cjs.js`
33
+ * 3. `<workspaceRoot>/libs/builder/src/bin/native/worker/index.ts` (with `--require \@swc-node/register`)
34
+ *
35
+ * @param workspaceRoot - Absolute workspace root.
36
+ * @returns Worker invocation descriptor, or `undefined` if no candidate exists.
37
+ *
38
+ * @example Locating the worker for an in-workspace consumer
39
+ * ```typescript
40
+ * const invocation = resolveDefaultInjectWorkerPath('/abs/repo')
41
+ * if (!invocation) throw new Error('builder inject worker artifact not found')
42
+ * ```
43
+ */
44
+ const resolveDefaultInjectWorkerPath = (workspaceRoot) => {
45
+ const distCandidates = [
46
+ join(workspaceRoot, 'dist', 'libs', 'builder', 'bin', 'native', 'worker', 'index.cjs.js'),
47
+ join(workspaceRoot, 'node_modules', '@hyperfrontend', 'builder', 'bin', 'native', 'worker', 'index.cjs.js'),
48
+ ];
49
+ for (const path of distCandidates) {
50
+ if (existsSync(path))
51
+ return { path, execArgv: [] };
52
+ }
53
+ const sourcePath = join(workspaceRoot, 'libs', 'builder', 'src', 'bin', 'native', 'worker', 'index.ts');
54
+ if (existsSync(sourcePath) && swcNodeAvailable(workspaceRoot)) {
55
+ return { path: sourcePath, execArgv: ['--require', SWC_NODE_REGISTER] };
56
+ }
57
+ return undefined;
58
+ };
59
+ const createReportDir = () => mkdtempSync(join(tmpdir(), REPORT_DIR_PREFIX));
60
+ const reportPathFor = (reportDir, job) => {
61
+ const safeLabel = job.outputBinary.replace(/[^a-zA-Z0-9_-]+/g, '_');
62
+ return join(reportDir, `inject-${safeLabel}.json`);
63
+ };
64
+ const runOne = (job, options, label) => createPromise((resolve, reject) => {
65
+ const execPath = options.execPath ?? process.execPath;
66
+ const argv = [...(options.execArgv ?? []), options.workerPath, stringify(job)];
67
+ const child = spawn(execPath, argv, { stdio: ['ignore', 'pipe', 'pipe'] });
68
+ let capturedStderr = '';
69
+ child.stdout?.on('data', (chunk) => {
70
+ process.stdout.write(chunk);
71
+ });
72
+ child.stderr?.on('data', (chunk) => {
73
+ const text = typeof chunk === 'string' ? chunk : chunk.toString();
74
+ capturedStderr += text;
75
+ process.stderr.write(text);
76
+ });
77
+ child.on('error', (error) => {
78
+ reject(createError(`inject worker for ${label} failed to spawn: ${error.message}`));
79
+ });
80
+ child.on('exit', (code) => {
81
+ if (code !== 0) {
82
+ const tail = capturedStderr.trim().split('\n').slice(-10).join('\n');
83
+ reject(createError(`inject worker for ${label} exited with code ${code}\n${tail}`));
84
+ return;
85
+ }
86
+ resolve();
87
+ });
88
+ });
89
+ const readReport = (reportPath, label) => {
90
+ if (!existsSync(reportPath)) {
91
+ throw createError(`inject worker for ${label} did not write a report at ${reportPath}`);
92
+ }
93
+ const data = parse(readFileSync(reportPath, 'utf8'));
94
+ return data;
95
+ };
96
+ /**
97
+ * Forks a single inject worker for the supplied job and waits for it to exit.
98
+ * The caller-provided job's `reportPath` is overwritten with a temp-dir path
99
+ * created by this function.
100
+ *
101
+ * The worker writes a JSON report at the temp path; this function reads it
102
+ * after the child exits and returns the per-job statistics. If the worker
103
+ * exits non-zero or fails to produce a report, the function throws with a
104
+ * label-rich message.
105
+ *
106
+ * The temp report directory is cleaned up before returning, regardless of
107
+ * success or failure.
108
+ *
109
+ * @param job - Inject job to dispatch.
110
+ * @param options - Worker path + optional memory monitor.
111
+ * @returns Worker report (output size + memory + duration) for the dispatched job.
112
+ *
113
+ * @example Dispatching a SEA inject for hf-build
114
+ * ```typescript
115
+ * const report = await dispatchInjectWorker(
116
+ * { hostBinary, outputBinary, blobPath, resourceName, machoSegmentName, sentinelFuse, reportPath: '' },
117
+ * { workerPath: '/abs/dist/.../worker.cjs.js', label: 'hf-build' }
118
+ * )
119
+ * ```
120
+ */
121
+ const dispatchInjectWorker = async (job, options) => {
122
+ const reportDir = createReportDir();
123
+ const label = options.label ?? job.outputBinary;
124
+ const reportPath = reportPathFor(reportDir, job);
125
+ const dispatched = { ...job, reportPath };
126
+ try {
127
+ options.monitor?.check(`bin:native:dispatch:${label}:start`);
128
+ log$1.info(`inject dispatch: ${label}`);
129
+ await runOne(dispatched, options, label);
130
+ const report = readReport(reportPath, label);
131
+ log$1.debug(`inject dispatch done: ${label} size=${report.outputSize}B heap=${report.endHeapMB.toFixed(1)}MB rss=${report.endRssMB.toFixed(1)}MB t=${report.durationMs}ms`);
132
+ options.monitor?.check(`bin:native:dispatch:${label}:end`);
133
+ return report;
134
+ }
135
+ finally {
136
+ rmSync(reportDir, { recursive: true, force: true });
137
+ }
138
+ };
139
+
140
+ const log = logger.channel('builder:bin:native');
141
+ const BYTES_PER_MB = 1024 * 1024;
142
+ const formatMB = (bytes) => (bytes / BYTES_PER_MB).toFixed(1);
143
+ const memorySnapshot = (label) => {
144
+ const usage = process.memoryUsage();
145
+ log.debug(`${label}: heap=${formatMB(usage.heapUsed)}MB rss=${formatMB(usage.rss)}MB free=${formatMB(freemem())}MB`);
146
+ };
147
+ const requireSeaConfig = (bin) => {
148
+ if (!bin.sea)
149
+ throw createError(`buildNativeBin called for bin '${bin.name}' without a sea config`);
150
+ return bin.sea.platforms;
151
+ };
152
+ const requireCjsFormat = (bin) => {
153
+ if (!normalizeFormats(bin.format).includes('cjs')) {
154
+ throw createError(`SEA requires a CJS bin output; declare format: ['cjs'] or format: 'cjs' on bin ${bin.name}`);
155
+ }
156
+ };
157
+ const resolveOutputBinaryPath = (binDir, name, target) => {
158
+ const isWindows = target.startsWith('win32-');
159
+ return join(binDir, isWindows ? `${name}.${target}.exe` : `${name}.${target}`);
160
+ };
161
+ // why: the SEA config JSON and prep blob are build scaffolding consumed by the inject step; once the binary exists they are useless to consumers and must not remain in the publishable output.
162
+ const cleanupSeaIntermediates = (seaConfigPath, blobPath) => {
163
+ for (const file of [seaConfigPath, blobPath]) {
164
+ if (exists(file))
165
+ unlinkSync(file);
166
+ }
167
+ };
168
+ /**
169
+ * Builds the Node SEA native binary for a single bin declaration.
170
+ *
171
+ * Pipeline (current-platform-only — cross-platform matrices are orchestrated externally):
172
+ * 1. Validate the bin declares CJS — SEA requires a CJS bundle as the embedded script.
173
+ * 2. Skip silently with an info log if the current host doesn't match any declared platform.
174
+ * 3. Generate the SEA config JSON and write it to disk.
175
+ * 4. Spawn `node --experimental-sea-config <path>` to emit the SEA preparation blob.
176
+ * 5. Resolve the Node host binary for the current platform (defaults to `process.execPath`).
177
+ * 6. Dispatch a forked inject worker that clones the host, embeds the blob via
178
+ * postject, and writes the output binary.
179
+ * 7. On macOS, strip the signature the injection invalidated so the unsigned binary still runs.
180
+ * 8. Delete the SEA build intermediates (config JSON + prep blob) so only the
181
+ * runtime binary remains in the publishable output.
182
+ *
183
+ * Native binaries are not auto-wired into `package.json#bin` — they are shipped
184
+ * as separate release artifacts.
185
+ *
186
+ * @param inputs - Bin declaration, resolved context, and the path to the already-built CJS bundle.
187
+ * @returns A single {@link BinOutput} of kind `native` for the current platform, or `[]` if skipped.
188
+ *
189
+ * @example Producing the SEA binary for the current runner
190
+ * ```typescript
191
+ * const outputs = await buildNativeBin({
192
+ * bin: { name: 'hf-build', format: 'cjs', sea: { platforms: ['linux-x64'] } },
193
+ * ctx: context,
194
+ * cjsOutputPath: '/abs/dist/libs/builder/bin/hf-build.js',
195
+ * })
196
+ * ```
197
+ */
198
+ const buildNativeBin = async (inputs) => {
199
+ const { bin, ctx, cjsOutputPath } = inputs;
200
+ requireCjsFormat(bin);
201
+ const platforms = requireSeaConfig(bin);
202
+ const target = currentPlatformTarget();
203
+ if (!currentPlatformMatches(platforms)) {
204
+ log.info(`skipping native build for ${bin.name}: current platform ${target} not in declared targets [${platforms.join(', ')}]`);
205
+ return [];
206
+ }
207
+ const binDir = join(ctx.outputPath, 'bin');
208
+ ensureDir(binDir);
209
+ const seaConfigPath = join(binDir, `${bin.name}.sea-config.json`);
210
+ const blobPath = join(binDir, `${bin.name}.sea-prep.blob`);
211
+ const outputBinary = resolveOutputBinaryPath(binDir, bin.name, target);
212
+ log.info(`building native bin: ${bin.name} (${target})`);
213
+ memorySnapshot(`${bin.name}: pre-sea-config`);
214
+ const seaConfig = generateSeaConfig({ mainPath: cjsOutputPath, outputPath: blobPath });
215
+ writeJsonFile(seaConfigPath, seaConfig);
216
+ memorySnapshot(`${bin.name}: pre-sea-blob`);
217
+ const blobStart = dateNow();
218
+ generateSeaBlob({ seaConfigPath, outputBlobPath: blobPath });
219
+ log.debug(`${bin.name}: sea blob generated in ${dateNow() - blobStart}ms`);
220
+ const hostBinary = resolveHostBinary({ platform: target });
221
+ memorySnapshot(`${bin.name}: pre-inject (host=${hostBinary})`);
222
+ const invocation = resolveDefaultInjectWorkerPath(ctx.workspaceRoot);
223
+ if (!invocation) {
224
+ throw createError('inject worker could not be resolved for native bin build. Build @hyperfrontend/builder at least once before invoking the bin phase, or ensure @swc-node/register is installed for source-mode bootstrap.');
225
+ }
226
+ try {
227
+ const report = await dispatchInjectWorker({
228
+ hostBinary,
229
+ outputBinary,
230
+ blobPath,
231
+ resourceName: NODE_SEA_RESOURCE_NAME,
232
+ machoSegmentName: NODE_SEA_MACHO_SEGMENT,
233
+ sentinelFuse: NODE_SEA_FUSE,
234
+ reportPath: '',
235
+ }, { workerPath: invocation.path, execArgv: invocation.execArgv, label: bin.name });
236
+ log.debug(`${bin.name}: inject completed in ${report.durationMs}ms (worker end heap=${report.endHeapMB.toFixed(1)}MB rss=${report.endRssMB.toFixed(1)}MB)`);
237
+ }
238
+ catch (error) {
239
+ log.error(`${bin.name}: postject inject failed: ${error instanceof Error ? error.message : String(error)}`);
240
+ throw error;
241
+ }
242
+ memorySnapshot(`${bin.name}: post-inject`);
243
+ removeCodesign({ binary: outputBinary });
244
+ cleanupSeaIntermediates(seaConfigPath, blobPath);
245
+ memorySnapshot(`${bin.name}: native build complete`);
246
+ return [{ name: bin.name, kind: 'native', outputPath: outputBinary, platform: target }];
247
+ };
248
+
249
+ export { NODE_SEA_FUSE, NODE_SEA_MACHO_SEGMENT, NODE_SEA_RESOURCE_NAME, applyCodesign, buildNativeBin, currentPlatformMatches, currentPlatformTarget, dispatchInjectWorker, generateSeaBlob, generateSeaConfig, injectBlob, removeCodesign, resolveDefaultInjectWorkerPath, resolveHostBinary };