@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.
- package/CHANGELOG.md +63 -0
- package/FUNDING.md +141 -0
- package/LICENSE.md +21 -0
- package/README.md +162 -0
- package/SECURITY.md +82 -0
- package/THIRD_PARTY_LICENSES.md +13 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.cjs.js +7 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.cjs.js +13 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.esm.js +8 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.cjs.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.esm.js +4 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/encoding/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/encoding/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js +6 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/function/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/function/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.cjs.js +7 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.cjs.js +6 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js +7 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/messaging/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/messaging/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js +13 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.esm.js +8 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.cjs.js +6 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/reflect/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/reflect/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/regexp/index.cjs.js +6 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/regexp/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js +6 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/string/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/string/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/symbol/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/symbol/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.cjs.js +13 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.esm.js +10 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/typed-arrays/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/typed-arrays/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/url/index.cjs.js +6 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/url/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/weak-map/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/weak-map/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/weak-set/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/weak-set/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/websocket/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/websocket/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/locked/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/locked/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/locked-prop-descriptors/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/locked-prop-descriptors/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/locked-props/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/locked-props/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/logging/index.cjs.js +191 -0
- package/_dependencies/@hyperfrontend/logging/index.esm.js +186 -0
- package/_dependencies/@hyperfrontend/project-scope/cli/index.cjs.js +196 -0
- package/_dependencies/@hyperfrontend/project-scope/cli/index.esm.js +196 -0
- package/_dependencies/@hyperfrontend/project-scope/core/encoding/index.cjs.js +82 -0
- package/_dependencies/@hyperfrontend/project-scope/core/encoding/index.esm.js +82 -0
- package/_dependencies/@hyperfrontend/project-scope/core/fs/index.cjs.js +154 -0
- package/_dependencies/@hyperfrontend/project-scope/core/fs/index.esm.js +149 -0
- package/_dependencies/@hyperfrontend/project-scope/core/index.cjs.js +459 -0
- package/_dependencies/@hyperfrontend/project-scope/core/index.esm.js +440 -0
- package/_dependencies/@hyperfrontend/project-scope/core/logger/index.cjs.js +84 -0
- package/_dependencies/@hyperfrontend/project-scope/core/logger/index.esm.js +80 -0
- package/_dependencies/@hyperfrontend/project-scope/core/path/index.cjs.js +26 -0
- package/_dependencies/@hyperfrontend/project-scope/core/path/index.esm.js +22 -0
- package/_dependencies/@hyperfrontend/project-scope/core/platform/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/project-scope/core/platform/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/project-scope/heuristics/dependencies/index.cjs.js +90 -0
- package/_dependencies/@hyperfrontend/project-scope/heuristics/dependencies/index.esm.js +90 -0
- package/_dependencies/@hyperfrontend/project-scope/heuristics/entry-points/index.cjs.js +174 -0
- package/_dependencies/@hyperfrontend/project-scope/heuristics/entry-points/index.esm.js +174 -0
- package/_dependencies/@hyperfrontend/project-scope/heuristics/framework/index.cjs.js +174 -0
- package/_dependencies/@hyperfrontend/project-scope/heuristics/framework/index.esm.js +172 -0
- package/_dependencies/@hyperfrontend/project-scope/heuristics/index.cjs.js +184 -0
- package/_dependencies/@hyperfrontend/project-scope/heuristics/index.esm.js +184 -0
- package/_dependencies/@hyperfrontend/project-scope/heuristics/project-type/index.cjs.js +172 -0
- package/_dependencies/@hyperfrontend/project-scope/heuristics/project-type/index.esm.js +172 -0
- package/_dependencies/@hyperfrontend/project-scope/index.cjs.js +222 -0
- package/_dependencies/@hyperfrontend/project-scope/index.esm.js +219 -0
- package/_dependencies/@hyperfrontend/project-scope/models/index.cjs.js +2 -0
- package/_dependencies/@hyperfrontend/project-scope/models/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/project-scope/nx/index.cjs.js +94 -0
- package/_dependencies/@hyperfrontend/project-scope/nx/index.esm.js +94 -0
- package/_dependencies/@hyperfrontend/project-scope/project/config/index.cjs.js +172 -0
- package/_dependencies/@hyperfrontend/project-scope/project/config/index.esm.js +172 -0
- package/_dependencies/@hyperfrontend/project-scope/project/index.cjs.js +176 -0
- package/_dependencies/@hyperfrontend/project-scope/project/index.esm.js +176 -0
- package/_dependencies/@hyperfrontend/project-scope/project/package/index.cjs.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/project/package/index.esm.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/project/root/index.cjs.js +154 -0
- package/_dependencies/@hyperfrontend/project-scope/project/root/index.esm.js +153 -0
- package/_dependencies/@hyperfrontend/project-scope/project/traversal/index.cjs.js +91 -0
- package/_dependencies/@hyperfrontend/project-scope/project/traversal/index.esm.js +89 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/backend/index.cjs.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/backend/index.esm.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/build/index.cjs.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/build/index.esm.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/frontend/index.cjs.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/frontend/index.esm.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/index.cjs.js +171 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/index.esm.js +169 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/legacy/index.cjs.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/legacy/index.esm.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/linting/index.cjs.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/linting/index.esm.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/monorepo/index.cjs.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/monorepo/index.esm.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/testing/index.cjs.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/testing/index.esm.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/types/index.cjs.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/tech/types/index.esm.js +88 -0
- package/_dependencies/@hyperfrontend/project-scope/vfs/index.cjs.js +102 -0
- package/_dependencies/@hyperfrontend/project-scope/vfs/index.esm.js +102 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/compare/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/compare/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/models/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/models/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/operations/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/operations/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/parse/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/parse/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/serialize/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/changelog/serialize/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/commits/author/index.cjs.js +2403 -0
- package/_dependencies/@hyperfrontend/versioning/commits/author/index.esm.js +2381 -0
- package/_dependencies/@hyperfrontend/versioning/commits/classify/index.cjs.js +38 -0
- package/_dependencies/@hyperfrontend/versioning/commits/classify/index.esm.js +30 -0
- package/_dependencies/@hyperfrontend/versioning/commits/format/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/commits/format/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/commits/index.cjs.js +2457 -0
- package/_dependencies/@hyperfrontend/versioning/commits/index.esm.js +2407 -0
- package/_dependencies/@hyperfrontend/versioning/commits/models/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/commits/models/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/commits/parse/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/commits/parse/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/commits/validate/index.cjs.js +27 -0
- package/_dependencies/@hyperfrontend/versioning/commits/validate/index.esm.js +25 -0
- package/_dependencies/@hyperfrontend/versioning/flow/executor/index.cjs.js +36 -0
- package/_dependencies/@hyperfrontend/versioning/flow/executor/index.esm.js +36 -0
- package/_dependencies/@hyperfrontend/versioning/flow/index.cjs.js +51 -0
- package/_dependencies/@hyperfrontend/versioning/flow/index.esm.js +51 -0
- package/_dependencies/@hyperfrontend/versioning/flow/models/index.cjs.js +30 -0
- package/_dependencies/@hyperfrontend/versioning/flow/models/index.esm.js +28 -0
- package/_dependencies/@hyperfrontend/versioning/flow/presets/index.cjs.js +47 -0
- package/_dependencies/@hyperfrontend/versioning/flow/presets/index.esm.js +45 -0
- package/_dependencies/@hyperfrontend/versioning/flow/steps/index.cjs.js +47 -0
- package/_dependencies/@hyperfrontend/versioning/flow/steps/index.esm.js +45 -0
- package/_dependencies/@hyperfrontend/versioning/git/index.cjs.js +8 -0
- package/_dependencies/@hyperfrontend/versioning/git/index.esm.js +9 -0
- package/_dependencies/@hyperfrontend/versioning/git/models/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/git/models/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/git/operations/index.cjs.js +3 -0
- package/_dependencies/@hyperfrontend/versioning/git/operations/index.esm.js +3 -0
- package/_dependencies/@hyperfrontend/versioning/index.cjs.js +2481 -0
- package/_dependencies/@hyperfrontend/versioning/index.esm.js +2423 -0
- package/_dependencies/@hyperfrontend/versioning/registry/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/registry/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/registry/models/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/registry/models/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/registry/npm/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/registry/npm/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/repository/index.cjs.js +18 -0
- package/_dependencies/@hyperfrontend/versioning/repository/index.esm.js +17 -0
- package/_dependencies/@hyperfrontend/versioning/repository/models/index.cjs.js +11 -0
- package/_dependencies/@hyperfrontend/versioning/repository/models/index.esm.js +10 -0
- package/_dependencies/@hyperfrontend/versioning/repository/parse/index.cjs.js +184 -0
- package/_dependencies/@hyperfrontend/versioning/repository/parse/index.esm.js +185 -0
- package/_dependencies/@hyperfrontend/versioning/repository/url/index.cjs.js +10 -0
- package/_dependencies/@hyperfrontend/versioning/repository/url/index.esm.js +8 -0
- package/_dependencies/@hyperfrontend/versioning/semver/compare/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/semver/compare/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/semver/format/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/semver/format/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/semver/increment/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/semver/increment/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/semver/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/semver/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/semver/models/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/semver/models/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/semver/parse/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/semver/parse/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/workspace/discovery/index.cjs.js +29 -0
- package/_dependencies/@hyperfrontend/versioning/workspace/discovery/index.esm.js +29 -0
- package/_dependencies/@hyperfrontend/versioning/workspace/index.cjs.js +29 -0
- package/_dependencies/@hyperfrontend/versioning/workspace/index.esm.js +29 -0
- package/_dependencies/@hyperfrontend/versioning/workspace/models/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/workspace/models/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/versioning/workspace/operations/index.cjs.js +2 -0
- package/_dependencies/@hyperfrontend/versioning/workspace/operations/index.esm.js +2 -0
- package/_dependencies/@rollup/plugin-commonjs/index.cjs.js +6629 -0
- package/_dependencies/@rollup/plugin-commonjs/index.esm.js +6608 -0
- package/_dependencies/@rollup/plugin-json/index.cjs.js +2324 -0
- package/_dependencies/@rollup/plugin-json/index.esm.js +2322 -0
- package/_dependencies/@rollup/plugin-node-resolve/index.cjs.js +5430 -0
- package/_dependencies/@rollup/plugin-node-resolve/index.esm.js +5424 -0
- package/_dependencies/@rollup/plugin-terser/index.cjs.js +33220 -0
- package/_dependencies/@rollup/plugin-terser/index.esm.js +33217 -0
- package/_dependencies/@rollup/plugin-typescript/index.cjs.js +4840 -0
- package/_dependencies/@rollup/plugin-typescript/index.esm.js +4819 -0
- package/_dependencies/postject/index.cjs.js +5140 -0
- package/_dependencies/postject/index.esm.js +5131 -0
- package/_dependencies/rollup/index.cjs.js +24668 -0
- package/_dependencies/rollup/index.d.ts +1921 -0
- package/_dependencies/rollup/index.esm.js +24652 -0
- package/_dependencies/rollup-plugin-dts/index.cjs.js +6547 -0
- package/_dependencies/rollup-plugin-dts/index.esm.js +6537 -0
- package/_shared/bin/format/index.cjs.js +7 -0
- package/_shared/bin/format/index.esm.js +5 -0
- package/_shared/bin/native/codesign/index.cjs.js +30 -0
- package/_shared/bin/native/codesign/index.esm.js +26 -0
- package/_shared/bin/native/host-binary/index.cjs.js +13 -0
- package/_shared/bin/native/host-binary/index.esm.js +11 -0
- package/_shared/bin/native/inject/index.cjs.js +25 -0
- package/_shared/bin/native/inject/index.esm.js +18 -0
- package/_shared/bin/native/platform-check/index.cjs.js +13 -0
- package/_shared/bin/native/platform-check/index.esm.js +10 -0
- package/_shared/bin/native/sea-blob/index.cjs.js +21 -0
- package/_shared/bin/native/sea-blob/index.esm.js +19 -0
- package/_shared/bin/native/sea-config/index.cjs.js +9 -0
- package/_shared/bin/native/sea-config/index.esm.js +7 -0
- package/_shared/bin/script/bootstrap-footer/index.cjs.js +22 -0
- package/_shared/bin/script/bootstrap-footer/index.esm.js +19 -0
- package/_shared/bundle/declarations/flatten-paths/index.cjs.js +34 -0
- package/_shared/bundle/declarations/flatten-paths/index.esm.js +29 -0
- package/_shared/bundle/dependencies/collect-workspace-deps/index.cjs.js +24 -0
- package/_shared/bundle/dependencies/collect-workspace-deps/index.esm.js +21 -0
- package/_shared/bundle/dependencies/externalize-plugin/index.cjs.js +93 -0
- package/_shared/bundle/dependencies/externalize-plugin/index.esm.js +86 -0
- package/_shared/bundle/dependencies/prune/ast-utils/index.esm.js +31 -0
- package/_shared/bundle/dependencies/prune/namespace-usage/index.esm.js +208 -0
- package/_shared/bundle/dependencies/prune/specifiers/index.cjs.js +62 -0
- package/_shared/bundle/dependencies/prune/specifiers/index.esm.js +53 -0
- package/_shared/bundle/entries/discover-entries/index.cjs.js +87 -0
- package/_shared/bundle/entries/discover-entries/index.esm.js +80 -0
- package/_shared/bundle/entries/resolve-entries/index.cjs.js +38 -0
- package/_shared/bundle/entries/resolve-entries/index.esm.js +34 -0
- package/_shared/bundle/externals/validate-globals/index.cjs.js +14 -0
- package/_shared/bundle/externals/validate-globals/index.esm.js +12 -0
- package/_shared/bundle/fs/deps-root/index.cjs.js +7 -0
- package/_shared/bundle/fs/deps-root/index.esm.js +5 -0
- package/_shared/bundle/fs/empty-dirs/index.cjs.js +23 -0
- package/_shared/bundle/fs/empty-dirs/index.esm.js +21 -0
- package/_shared/bundle/fs/entry-dir/index.cjs.js +7 -0
- package/_shared/bundle/fs/entry-dir/index.esm.js +5 -0
- package/_shared/bundle/fs/posix-path/index.cjs.js +9 -0
- package/_shared/bundle/fs/posix-path/index.esm.js +4 -0
- package/_shared/bundle/fs/under-dir/index.cjs.js +5 -0
- package/_shared/bundle/fs/under-dir/index.esm.js +3 -0
- package/_shared/memory/recover/index.cjs.js +15 -0
- package/_shared/memory/recover/index.esm.js +14 -0
- package/_shared/package/finalize-files/index.cjs.js +16 -0
- package/_shared/package/finalize-files/index.esm.js +15 -0
- package/_shared/package/json/cdn-paths/index.cjs.js +13 -0
- package/_shared/package/json/cdn-paths/index.esm.js +11 -0
- package/_shared/package/json/filter-deps/index.cjs.js +37 -0
- package/_shared/package/json/filter-deps/index.esm.js +34 -0
- package/_shared/package/json/generate-exports/index.cjs.js +56 -0
- package/_shared/package/json/generate-exports/index.esm.js +52 -0
- package/_shared/package/json/inherit-fields/index.cjs.js +19 -0
- package/_shared/package/json/inherit-fields/index.esm.js +17 -0
- package/_shared/package/json/read-package-json/index.cjs.js +7 -0
- package/_shared/package/json/read-package-json/index.esm.js +6 -0
- package/_shared/package/json/reflect-files-allowlist/index.cjs.js +39 -0
- package/_shared/package/json/reflect-files-allowlist/index.esm.js +33 -0
- package/_shared/package/json/synthesize/index.cjs.js +72 -0
- package/_shared/package/json/synthesize/index.esm.js +68 -0
- package/_shared/package/json/write/index.cjs.js +9 -0
- package/_shared/package/json/write/index.esm.js +8 -0
- package/_shared/package/licenses/generate-content/index.cjs.js +17 -0
- package/_shared/package/licenses/generate-content/index.esm.js +17 -0
- package/_shared/package/licenses/license-url/index.esm.js +29 -0
- package/_shared/package/licenses/write/index.cjs.js +9 -0
- package/_shared/package/licenses/write/index.esm.js +8 -0
- package/_shared/presets/by-names/index.cjs.js +10 -0
- package/_shared/presets/by-names/index.esm.js +8 -0
- package/_shared/presets/by-prefix/index.cjs.js +7 -0
- package/_shared/presets/by-prefix/index.esm.js +5 -0
- package/bin/format.d.ts +18 -0
- package/bin/format.d.ts.map +1 -0
- package/bin/hf-build.d.ts +81 -0
- package/bin/hf-build.d.ts.map +1 -0
- package/bin/hf-build.js +208533 -0
- package/bin/hf-build.linux-x64 +0 -0
- package/bin/index.cjs.js +548 -0
- package/bin/index.d.ts +26 -0
- package/bin/index.d.ts.map +1 -0
- package/bin/index.esm.js +546 -0
- package/bin/native/build-native.d.ts +44 -0
- package/bin/native/build-native.d.ts.map +1 -0
- package/bin/native/codesign.d.ts +65 -0
- package/bin/native/codesign.d.ts.map +1 -0
- package/bin/native/dispatch.d.ts +75 -0
- package/bin/native/dispatch.d.ts.map +1 -0
- package/bin/native/host-binary.d.ts +36 -0
- package/bin/native/host-binary.d.ts.map +1 -0
- package/bin/native/index.cjs.js +264 -0
- package/bin/native/index.d.ts +407 -0
- package/bin/native/index.d.ts.map +1 -0
- package/bin/native/index.esm.js +249 -0
- package/bin/native/inject.d.ts +61 -0
- package/bin/native/inject.d.ts.map +1 -0
- package/bin/native/platform-check.d.ts +39 -0
- package/bin/native/platform-check.d.ts.map +1 -0
- package/bin/native/sea-blob.d.ts +40 -0
- package/bin/native/sea-blob.d.ts.map +1 -0
- package/bin/native/sea-config.d.ts +45 -0
- package/bin/native/sea-config.d.ts.map +1 -0
- package/bin/native/worker/index.cjs.js +88 -0
- package/bin/native/worker/index.d.ts +68 -0
- package/bin/native/worker/index.d.ts.map +1 -0
- package/bin/native/worker/index.esm.js +86 -0
- package/bin/native/worker/job-runner.d.ts +29 -0
- package/bin/native/worker/job-runner.d.ts.map +1 -0
- package/bin/native/worker/types.d.ts +38 -0
- package/bin/native/worker/types.d.ts.map +1 -0
- package/bin/run-bin-phase.d.ts +24 -0
- package/bin/run-bin-phase.d.ts.map +1 -0
- package/bin/script/bootstrap-footer.d.ts +41 -0
- package/bin/script/bootstrap-footer.d.ts.map +1 -0
- package/bin/script/build-bin.d.ts +36 -0
- package/bin/script/build-bin.d.ts.map +1 -0
- package/bin/script/index.cjs.js +265 -0
- package/bin/script/index.d.ts +79 -0
- package/bin/script/index.d.ts.map +1 -0
- package/bin/script/index.esm.js +262 -0
- package/build.d.ts +56 -0
- package/build.d.ts.map +1 -0
- package/bundle/declarations/dts-per-entry.d.ts +27 -0
- package/bundle/declarations/dts-per-entry.d.ts.map +1 -0
- package/bundle/declarations/dts-pre-pass.d.ts +18 -0
- package/bundle/declarations/dts-pre-pass.d.ts.map +1 -0
- package/bundle/declarations/flatten-paths.d.ts +28 -0
- package/bundle/declarations/flatten-paths.d.ts.map +1 -0
- package/bundle/declarations/generate-declarations.d.ts +33 -0
- package/bundle/declarations/generate-declarations.d.ts.map +1 -0
- package/bundle/declarations/index.cjs.js +868 -0
- package/bundle/declarations/index.d.ts +262 -0
- package/bundle/declarations/index.d.ts.map +1 -0
- package/bundle/declarations/index.esm.js +857 -0
- package/bundle/declarations/prune-orphan-dts.d.ts +33 -0
- package/bundle/declarations/prune-orphan-dts.d.ts.map +1 -0
- package/bundle/declarations/sibling-resolver.d.ts +125 -0
- package/bundle/declarations/sibling-resolver.d.ts.map +1 -0
- package/bundle/dedupe/attribute-modules.d.ts +178 -0
- package/bundle/dedupe/attribute-modules.d.ts.map +1 -0
- package/bundle/dedupe/extract-chunk.d.ts +103 -0
- package/bundle/dedupe/extract-chunk.d.ts.map +1 -0
- package/bundle/dedupe/hoist-shared.d.ts +37 -0
- package/bundle/dedupe/hoist-shared.d.ts.map +1 -0
- package/bundle/dedupe/index.cjs.js +818 -0
- package/bundle/dedupe/index.d.ts +400 -0
- package/bundle/dedupe/index.d.ts.map +1 -0
- package/bundle/dedupe/index.esm.js +766 -0
- package/bundle/dedupe/plan-hoists.d.ts +46 -0
- package/bundle/dedupe/plan-hoists.d.ts.map +1 -0
- package/bundle/dedupe/rewrite-entry.d.ts +39 -0
- package/bundle/dedupe/rewrite-entry.d.ts.map +1 -0
- package/bundle/dependencies/collect-workspace-deps.d.ts +34 -0
- package/bundle/dependencies/collect-workspace-deps.d.ts.map +1 -0
- package/bundle/dependencies/externalize-plugin.d.ts +100 -0
- package/bundle/dependencies/externalize-plugin.d.ts.map +1 -0
- package/bundle/dependencies/index.cjs.js +964 -0
- package/bundle/dependencies/index.d.ts +388 -0
- package/bundle/dependencies/index.d.ts.map +1 -0
- package/bundle/dependencies/index.esm.js +947 -0
- package/bundle/dependencies/pre-pass.d.ts +154 -0
- package/bundle/dependencies/pre-pass.d.ts.map +1 -0
- package/bundle/dependencies/prune/ast-utils.d.ts +121 -0
- package/bundle/dependencies/prune/ast-utils.d.ts.map +1 -0
- package/bundle/dependencies/prune/chunk-graph.d.ts +175 -0
- package/bundle/dependencies/prune/chunk-graph.d.ts.map +1 -0
- package/bundle/dependencies/prune/dead-export-pass.d.ts +32 -0
- package/bundle/dependencies/prune/dead-export-pass.d.ts.map +1 -0
- package/bundle/dependencies/prune/dead-exports.d.ts +36 -0
- package/bundle/dependencies/prune/dead-exports.d.ts.map +1 -0
- package/bundle/dependencies/prune/destructure-requires-pass.d.ts +31 -0
- package/bundle/dependencies/prune/destructure-requires-pass.d.ts.map +1 -0
- package/bundle/dependencies/prune/destructure-requires.d.ts +42 -0
- package/bundle/dependencies/prune/destructure-requires.d.ts.map +1 -0
- package/bundle/dependencies/prune/edits.d.ts +30 -0
- package/bundle/dependencies/prune/edits.d.ts.map +1 -0
- package/bundle/dependencies/prune/namespace-usage.d.ts +104 -0
- package/bundle/dependencies/prune/namespace-usage.d.ts.map +1 -0
- package/bundle/dependencies/prune/orphan-chunks.d.ts +69 -0
- package/bundle/dependencies/prune/orphan-chunks.d.ts.map +1 -0
- package/bundle/dependencies/prune/property-strip-pass.d.ts +38 -0
- package/bundle/dependencies/prune/property-strip-pass.d.ts.map +1 -0
- package/bundle/dependencies/prune/property-strip.d.ts +69 -0
- package/bundle/dependencies/prune/property-strip.d.ts.map +1 -0
- package/bundle/dependencies/prune/prune-dependencies.d.ts +52 -0
- package/bundle/dependencies/prune/prune-dependencies.d.ts.map +1 -0
- package/bundle/dependencies/prune/reachability.d.ts +36 -0
- package/bundle/dependencies/prune/reachability.d.ts.map +1 -0
- package/bundle/dependencies/prune/specifiers.d.ts +39 -0
- package/bundle/dependencies/prune/specifiers.d.ts.map +1 -0
- package/bundle/dependencies/prune/strip-comments.d.ts +47 -0
- package/bundle/dependencies/prune/strip-comments.d.ts.map +1 -0
- package/bundle/dependencies/prune/used-exports.d.ts +32 -0
- package/bundle/dependencies/prune/used-exports.d.ts.map +1 -0
- package/bundle/dependencies/resolve-bundled-deps.d.ts +37 -0
- package/bundle/dependencies/resolve-bundled-deps.d.ts.map +1 -0
- package/bundle/dependencies/resolve-dep-entry.d.ts +38 -0
- package/bundle/dependencies/resolve-dep-entry.d.ts.map +1 -0
- package/bundle/dependencies/resolve-workspace-bundled-deps.d.ts +96 -0
- package/bundle/dependencies/resolve-workspace-bundled-deps.d.ts.map +1 -0
- package/bundle/dependencies/worker/index.cjs.js +524 -0
- package/bundle/dependencies/worker/index.d.ts +102 -0
- package/bundle/dependencies/worker/index.d.ts.map +1 -0
- package/bundle/dependencies/worker/index.esm.js +515 -0
- package/bundle/dependencies/worker/job-runner.d.ts +115 -0
- package/bundle/dependencies/worker/job-runner.d.ts.map +1 -0
- package/bundle/entries/by-platform.d.ts +27 -0
- package/bundle/entries/by-platform.d.ts.map +1 -0
- package/bundle/entries/discover-entries.d.ts +24 -0
- package/bundle/entries/discover-entries.d.ts.map +1 -0
- package/bundle/entries/index.cjs.js +38 -0
- package/bundle/entries/index.d.ts +70 -0
- package/bundle/entries/index.d.ts.map +1 -0
- package/bundle/entries/index.esm.js +33 -0
- package/bundle/entries/resolve-entries.d.ts +19 -0
- package/bundle/entries/resolve-entries.d.ts.map +1 -0
- package/bundle/externals/index.cjs.js +54 -0
- package/bundle/externals/index.d.ts +74 -0
- package/bundle/externals/index.d.ts.map +1 -0
- package/bundle/externals/index.esm.js +51 -0
- package/bundle/externals/resolve-externals.d.ts +52 -0
- package/bundle/externals/resolve-externals.d.ts.map +1 -0
- package/bundle/externals/validate-globals.d.ts +19 -0
- package/bundle/externals/validate-globals.d.ts.map +1 -0
- package/bundle/fs/deps-root.d.ts +17 -0
- package/bundle/fs/deps-root.d.ts.map +1 -0
- package/bundle/fs/empty-dirs.d.ts +18 -0
- package/bundle/fs/empty-dirs.d.ts.map +1 -0
- package/bundle/fs/entry-dir.d.ts +21 -0
- package/bundle/fs/entry-dir.d.ts.map +1 -0
- package/bundle/fs/posix-path.d.ts +30 -0
- package/bundle/fs/posix-path.d.ts.map +1 -0
- package/bundle/fs/under-dir.d.ts +19 -0
- package/bundle/fs/under-dir.d.ts.map +1 -0
- package/bundle/index.cjs.js +4046 -0
- package/bundle/index.d.ts +25 -0
- package/bundle/index.d.ts.map +1 -0
- package/bundle/index.esm.js +3689 -0
- package/bundle/rollup/descriptor.d.ts +99 -0
- package/bundle/rollup/descriptor.d.ts.map +1 -0
- package/bundle/rollup/dispatch.d.ts +72 -0
- package/bundle/rollup/dispatch.d.ts.map +1 -0
- package/bundle/rollup/index.cjs.js +715 -0
- package/bundle/rollup/index.d.ts +174 -0
- package/bundle/rollup/index.d.ts.map +1 -0
- package/bundle/rollup/index.esm.js +698 -0
- package/bundle/rollup/worker/index.cjs.js +290 -0
- package/bundle/rollup/worker/index.d.ts +131 -0
- package/bundle/rollup/worker/index.d.ts.map +1 -0
- package/bundle/rollup/worker/index.esm.js +280 -0
- package/bundle/rollup/worker/job-runner.d.ts +18 -0
- package/bundle/rollup/worker/job-runner.d.ts.map +1 -0
- package/bundle/rollup/worker/types.d.ts +111 -0
- package/bundle/rollup/worker/types.d.ts.map +1 -0
- package/bundle/run-bundle-phase.d.ts +23 -0
- package/bundle/run-bundle-phase.d.ts.map +1 -0
- package/clean-output.d.ts +26 -0
- package/clean-output.d.ts.map +1 -0
- package/index.cjs.js +5317 -0
- package/index.d.ts +64 -0
- package/index.d.ts.map +1 -0
- package/index.esm.js +4910 -0
- package/memory/index.cjs.js +101 -0
- package/memory/index.d.ts +81 -0
- package/memory/index.d.ts.map +1 -0
- package/memory/index.esm.js +98 -0
- package/memory/monitor.d.ts +59 -0
- package/memory/monitor.d.ts.map +1 -0
- package/memory/recover.d.ts +19 -0
- package/memory/recover.d.ts.map +1 -0
- package/models/build-config.d.ts +266 -0
- package/models/build-config.d.ts.map +1 -0
- package/models/build-context.d.ts +68 -0
- package/models/build-context.d.ts.map +1 -0
- package/models/build-result.d.ts +43 -0
- package/models/build-result.d.ts.map +1 -0
- package/models/entry-point.d.ts +45 -0
- package/models/entry-point.d.ts.map +1 -0
- package/models/format-output.d.ts +34 -0
- package/models/format-output.d.ts.map +1 -0
- package/models/index.cjs.js +2 -0
- package/models/index.d.ts +581 -0
- package/models/index.d.ts.map +1 -0
- package/models/index.esm.js +1 -0
- package/models/package-json.d.ts +130 -0
- package/models/package-json.d.ts.map +1 -0
- package/package/assets/copy-assets.d.ts +31 -0
- package/package/assets/copy-assets.d.ts.map +1 -0
- package/package/assets/index.cjs.js +84 -0
- package/package/assets/index.d.ts +33 -0
- package/package/assets/index.d.ts.map +1 -0
- package/package/assets/index.esm.js +82 -0
- package/package/finalize-files.d.ts +25 -0
- package/package/finalize-files.d.ts.map +1 -0
- package/package/index.cjs.js +276 -0
- package/package/index.d.ts +56 -0
- package/package/index.d.ts.map +1 -0
- package/package/index.esm.js +231 -0
- package/package/json/cdn-paths.d.ts +41 -0
- package/package/json/cdn-paths.d.ts.map +1 -0
- package/package/json/filter-deps.d.ts +39 -0
- package/package/json/filter-deps.d.ts.map +1 -0
- package/package/json/generate-exports.d.ts +29 -0
- package/package/json/generate-exports.d.ts.map +1 -0
- package/package/json/index.cjs.js +24 -0
- package/package/json/index.d.ts +252 -0
- package/package/json/index.d.ts.map +1 -0
- package/package/json/index.esm.js +14 -0
- package/package/json/inherit-fields.d.ts +25 -0
- package/package/json/inherit-fields.d.ts.map +1 -0
- package/package/json/read-package-json.d.ts +18 -0
- package/package/json/read-package-json.d.ts.map +1 -0
- package/package/json/reflect-files-allowlist.d.ts +32 -0
- package/package/json/reflect-files-allowlist.d.ts.map +1 -0
- package/package/json/synthesize.d.ts +53 -0
- package/package/json/synthesize.d.ts.map +1 -0
- package/package/json/write.d.ts +18 -0
- package/package/json/write.d.ts.map +1 -0
- package/package/licenses/collect.d.ts +25 -0
- package/package/licenses/collect.d.ts.map +1 -0
- package/package/licenses/generate-content.d.ts +20 -0
- package/package/licenses/generate-content.d.ts.map +1 -0
- package/package/licenses/index.cjs.js +135 -0
- package/package/licenses/index.d.ts +73 -0
- package/package/licenses/index.d.ts.map +1 -0
- package/package/licenses/index.esm.js +89 -0
- package/package/licenses/license-url.d.ts +20 -0
- package/package/licenses/license-url.d.ts.map +1 -0
- package/package/licenses/types.d.ts +12 -0
- package/package/licenses/types.d.ts.map +1 -0
- package/package/licenses/write.d.ts +16 -0
- package/package/licenses/write.d.ts.map +1 -0
- package/package/run-package-phase.d.ts +30 -0
- package/package/run-package-phase.d.ts.map +1 -0
- package/package.json +347 -0
- package/presets/by-names.d.ts +20 -0
- package/presets/by-names.d.ts.map +1 -0
- package/presets/by-prefix.d.ts +22 -0
- package/presets/by-prefix.d.ts.map +1 -0
- package/presets/index.cjs.js +8 -0
- package/presets/index.d.ts +43 -0
- package/presets/index.d.ts.map +1 -0
- package/presets/index.esm.js +5 -0
|
Binary file
|
package/bin/index.cjs.js
ADDED
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index_cjs_js$6 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js');
|
|
4
|
+
const index_cjs_js = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.cjs.js');
|
|
5
|
+
const index_cjs_js$1 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.cjs.js');
|
|
6
|
+
const node_fs = require('node:fs');
|
|
7
|
+
const node_os = require('node:os');
|
|
8
|
+
const index_cjs_js$7 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.cjs.js');
|
|
9
|
+
const index_cjs_js$3 = require('../_dependencies/@hyperfrontend/logging/index.cjs.js');
|
|
10
|
+
const index_cjs_js$4 = require('../_dependencies/@hyperfrontend/project-scope/core/index.cjs.js');
|
|
11
|
+
const index_cjs_js$2 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.cjs.js');
|
|
12
|
+
const node_child_process = require('node:child_process');
|
|
13
|
+
const index_cjs_js$5 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.cjs.js');
|
|
14
|
+
const { recover } = require('../_shared/memory/recover/index.cjs.js');
|
|
15
|
+
const { normalizeFormats } = require('../_shared/bin/format/index.cjs.js');
|
|
16
|
+
const { removeCodesign } = require('../_shared/bin/native/codesign/index.cjs.js');
|
|
17
|
+
const { resolveHostBinary } = require('../_shared/bin/native/host-binary/index.cjs.js');
|
|
18
|
+
const { NODE_SEA_RESOURCE_NAME, NODE_SEA_MACHO_SEGMENT, NODE_SEA_FUSE } = require('../_shared/bin/native/inject/index.cjs.js');
|
|
19
|
+
const { currentPlatformTarget, currentPlatformMatches } = require('../_shared/bin/native/platform-check/index.cjs.js');
|
|
20
|
+
const { generateSeaBlob } = require('../_shared/bin/native/sea-blob/index.cjs.js');
|
|
21
|
+
const { generateSeaConfig } = require('../_shared/bin/native/sea-config/index.cjs.js');
|
|
22
|
+
const { defaultBootstrap } = require('../_shared/bin/script/bootstrap-footer/index.cjs.js');
|
|
23
|
+
const { buildWorkspaceRoutes } = require('../_shared/bundle/dependencies/externalize-plugin/index.cjs.js');
|
|
24
|
+
const { depsRootOf } = require('../_shared/bundle/fs/deps-root/index.cjs.js');
|
|
25
|
+
require('../_dependencies/postject/index.cjs.js');
|
|
26
|
+
const index_cjs_js$8 = require('../_dependencies/@hyperfrontend/project-scope/core/path/index.cjs.js');
|
|
27
|
+
require('node:module');
|
|
28
|
+
require('node:path');
|
|
29
|
+
require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js');
|
|
30
|
+
require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js');
|
|
31
|
+
require('../_dependencies/@hyperfrontend/project-scope/core/fs/index.cjs.js');
|
|
32
|
+
|
|
33
|
+
const log$3 = index_cjs_js$3.logger.channel('builder:bin:native:dispatch');
|
|
34
|
+
const REPORT_DIR_PREFIX$1 = 'hf-builder-inject-';
|
|
35
|
+
const SWC_NODE_REGISTER$1 = '@swc-node/register';
|
|
36
|
+
const swcNodeAvailable$1 = (workspaceRoot) => node_fs.existsSync(index_cjs_js$4.join(workspaceRoot, 'node_modules', '@swc-node', 'register', 'index.js'));
|
|
37
|
+
/**
|
|
38
|
+
* Default worker-path resolution: prefers the built-and-published artifact, falls
|
|
39
|
+
* back to the workspace dist path, and finally to the in-source TypeScript file
|
|
40
|
+
* via `@swc-node/register` (bootstrap case where builder is building itself for
|
|
41
|
+
* the first time and the dist worker doesn't exist yet).
|
|
42
|
+
*
|
|
43
|
+
* Looks at, in order:
|
|
44
|
+
* 1. `<workspaceRoot>/dist/libs/builder/bin/native/worker/index.cjs.js`
|
|
45
|
+
* 2. `<workspaceRoot>/node_modules/@hyperfrontend/builder/bin/native/worker/index.cjs.js`
|
|
46
|
+
* 3. `<workspaceRoot>/libs/builder/src/bin/native/worker/index.ts` (with `--require \@swc-node/register`)
|
|
47
|
+
*
|
|
48
|
+
* @param workspaceRoot - Absolute workspace root.
|
|
49
|
+
* @returns Worker invocation descriptor, or `undefined` if no candidate exists.
|
|
50
|
+
*
|
|
51
|
+
* @example Locating the worker for an in-workspace consumer
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const invocation = resolveDefaultInjectWorkerPath('/abs/repo')
|
|
54
|
+
* if (!invocation) throw new Error('builder inject worker artifact not found')
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
const resolveDefaultInjectWorkerPath = (workspaceRoot) => {
|
|
58
|
+
const distCandidates = [
|
|
59
|
+
index_cjs_js$4.join(workspaceRoot, 'dist', 'libs', 'builder', 'bin', 'native', 'worker', 'index.cjs.js'),
|
|
60
|
+
index_cjs_js$4.join(workspaceRoot, 'node_modules', '@hyperfrontend', 'builder', 'bin', 'native', 'worker', 'index.cjs.js'),
|
|
61
|
+
];
|
|
62
|
+
for (const path of distCandidates) {
|
|
63
|
+
if (node_fs.existsSync(path))
|
|
64
|
+
return { path, execArgv: [] };
|
|
65
|
+
}
|
|
66
|
+
const sourcePath = index_cjs_js$4.join(workspaceRoot, 'libs', 'builder', 'src', 'bin', 'native', 'worker', 'index.ts');
|
|
67
|
+
if (node_fs.existsSync(sourcePath) && swcNodeAvailable$1(workspaceRoot)) {
|
|
68
|
+
return { path: sourcePath, execArgv: ['--require', SWC_NODE_REGISTER$1] };
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
};
|
|
72
|
+
const createReportDir$1 = () => node_fs.mkdtempSync(index_cjs_js$4.join(node_os.tmpdir(), REPORT_DIR_PREFIX$1));
|
|
73
|
+
const reportPathFor$1 = (reportDir, job) => {
|
|
74
|
+
const safeLabel = job.outputBinary.replace(/[^a-zA-Z0-9_-]+/g, '_');
|
|
75
|
+
return index_cjs_js$4.join(reportDir, `inject-${safeLabel}.json`);
|
|
76
|
+
};
|
|
77
|
+
const runOne$1 = (job, options, label) => index_cjs_js.createPromise((resolve, reject) => {
|
|
78
|
+
const execPath = options.execPath ?? process.execPath;
|
|
79
|
+
const argv = [...(options.execArgv ?? []), options.workerPath, index_cjs_js$5.stringify(job)];
|
|
80
|
+
const child = node_child_process.spawn(execPath, argv, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
81
|
+
let capturedStderr = '';
|
|
82
|
+
child.stdout?.on('data', (chunk) => {
|
|
83
|
+
process.stdout.write(chunk);
|
|
84
|
+
});
|
|
85
|
+
child.stderr?.on('data', (chunk) => {
|
|
86
|
+
const text = typeof chunk === 'string' ? chunk : chunk.toString();
|
|
87
|
+
capturedStderr += text;
|
|
88
|
+
process.stderr.write(text);
|
|
89
|
+
});
|
|
90
|
+
child.on('error', (error) => {
|
|
91
|
+
reject(index_cjs_js$6.createError(`inject worker for ${label} failed to spawn: ${error.message}`));
|
|
92
|
+
});
|
|
93
|
+
child.on('exit', (code) => {
|
|
94
|
+
if (code !== 0) {
|
|
95
|
+
const tail = capturedStderr.trim().split('\n').slice(-10).join('\n');
|
|
96
|
+
reject(index_cjs_js$6.createError(`inject worker for ${label} exited with code ${code}\n${tail}`));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
resolve();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
const readReport$1 = (reportPath, label) => {
|
|
103
|
+
if (!node_fs.existsSync(reportPath)) {
|
|
104
|
+
throw index_cjs_js$6.createError(`inject worker for ${label} did not write a report at ${reportPath}`);
|
|
105
|
+
}
|
|
106
|
+
const data = index_cjs_js$5.parse(node_fs.readFileSync(reportPath, 'utf8'));
|
|
107
|
+
return data;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Forks a single inject worker for the supplied job and waits for it to exit.
|
|
111
|
+
* The caller-provided job's `reportPath` is overwritten with a temp-dir path
|
|
112
|
+
* created by this function.
|
|
113
|
+
*
|
|
114
|
+
* The worker writes a JSON report at the temp path; this function reads it
|
|
115
|
+
* after the child exits and returns the per-job statistics. If the worker
|
|
116
|
+
* exits non-zero or fails to produce a report, the function throws with a
|
|
117
|
+
* label-rich message.
|
|
118
|
+
*
|
|
119
|
+
* The temp report directory is cleaned up before returning, regardless of
|
|
120
|
+
* success or failure.
|
|
121
|
+
*
|
|
122
|
+
* @param job - Inject job to dispatch.
|
|
123
|
+
* @param options - Worker path + optional memory monitor.
|
|
124
|
+
* @returns Worker report (output size + memory + duration) for the dispatched job.
|
|
125
|
+
*
|
|
126
|
+
* @example Dispatching a SEA inject for hf-build
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const report = await dispatchInjectWorker(
|
|
129
|
+
* { hostBinary, outputBinary, blobPath, resourceName, machoSegmentName, sentinelFuse, reportPath: '' },
|
|
130
|
+
* { workerPath: '/abs/dist/.../worker.cjs.js', label: 'hf-build' }
|
|
131
|
+
* )
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
const dispatchInjectWorker = async (job, options) => {
|
|
135
|
+
const reportDir = createReportDir$1();
|
|
136
|
+
const label = options.label ?? job.outputBinary;
|
|
137
|
+
const reportPath = reportPathFor$1(reportDir, job);
|
|
138
|
+
const dispatched = { ...job, reportPath };
|
|
139
|
+
try {
|
|
140
|
+
options.monitor?.check(`bin:native:dispatch:${label}:start`);
|
|
141
|
+
log$3.info(`inject dispatch: ${label}`);
|
|
142
|
+
await runOne$1(dispatched, options, label);
|
|
143
|
+
const report = readReport$1(reportPath, label);
|
|
144
|
+
log$3.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`);
|
|
145
|
+
options.monitor?.check(`bin:native:dispatch:${label}:end`);
|
|
146
|
+
return report;
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
node_fs.rmSync(reportDir, { recursive: true, force: true });
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const log$2 = index_cjs_js$3.logger.channel('builder:bin:native');
|
|
154
|
+
const BYTES_PER_MB = 1024 * 1024;
|
|
155
|
+
const formatMB = (bytes) => (bytes / BYTES_PER_MB).toFixed(1);
|
|
156
|
+
const memorySnapshot = (label) => {
|
|
157
|
+
const usage = process.memoryUsage();
|
|
158
|
+
log$2.debug(`${label}: heap=${formatMB(usage.heapUsed)}MB rss=${formatMB(usage.rss)}MB free=${formatMB(node_os.freemem())}MB`);
|
|
159
|
+
};
|
|
160
|
+
const requireSeaConfig = (bin) => {
|
|
161
|
+
if (!bin.sea)
|
|
162
|
+
throw index_cjs_js$6.createError(`buildNativeBin called for bin '${bin.name}' without a sea config`);
|
|
163
|
+
return bin.sea.platforms;
|
|
164
|
+
};
|
|
165
|
+
const requireCjsFormat = (bin) => {
|
|
166
|
+
if (!normalizeFormats(bin.format).includes('cjs')) {
|
|
167
|
+
throw index_cjs_js$6.createError(`SEA requires a CJS bin output; declare format: ['cjs'] or format: 'cjs' on bin ${bin.name}`);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const resolveOutputBinaryPath = (binDir, name, target) => {
|
|
171
|
+
const isWindows = target.startsWith('win32-');
|
|
172
|
+
return index_cjs_js$4.join(binDir, isWindows ? `${name}.${target}.exe` : `${name}.${target}`);
|
|
173
|
+
};
|
|
174
|
+
// 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.
|
|
175
|
+
const cleanupSeaIntermediates = (seaConfigPath, blobPath) => {
|
|
176
|
+
for (const file of [seaConfigPath, blobPath]) {
|
|
177
|
+
if (index_cjs_js$4.exists(file))
|
|
178
|
+
node_fs.unlinkSync(file);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Builds the Node SEA native binary for a single bin declaration.
|
|
183
|
+
*
|
|
184
|
+
* Pipeline (current-platform-only — cross-platform matrices are orchestrated externally):
|
|
185
|
+
* 1. Validate the bin declares CJS — SEA requires a CJS bundle as the embedded script.
|
|
186
|
+
* 2. Skip silently with an info log if the current host doesn't match any declared platform.
|
|
187
|
+
* 3. Generate the SEA config JSON and write it to disk.
|
|
188
|
+
* 4. Spawn `node --experimental-sea-config <path>` to emit the SEA preparation blob.
|
|
189
|
+
* 5. Resolve the Node host binary for the current platform (defaults to `process.execPath`).
|
|
190
|
+
* 6. Dispatch a forked inject worker that clones the host, embeds the blob via
|
|
191
|
+
* postject, and writes the output binary.
|
|
192
|
+
* 7. On macOS, strip the signature the injection invalidated so the unsigned binary still runs.
|
|
193
|
+
* 8. Delete the SEA build intermediates (config JSON + prep blob) so only the
|
|
194
|
+
* runtime binary remains in the publishable output.
|
|
195
|
+
*
|
|
196
|
+
* Native binaries are not auto-wired into `package.json#bin` — they are shipped
|
|
197
|
+
* as separate release artifacts.
|
|
198
|
+
*
|
|
199
|
+
* @param inputs - Bin declaration, resolved context, and the path to the already-built CJS bundle.
|
|
200
|
+
* @returns A single {@link BinOutput} of kind `native` for the current platform, or `[]` if skipped.
|
|
201
|
+
*
|
|
202
|
+
* @example Producing the SEA binary for the current runner
|
|
203
|
+
* ```typescript
|
|
204
|
+
* const outputs = await buildNativeBin({
|
|
205
|
+
* bin: { name: 'hf-build', format: 'cjs', sea: { platforms: ['linux-x64'] } },
|
|
206
|
+
* ctx: context,
|
|
207
|
+
* cjsOutputPath: '/abs/dist/libs/builder/bin/hf-build.js',
|
|
208
|
+
* })
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
const buildNativeBin = async (inputs) => {
|
|
212
|
+
const { bin, ctx, cjsOutputPath } = inputs;
|
|
213
|
+
requireCjsFormat(bin);
|
|
214
|
+
const platforms = requireSeaConfig(bin);
|
|
215
|
+
const target = currentPlatformTarget();
|
|
216
|
+
if (!currentPlatformMatches(platforms)) {
|
|
217
|
+
log$2.info(`skipping native build for ${bin.name}: current platform ${target} not in declared targets [${platforms.join(', ')}]`);
|
|
218
|
+
return [];
|
|
219
|
+
}
|
|
220
|
+
const binDir = index_cjs_js$4.join(ctx.outputPath, 'bin');
|
|
221
|
+
index_cjs_js$4.ensureDir(binDir);
|
|
222
|
+
const seaConfigPath = index_cjs_js$4.join(binDir, `${bin.name}.sea-config.json`);
|
|
223
|
+
const blobPath = index_cjs_js$4.join(binDir, `${bin.name}.sea-prep.blob`);
|
|
224
|
+
const outputBinary = resolveOutputBinaryPath(binDir, bin.name, target);
|
|
225
|
+
log$2.info(`building native bin: ${bin.name} (${target})`);
|
|
226
|
+
memorySnapshot(`${bin.name}: pre-sea-config`);
|
|
227
|
+
const seaConfig = generateSeaConfig({ mainPath: cjsOutputPath, outputPath: blobPath });
|
|
228
|
+
index_cjs_js$4.writeJsonFile(seaConfigPath, seaConfig);
|
|
229
|
+
memorySnapshot(`${bin.name}: pre-sea-blob`);
|
|
230
|
+
const blobStart = index_cjs_js$7.dateNow();
|
|
231
|
+
generateSeaBlob({ seaConfigPath, outputBlobPath: blobPath });
|
|
232
|
+
log$2.debug(`${bin.name}: sea blob generated in ${index_cjs_js$7.dateNow() - blobStart}ms`);
|
|
233
|
+
const hostBinary = resolveHostBinary({ platform: target });
|
|
234
|
+
memorySnapshot(`${bin.name}: pre-inject (host=${hostBinary})`);
|
|
235
|
+
const invocation = resolveDefaultInjectWorkerPath(ctx.workspaceRoot);
|
|
236
|
+
if (!invocation) {
|
|
237
|
+
throw index_cjs_js$6.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.');
|
|
238
|
+
}
|
|
239
|
+
try {
|
|
240
|
+
const report = await dispatchInjectWorker({
|
|
241
|
+
hostBinary,
|
|
242
|
+
outputBinary,
|
|
243
|
+
blobPath,
|
|
244
|
+
resourceName: NODE_SEA_RESOURCE_NAME,
|
|
245
|
+
machoSegmentName: NODE_SEA_MACHO_SEGMENT,
|
|
246
|
+
sentinelFuse: NODE_SEA_FUSE,
|
|
247
|
+
reportPath: '',
|
|
248
|
+
}, { workerPath: invocation.path, execArgv: invocation.execArgv, label: bin.name });
|
|
249
|
+
log$2.debug(`${bin.name}: inject completed in ${report.durationMs}ms (worker end heap=${report.endHeapMB.toFixed(1)}MB rss=${report.endRssMB.toFixed(1)}MB)`);
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
log$2.error(`${bin.name}: postject inject failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
253
|
+
throw error;
|
|
254
|
+
}
|
|
255
|
+
memorySnapshot(`${bin.name}: post-inject`);
|
|
256
|
+
removeCodesign({ binary: outputBinary });
|
|
257
|
+
cleanupSeaIntermediates(seaConfigPath, blobPath);
|
|
258
|
+
memorySnapshot(`${bin.name}: native build complete`);
|
|
259
|
+
return [{ name: bin.name, kind: 'native', outputPath: outputBinary, platform: target }];
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const SHEBANG = '#!/usr/bin/env node';
|
|
263
|
+
const BIN_FILE_MODE = 0o755;
|
|
264
|
+
const resolveBinOutputFile = (binDir, name, format, formats) => {
|
|
265
|
+
if (format === 'esm')
|
|
266
|
+
return index_cjs_js$8.join(binDir, `${name}.mjs`);
|
|
267
|
+
return formats.length === 1 ? index_cjs_js$8.join(binDir, `${name}.js`) : index_cjs_js$8.join(binDir, `${name}.cjs.js`);
|
|
268
|
+
};
|
|
269
|
+
const resolveBinFooter = (bin, format) => bin.bootstrap ?? defaultBootstrap({ runner: bin.runner ?? 'default', format });
|
|
270
|
+
/**
|
|
271
|
+
* Builds the worker descriptor for a single bin output (one (bin, format) pair).
|
|
272
|
+
*
|
|
273
|
+
* Bins are self-contained executable scripts: workspace deps are inlined and the
|
|
274
|
+
* worker writes to `<outputPath>/bin/<name>.<ext>` with the shebang banner, the
|
|
275
|
+
* resolved bootstrap footer, and `chmod 0o755` applied.
|
|
276
|
+
*
|
|
277
|
+
* Output naming convention:
|
|
278
|
+
* - ESM: `<name>.mjs`
|
|
279
|
+
* - CJS only: `<name>.js`
|
|
280
|
+
* - CJS alongside ESM: `<name>.cjs.js`
|
|
281
|
+
*
|
|
282
|
+
* @param bin - Bin declaration including name, runner, and per-bin bootstrap override.
|
|
283
|
+
* @param context - Resolved build context.
|
|
284
|
+
* @param format - Format being built (one of `bin.format`'s entries).
|
|
285
|
+
* @param formats - Full list of formats requested for this bin (drives the CJS filename).
|
|
286
|
+
* @param reportPath - Absolute path the worker will write its JSON report to.
|
|
287
|
+
* @returns Descriptor ready to be JSON-serialized for the worker.
|
|
288
|
+
*
|
|
289
|
+
* @example Producing the descriptor for an `hf-build` CJS bin alongside an ESM twin
|
|
290
|
+
* ```typescript
|
|
291
|
+
* const descriptor = toBinBuildDescriptor(bin, context, 'cjs', ['cjs', 'esm'], '/tmp/r.json')
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
const toBinBuildDescriptor = (bin, context, format, formats, reportPath) => {
|
|
295
|
+
const inputFile = index_cjs_js$8.join(context.projectRoot, 'src', 'bin', `${bin.name}.ts`);
|
|
296
|
+
const binDir = index_cjs_js$8.join(context.outputPath, 'bin');
|
|
297
|
+
const outputFile = resolveBinOutputFile(binDir, bin.name, format, formats);
|
|
298
|
+
const bundledDepsRoot = depsRootOf(context);
|
|
299
|
+
const workspaceRoutes = buildWorkspaceRoutes(context.workspaceBundledDeps);
|
|
300
|
+
const useExternalizePlugin = context.bundledDeps.length > 0 || workspaceRoutes.length > 0;
|
|
301
|
+
return {
|
|
302
|
+
format,
|
|
303
|
+
inputFile,
|
|
304
|
+
outputDir: index_cjs_js$8.getDirname(outputFile),
|
|
305
|
+
external: [],
|
|
306
|
+
sourcemap: false,
|
|
307
|
+
bundledDepsPlugin: useExternalizePlugin ? { deps: context.bundledDeps, depsRoot: bundledDepsRoot } : null,
|
|
308
|
+
workspaceRoutes,
|
|
309
|
+
tsConfigPath: context.tsConfigPath,
|
|
310
|
+
projectRoot: context.projectRoot,
|
|
311
|
+
workspaceRoot: context.workspaceRoot,
|
|
312
|
+
bundleWorkspaceDeps: true,
|
|
313
|
+
bundle: null,
|
|
314
|
+
bin: {
|
|
315
|
+
outputFile,
|
|
316
|
+
banner: SHEBANG,
|
|
317
|
+
footer: resolveBinFooter(bin, format),
|
|
318
|
+
exports: 'named',
|
|
319
|
+
inlineDynamicImports: true,
|
|
320
|
+
chmod: BIN_FILE_MODE,
|
|
321
|
+
},
|
|
322
|
+
reportPath,
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const log$1 = index_cjs_js$3.logger.channel('builder:bundle:rollup:dispatch');
|
|
327
|
+
const REPORT_DIR_PREFIX = 'hf-builder-rollup-';
|
|
328
|
+
const SWC_NODE_REGISTER = '@swc-node/register';
|
|
329
|
+
const swcNodeAvailable = (workspaceRoot) => node_fs.existsSync(index_cjs_js$4.join(workspaceRoot, 'node_modules', '@swc-node', 'register', 'index.js'));
|
|
330
|
+
/**
|
|
331
|
+
* Default worker-path resolution: prefers the built-and-published artifact, falls
|
|
332
|
+
* back to the workspace dist path, and finally to the in-source TypeScript file
|
|
333
|
+
* via `@swc-node/register` (bootstrap case where builder is building itself for
|
|
334
|
+
* the first time and the dist worker doesn't exist yet).
|
|
335
|
+
*
|
|
336
|
+
* Looks at, in order:
|
|
337
|
+
* 1. `<workspaceRoot>/dist/libs/builder/bundle/rollup/worker/index.cjs.js`
|
|
338
|
+
* 2. `<workspaceRoot>/node_modules/@hyperfrontend/builder/bundle/rollup/worker/index.cjs.js`
|
|
339
|
+
* 3. `<workspaceRoot>/libs/builder/src/bundle/rollup/worker/index.ts` (with `--require \@swc-node/register`)
|
|
340
|
+
*
|
|
341
|
+
* @param workspaceRoot - Absolute workspace root.
|
|
342
|
+
* @returns Worker invocation descriptor, or `undefined` if no candidate exists.
|
|
343
|
+
*
|
|
344
|
+
* @example Locating the worker for an in-workspace consumer
|
|
345
|
+
* ```typescript
|
|
346
|
+
* const invocation = resolveDefaultRollupWorkerPath('/abs/repo')
|
|
347
|
+
* if (!invocation) throw new Error('builder rollup worker artifact not found')
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
const resolveDefaultRollupWorkerPath = (workspaceRoot) => {
|
|
351
|
+
const distCandidates = [
|
|
352
|
+
index_cjs_js$4.join(workspaceRoot, 'dist', 'libs', 'builder', 'bundle', 'rollup', 'worker', 'index.cjs.js'),
|
|
353
|
+
index_cjs_js$4.join(workspaceRoot, 'node_modules', '@hyperfrontend', 'builder', 'bundle', 'rollup', 'worker', 'index.cjs.js'),
|
|
354
|
+
];
|
|
355
|
+
for (const path of distCandidates) {
|
|
356
|
+
if (node_fs.existsSync(path))
|
|
357
|
+
return { path, execArgv: [] };
|
|
358
|
+
}
|
|
359
|
+
const sourcePath = index_cjs_js$4.join(workspaceRoot, 'libs', 'builder', 'src', 'bundle', 'rollup', 'worker', 'index.ts');
|
|
360
|
+
if (node_fs.existsSync(sourcePath) && swcNodeAvailable(workspaceRoot)) {
|
|
361
|
+
return { path: sourcePath, execArgv: ['--require', SWC_NODE_REGISTER] };
|
|
362
|
+
}
|
|
363
|
+
return undefined;
|
|
364
|
+
};
|
|
365
|
+
const createReportDir = () => node_fs.mkdtempSync(index_cjs_js$4.join(node_os.tmpdir(), REPORT_DIR_PREFIX));
|
|
366
|
+
const reportPathFor = (reportDir, descriptor) => {
|
|
367
|
+
const safeLabel = descriptor.inputFile.replace(/[^a-zA-Z0-9_-]+/g, '_');
|
|
368
|
+
return index_cjs_js$4.join(reportDir, `${descriptor.format}-${safeLabel}.json`);
|
|
369
|
+
};
|
|
370
|
+
const runOne = (descriptor, options, label) => index_cjs_js.createPromise((resolve, reject) => {
|
|
371
|
+
const execPath = options.execPath ?? process.execPath;
|
|
372
|
+
const argv = [...(options.execArgv ?? []), options.workerPath, index_cjs_js$5.stringify(descriptor)];
|
|
373
|
+
const child = node_child_process.spawn(execPath, argv, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
374
|
+
let capturedStderr = '';
|
|
375
|
+
child.stdout?.on('data', (chunk) => {
|
|
376
|
+
process.stdout.write(chunk);
|
|
377
|
+
});
|
|
378
|
+
child.stderr?.on('data', (chunk) => {
|
|
379
|
+
const text = typeof chunk === 'string' ? chunk : chunk.toString();
|
|
380
|
+
capturedStderr += text;
|
|
381
|
+
process.stderr.write(text);
|
|
382
|
+
});
|
|
383
|
+
child.on('error', (error) => {
|
|
384
|
+
reject(index_cjs_js$6.createError(`rollup worker for ${label} failed to spawn: ${error.message}`));
|
|
385
|
+
});
|
|
386
|
+
child.on('exit', (code) => {
|
|
387
|
+
if (code !== 0) {
|
|
388
|
+
const tail = capturedStderr.trim().split('\n').slice(-10).join('\n');
|
|
389
|
+
reject(index_cjs_js$6.createError(`rollup worker for ${label} exited with code ${code}\n${tail}`));
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
resolve();
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
const readReport = (reportPath, label) => {
|
|
396
|
+
if (!node_fs.existsSync(reportPath)) {
|
|
397
|
+
throw index_cjs_js$6.createError(`rollup worker for ${label} did not write a report at ${reportPath}`);
|
|
398
|
+
}
|
|
399
|
+
const data = index_cjs_js$5.parse(node_fs.readFileSync(reportPath, 'utf8'));
|
|
400
|
+
return data;
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Forks a single rollup worker for the supplied descriptor and waits for it
|
|
404
|
+
* to exit. The caller-provided descriptor's `reportPath` is overwritten with
|
|
405
|
+
* a temp-dir path created by this function.
|
|
406
|
+
*
|
|
407
|
+
* Each worker writes a JSON report at the temp path; this function reads it
|
|
408
|
+
* after the child exits and returns the per-job statistics. If the worker
|
|
409
|
+
* exits non-zero or fails to produce a report, the function throws with a
|
|
410
|
+
* label-rich message.
|
|
411
|
+
*
|
|
412
|
+
* The temp report directory is cleaned up before returning, regardless of
|
|
413
|
+
* success or failure.
|
|
414
|
+
*
|
|
415
|
+
* @param descriptor - Build descriptor to dispatch.
|
|
416
|
+
* @param options - Worker path + optional memory monitor.
|
|
417
|
+
* @returns Worker report (output size + memory + duration) for the dispatched job.
|
|
418
|
+
*
|
|
419
|
+
* @example Dispatching a single ESM build
|
|
420
|
+
* ```typescript
|
|
421
|
+
* const report = await dispatchRollupWorker(descriptor, { workerPath: '/abs/dist/.../worker.cjs.js' })
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
const dispatchRollupWorker = async (descriptor, options) => {
|
|
425
|
+
const reportDir = createReportDir();
|
|
426
|
+
const label = options.label ?? `${descriptor.format}:${descriptor.inputFile}`;
|
|
427
|
+
const reportPath = reportPathFor(reportDir, descriptor);
|
|
428
|
+
const job = { ...descriptor, reportPath };
|
|
429
|
+
try {
|
|
430
|
+
options.monitor?.check(`bundle:rollup:dispatch:${label}:start`);
|
|
431
|
+
log$1.info(`rollup dispatch: ${label}`);
|
|
432
|
+
await runOne(job, options, label);
|
|
433
|
+
const report = readReport(reportPath, label);
|
|
434
|
+
log$1.debug(`rollup dispatch done: ${label} size=${report.outputSize}B heap=${report.endHeapMB.toFixed(1)}MB rss=${report.endRssMB.toFixed(1)}MB t=${report.durationMs}ms`);
|
|
435
|
+
options.monitor?.check(`bundle:rollup:dispatch:${label}:end`);
|
|
436
|
+
return report;
|
|
437
|
+
}
|
|
438
|
+
finally {
|
|
439
|
+
node_fs.rmSync(reportDir, { recursive: true, force: true });
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
const log = index_cjs_js$3.logger.channel('builder:bin:script');
|
|
444
|
+
const resolveWorkerOrThrow = (workspaceRoot) => {
|
|
445
|
+
const invocation = resolveDefaultRollupWorkerPath(workspaceRoot);
|
|
446
|
+
if (!invocation) {
|
|
447
|
+
throw index_cjs_js$6.createError('rollup worker could not be resolved for bin script bundling. Build @hyperfrontend/builder at least once before invoking the bin phase, or ensure @swc-node/register is installed for source-mode bootstrap.');
|
|
448
|
+
}
|
|
449
|
+
return invocation;
|
|
450
|
+
};
|
|
451
|
+
/**
|
|
452
|
+
* Builds the JS outputs for a single bin declaration.
|
|
453
|
+
*
|
|
454
|
+
* For each declared format (CJS / ESM), forks a rollup worker that bundles
|
|
455
|
+
* `src/bin/<name>.ts`, prepends the `#!/usr/bin/env node` shebang, appends the
|
|
456
|
+
* resolved bootstrap footer (per-bin override or `defaultBootstrap`), writes
|
|
457
|
+
* the output to `<outputPath>/bin/<name>.<ext>`, and chmods it to `0o755` so
|
|
458
|
+
* the npm bin symlink is invokable. The worker isolates the heavy bin bundle
|
|
459
|
+
* (rollup + plugins + transitive deps loaded into the child) from the parent
|
|
460
|
+
* process.
|
|
461
|
+
*
|
|
462
|
+
* Output naming follows the convention:
|
|
463
|
+
* - ESM: `<name>.mjs`
|
|
464
|
+
* - CJS only: `<name>.js`
|
|
465
|
+
* - CJS alongside ESM: `<name>.cjs.js`
|
|
466
|
+
*
|
|
467
|
+
* Workspace dependencies are always inlined into bin bundles — bins are intended
|
|
468
|
+
* to ship as self-contained executable scripts.
|
|
469
|
+
*
|
|
470
|
+
* @param bin - Bin declaration including name, format(s), optional runner override, and bootstrap override.
|
|
471
|
+
* @param ctx - Resolved build context.
|
|
472
|
+
* @returns One `BinOutput` per emitted JS artifact.
|
|
473
|
+
*
|
|
474
|
+
* @example Building a CJS-only bin
|
|
475
|
+
* ```typescript
|
|
476
|
+
* const outputs = await buildJsBin({ name: 'cz', format: 'cjs', runner: 'runCz' }, context)
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* @example Building dual CJS + ESM outputs
|
|
480
|
+
* ```typescript
|
|
481
|
+
* const outputs = await buildJsBin({ name: 'hf-build', format: ['cjs', 'esm'] }, context)
|
|
482
|
+
* ```
|
|
483
|
+
*/
|
|
484
|
+
const buildJsBin = async (bin, ctx) => {
|
|
485
|
+
const formats = normalizeFormats(bin.format);
|
|
486
|
+
const binDir = index_cjs_js$4.join(ctx.outputPath, 'bin');
|
|
487
|
+
index_cjs_js$4.ensureDir(binDir);
|
|
488
|
+
const worker = resolveWorkerOrThrow(ctx.workspaceRoot);
|
|
489
|
+
const outputs = [];
|
|
490
|
+
for (const format of formats) {
|
|
491
|
+
const descriptor = toBinBuildDescriptor(bin, ctx, format, formats, '');
|
|
492
|
+
log.info(`building ${format} bin: ${bin.name}`);
|
|
493
|
+
await dispatchRollupWorker(descriptor, {
|
|
494
|
+
workerPath: worker.path,
|
|
495
|
+
execArgv: worker.execArgv,
|
|
496
|
+
label: `bin:${bin.name}:${format}`,
|
|
497
|
+
});
|
|
498
|
+
outputs.push({ name: bin.name, kind: format, outputPath: descriptor.bin?.outputFile });
|
|
499
|
+
}
|
|
500
|
+
return outputs;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
const findCjsOutputPath = (jsOutputs) => {
|
|
504
|
+
for (const output of jsOutputs)
|
|
505
|
+
if (output.kind === 'cjs')
|
|
506
|
+
return output.outputPath;
|
|
507
|
+
return undefined;
|
|
508
|
+
};
|
|
509
|
+
/**
|
|
510
|
+
* Runs the bin phase: builds every declared JS bin, then emits a Node SEA native
|
|
511
|
+
* binary for any bin that opts in via `bin.sea`. Returns the flattened list of
|
|
512
|
+
* every output produced.
|
|
513
|
+
*
|
|
514
|
+
* A bin that declares a `sea` block must also produce a CJS output (`format: 'cjs'`
|
|
515
|
+
* or include `'cjs'` in the list); the CJS artifact becomes the SEA `main` script,
|
|
516
|
+
* and a bin without one throws. Native emission is skipped silently with an info
|
|
517
|
+
* log when the current host doesn't match any declared platform — CI orchestrates
|
|
518
|
+
* the matrix so each declared platform is built on the matching runner.
|
|
519
|
+
*
|
|
520
|
+
* @param ctx - Resolved build context.
|
|
521
|
+
* @param bins - Bin declarations to synthesize. Pass an empty array (or omit
|
|
522
|
+
* `config.bin` from the facade) to skip the phase entirely.
|
|
523
|
+
* @returns Flattened list of all bin outputs produced during the phase.
|
|
524
|
+
*
|
|
525
|
+
* @example Running the bin phase from a custom orchestrator
|
|
526
|
+
* ```typescript
|
|
527
|
+
* const binOutputs = await runBinPhase(context, config.bin ?? [])
|
|
528
|
+
* ```
|
|
529
|
+
*/
|
|
530
|
+
const runBinPhase = async (ctx, bins) => {
|
|
531
|
+
const outputs = [];
|
|
532
|
+
for (const bin of bins) {
|
|
533
|
+
const jsOutputs = await buildJsBin(bin, ctx);
|
|
534
|
+
outputs.push(...jsOutputs);
|
|
535
|
+
if (!bin.sea)
|
|
536
|
+
continue;
|
|
537
|
+
const cjsOutputPath = findCjsOutputPath(jsOutputs);
|
|
538
|
+
if (!cjsOutputPath) {
|
|
539
|
+
throw index_cjs_js$6.createError(`SEA requires a CJS bin output; declare format: ['cjs'] or format: 'cjs' on bin ${bin.name}`);
|
|
540
|
+
}
|
|
541
|
+
await recover();
|
|
542
|
+
const nativeOutputs = await buildNativeBin({ bin, ctx, cjsOutputPath });
|
|
543
|
+
outputs.push(...nativeOutputs);
|
|
544
|
+
}
|
|
545
|
+
return outputs;
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
exports.runBinPhase = runBinPhase;
|
package/bin/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BuildContext, BinConfig, BinOutput } from '../models';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Runs the bin phase: builds every declared JS bin, then emits a Node SEA native
|
|
5
|
+
* binary for any bin that opts in via `bin.sea`. Returns the flattened list of
|
|
6
|
+
* every output produced.
|
|
7
|
+
*
|
|
8
|
+
* A bin that declares a `sea` block must also produce a CJS output (`format: 'cjs'`
|
|
9
|
+
* or include `'cjs'` in the list); the CJS artifact becomes the SEA `main` script,
|
|
10
|
+
* and a bin without one throws. Native emission is skipped silently with an info
|
|
11
|
+
* log when the current host doesn't match any declared platform — CI orchestrates
|
|
12
|
+
* the matrix so each declared platform is built on the matching runner.
|
|
13
|
+
*
|
|
14
|
+
* @param ctx - Resolved build context.
|
|
15
|
+
* @param bins - Bin declarations to synthesize. Pass an empty array (or omit
|
|
16
|
+
* `config.bin` from the facade) to skip the phase entirely.
|
|
17
|
+
* @returns Flattened list of all bin outputs produced during the phase.
|
|
18
|
+
*
|
|
19
|
+
* @example Running the bin phase from a custom orchestrator
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const binOutputs = await runBinPhase(context, config.bin ?? [])
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare const runBinPhase: (ctx: BuildContext, bins: BinConfig[]) => Promise<BinOutput[]>;
|
|
25
|
+
|
|
26
|
+
export { runBinPhase };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../libs/builder/src/bin/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA"}
|