@opensip-cli/core 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/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/__tests__/config-resolution.test.d.ts +2 -0
- package/dist/__tests__/config-resolution.test.d.ts.map +1 -0
- package/dist/__tests__/config-resolution.test.js +94 -0
- package/dist/__tests__/config-resolution.test.js.map +1 -0
- package/dist/__tests__/public-api.test.d.ts +16 -0
- package/dist/__tests__/public-api.test.d.ts.map +1 -0
- package/dist/__tests__/public-api.test.js +209 -0
- package/dist/__tests__/public-api.test.js.map +1 -0
- package/dist/__tests__/signal-batch.test.d.ts +2 -0
- package/dist/__tests__/signal-batch.test.d.ts.map +1 -0
- package/dist/__tests__/signal-batch.test.js +39 -0
- package/dist/__tests__/signal-batch.test.js.map +1 -0
- package/dist/__tests__/signal-sink.test.d.ts +2 -0
- package/dist/__tests__/signal-sink.test.d.ts.map +1 -0
- package/dist/__tests__/signal-sink.test.js +25 -0
- package/dist/__tests__/signal-sink.test.js.map +1 -0
- package/dist/__tests__/strip-utils.test.d.ts +2 -0
- package/dist/__tests__/strip-utils.test.d.ts.map +1 -0
- package/dist/__tests__/strip-utils.test.js +397 -0
- package/dist/__tests__/strip-utils.test.js.map +1 -0
- package/dist/__tests__/text-tree.test.d.ts +2 -0
- package/dist/__tests__/text-tree.test.d.ts.map +1 -0
- package/dist/__tests__/text-tree.test.js +31 -0
- package/dist/__tests__/text-tree.test.js.map +1 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.d.ts +2 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.d.ts.map +1 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.js +69 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.js.map +1 -0
- package/dist/baseline/fingerprint-strategy.d.ts +70 -0
- package/dist/baseline/fingerprint-strategy.d.ts.map +1 -0
- package/dist/baseline/fingerprint-strategy.js +90 -0
- package/dist/baseline/fingerprint-strategy.js.map +1 -0
- package/dist/config-resolution.d.ts +27 -0
- package/dist/config-resolution.d.ts.map +1 -0
- package/dist/config-resolution.js +92 -0
- package/dist/config-resolution.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +165 -0
- package/dist/index.js.map +1 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.d.ts +2 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.d.ts.map +1 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.js +87 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.js.map +1 -0
- package/dist/languages/__tests__/non-code-formats.test.d.ts +2 -0
- package/dist/languages/__tests__/non-code-formats.test.d.ts.map +1 -0
- package/dist/languages/__tests__/non-code-formats.test.js +31 -0
- package/dist/languages/__tests__/non-code-formats.test.js.map +1 -0
- package/dist/languages/__tests__/parse-cache.test.d.ts +2 -0
- package/dist/languages/__tests__/parse-cache.test.d.ts.map +1 -0
- package/dist/languages/__tests__/parse-cache.test.js +228 -0
- package/dist/languages/__tests__/parse-cache.test.js.map +1 -0
- package/dist/languages/__tests__/registry.test.d.ts +2 -0
- package/dist/languages/__tests__/registry.test.d.ts.map +1 -0
- package/dist/languages/__tests__/registry.test.js +193 -0
- package/dist/languages/__tests__/registry.test.js.map +1 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.d.ts +2 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.d.ts.map +1 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.js +66 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.js.map +1 -0
- package/dist/languages/adapter.d.ts +66 -0
- package/dist/languages/adapter.d.ts.map +1 -0
- package/dist/languages/adapter.js +2 -0
- package/dist/languages/adapter.js.map +1 -0
- package/dist/languages/content-filter-dispatch.d.ts +36 -0
- package/dist/languages/content-filter-dispatch.d.ts.map +1 -0
- package/dist/languages/content-filter-dispatch.js +75 -0
- package/dist/languages/content-filter-dispatch.js.map +1 -0
- package/dist/languages/generic-types.d.ts +22 -0
- package/dist/languages/generic-types.d.ts.map +1 -0
- package/dist/languages/generic-types.js +3 -0
- package/dist/languages/generic-types.js.map +1 -0
- package/dist/languages/index.d.ts +12 -0
- package/dist/languages/index.d.ts.map +1 -0
- package/dist/languages/index.js +7 -0
- package/dist/languages/index.js.map +1 -0
- package/dist/languages/non-code-formats.d.ts +37 -0
- package/dist/languages/non-code-formats.d.ts.map +1 -0
- package/dist/languages/non-code-formats.js +45 -0
- package/dist/languages/non-code-formats.js.map +1 -0
- package/dist/languages/parse-cache-class.d.ts +69 -0
- package/dist/languages/parse-cache-class.d.ts.map +1 -0
- package/dist/languages/parse-cache-class.js +135 -0
- package/dist/languages/parse-cache-class.js.map +1 -0
- package/dist/languages/parse-cache.d.ts +54 -0
- package/dist/languages/parse-cache.d.ts.map +1 -0
- package/dist/languages/parse-cache.js +88 -0
- package/dist/languages/parse-cache.js.map +1 -0
- package/dist/languages/registry.d.ts +35 -0
- package/dist/languages/registry.d.ts.map +1 -0
- package/dist/languages/registry.js +123 -0
- package/dist/languages/registry.js.map +1 -0
- package/dist/languages/strip-scanners.d.ts +170 -0
- package/dist/languages/strip-scanners.d.ts.map +1 -0
- package/dist/languages/strip-scanners.js +233 -0
- package/dist/languages/strip-scanners.js.map +1 -0
- package/dist/languages/strip-utils.d.ts +66 -0
- package/dist/languages/strip-utils.d.ts.map +1 -0
- package/dist/languages/strip-utils.js +88 -0
- package/dist/languages/strip-utils.js.map +1 -0
- package/dist/languages/text-tree.d.ts +44 -0
- package/dist/languages/text-tree.d.ts.map +1 -0
- package/dist/languages/text-tree.js +34 -0
- package/dist/languages/text-tree.js.map +1 -0
- package/dist/languages/workspace-unit.d.ts +18 -0
- package/dist/languages/workspace-unit.d.ts.map +1 -0
- package/dist/languages/workspace-unit.js +2 -0
- package/dist/languages/workspace-unit.js.map +1 -0
- package/dist/lib/__tests__/config-version.test.d.ts +12 -0
- package/dist/lib/__tests__/config-version.test.d.ts.map +1 -0
- package/dist/lib/__tests__/config-version.test.js +92 -0
- package/dist/lib/__tests__/config-version.test.js.map +1 -0
- package/dist/lib/__tests__/diagnostics-bus.test.d.ts +7 -0
- package/dist/lib/__tests__/diagnostics-bus.test.d.ts.map +1 -0
- package/dist/lib/__tests__/diagnostics-bus.test.js +44 -0
- package/dist/lib/__tests__/diagnostics-bus.test.js.map +1 -0
- package/dist/lib/__tests__/env-registry.test.d.ts +7 -0
- package/dist/lib/__tests__/env-registry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/env-registry.test.js +82 -0
- package/dist/lib/__tests__/env-registry.test.js.map +1 -0
- package/dist/lib/__tests__/errors.test.d.ts +2 -0
- package/dist/lib/__tests__/errors.test.d.ts.map +1 -0
- package/dist/lib/__tests__/errors.test.js +218 -0
- package/dist/lib/__tests__/errors.test.js.map +1 -0
- package/dist/lib/__tests__/format.test.d.ts +2 -0
- package/dist/lib/__tests__/format.test.d.ts.map +1 -0
- package/dist/lib/__tests__/format.test.js +23 -0
- package/dist/lib/__tests__/format.test.js.map +1 -0
- package/dist/lib/__tests__/ids.test.d.ts +2 -0
- package/dist/lib/__tests__/ids.test.d.ts.map +1 -0
- package/dist/lib/__tests__/ids.test.js +80 -0
- package/dist/lib/__tests__/ids.test.js.map +1 -0
- package/dist/lib/__tests__/logger.test.d.ts +2 -0
- package/dist/lib/__tests__/logger.test.d.ts.map +1 -0
- package/dist/lib/__tests__/logger.test.js +284 -0
- package/dist/lib/__tests__/logger.test.js.map +1 -0
- package/dist/lib/__tests__/package-version.test.d.ts +2 -0
- package/dist/lib/__tests__/package-version.test.d.ts.map +1 -0
- package/dist/lib/__tests__/package-version.test.js +47 -0
- package/dist/lib/__tests__/package-version.test.js.map +1 -0
- package/dist/lib/__tests__/paths.test.d.ts +5 -0
- package/dist/lib/__tests__/paths.test.d.ts.map +1 -0
- package/dist/lib/__tests__/paths.test.js +59 -0
- package/dist/lib/__tests__/paths.test.js.map +1 -0
- package/dist/lib/__tests__/payload-version.test.d.ts +2 -0
- package/dist/lib/__tests__/payload-version.test.d.ts.map +1 -0
- package/dist/lib/__tests__/payload-version.test.js +35 -0
- package/dist/lib/__tests__/payload-version.test.js.map +1 -0
- package/dist/lib/__tests__/phantom-detect.test.d.ts +10 -0
- package/dist/lib/__tests__/phantom-detect.test.d.ts.map +1 -0
- package/dist/lib/__tests__/phantom-detect.test.js +84 -0
- package/dist/lib/__tests__/phantom-detect.test.js.map +1 -0
- package/dist/lib/__tests__/project-context.test.d.ts +10 -0
- package/dist/lib/__tests__/project-context.test.d.ts.map +1 -0
- package/dist/lib/__tests__/project-context.test.js +240 -0
- package/dist/lib/__tests__/project-context.test.js.map +1 -0
- package/dist/lib/__tests__/registry.test.d.ts +2 -0
- package/dist/lib/__tests__/registry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/registry.test.js +333 -0
- package/dist/lib/__tests__/registry.test.js.map +1 -0
- package/dist/lib/__tests__/retry.test.d.ts +2 -0
- package/dist/lib/__tests__/retry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/retry.test.js +71 -0
- package/dist/lib/__tests__/retry.test.js.map +1 -0
- package/dist/lib/__tests__/run-diagnostics.test.d.ts +9 -0
- package/dist/lib/__tests__/run-diagnostics.test.d.ts.map +1 -0
- package/dist/lib/__tests__/run-diagnostics.test.js +61 -0
- package/dist/lib/__tests__/run-diagnostics.test.js.map +1 -0
- package/dist/lib/__tests__/run-scope.test.d.ts +2 -0
- package/dist/lib/__tests__/run-scope.test.d.ts.map +1 -0
- package/dist/lib/__tests__/run-scope.test.js +202 -0
- package/dist/lib/__tests__/run-scope.test.js.map +1 -0
- package/dist/lib/__tests__/run-timer.test.d.ts +2 -0
- package/dist/lib/__tests__/run-timer.test.d.ts.map +1 -0
- package/dist/lib/__tests__/run-timer.test.js +152 -0
- package/dist/lib/__tests__/run-timer.test.js.map +1 -0
- package/dist/lib/__tests__/severity-policy.test.d.ts +6 -0
- package/dist/lib/__tests__/severity-policy.test.d.ts.map +1 -0
- package/dist/lib/__tests__/severity-policy.test.js +47 -0
- package/dist/lib/__tests__/severity-policy.test.js.map +1 -0
- package/dist/lib/__tests__/telemetry.test.d.ts +2 -0
- package/dist/lib/__tests__/telemetry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/telemetry.test.js +212 -0
- package/dist/lib/__tests__/telemetry.test.js.map +1 -0
- package/dist/lib/__tests__/verdict-policy.test.d.ts +7 -0
- package/dist/lib/__tests__/verdict-policy.test.d.ts.map +1 -0
- package/dist/lib/__tests__/verdict-policy.test.js +91 -0
- package/dist/lib/__tests__/verdict-policy.test.js.map +1 -0
- package/dist/lib/__tests__/yaml.test.d.ts +6 -0
- package/dist/lib/__tests__/yaml.test.d.ts.map +1 -0
- package/dist/lib/__tests__/yaml.test.js +79 -0
- package/dist/lib/__tests__/yaml.test.js.map +1 -0
- package/dist/lib/config-version.d.ts +49 -0
- package/dist/lib/config-version.d.ts.map +1 -0
- package/dist/lib/config-version.js +56 -0
- package/dist/lib/config-version.js.map +1 -0
- package/dist/lib/diagnostics-bus.d.ts +48 -0
- package/dist/lib/diagnostics-bus.d.ts.map +1 -0
- package/dist/lib/diagnostics-bus.js +74 -0
- package/dist/lib/diagnostics-bus.js.map +1 -0
- package/dist/lib/env-registry.d.ts +108 -0
- package/dist/lib/env-registry.d.ts.map +1 -0
- package/dist/lib/env-registry.js +92 -0
- package/dist/lib/env-registry.js.map +1 -0
- package/dist/lib/errors.d.ts +132 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +160 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/execution/__tests__/execution.test.d.ts +7 -0
- package/dist/lib/execution/__tests__/execution.test.d.ts.map +1 -0
- package/dist/lib/execution/__tests__/execution.test.js +254 -0
- package/dist/lib/execution/__tests__/execution.test.js.map +1 -0
- package/dist/lib/execution/index.d.ts +15 -0
- package/dist/lib/execution/index.d.ts.map +1 -0
- package/dist/lib/execution/index.js +10 -0
- package/dist/lib/execution/index.js.map +1 -0
- package/dist/lib/execution/options.d.ts +32 -0
- package/dist/lib/execution/options.d.ts.map +1 -0
- package/dist/lib/execution/options.js +15 -0
- package/dist/lib/execution/options.js.map +1 -0
- package/dist/lib/execution/pipeline.d.ts +36 -0
- package/dist/lib/execution/pipeline.d.ts.map +1 -0
- package/dist/lib/execution/pipeline.js +38 -0
- package/dist/lib/execution/pipeline.js.map +1 -0
- package/dist/lib/execution/retry.d.ts +38 -0
- package/dist/lib/execution/retry.d.ts.map +1 -0
- package/dist/lib/execution/retry.js +56 -0
- package/dist/lib/execution/retry.js.map +1 -0
- package/dist/lib/execution/run-with-timeout.d.ts +46 -0
- package/dist/lib/execution/run-with-timeout.d.ts.map +1 -0
- package/dist/lib/execution/run-with-timeout.js +86 -0
- package/dist/lib/execution/run-with-timeout.js.map +1 -0
- package/dist/lib/execution/schedule.d.ts +62 -0
- package/dist/lib/execution/schedule.d.ts.map +1 -0
- package/dist/lib/execution/schedule.js +130 -0
- package/dist/lib/execution/schedule.js.map +1 -0
- package/dist/lib/format.d.ts +17 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +26 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/ids.d.ts +13 -0
- package/dist/lib/ids.d.ts.map +1 -0
- package/dist/lib/ids.js +48 -0
- package/dist/lib/ids.js.map +1 -0
- package/dist/lib/logger.d.ts +166 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +283 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/package-version.d.ts +17 -0
- package/dist/lib/package-version.d.ts.map +1 -0
- package/dist/lib/package-version.js +52 -0
- package/dist/lib/package-version.js.map +1 -0
- package/dist/lib/paths.d.ts +139 -0
- package/dist/lib/paths.d.ts.map +1 -0
- package/dist/lib/paths.js +105 -0
- package/dist/lib/paths.js.map +1 -0
- package/dist/lib/payload-version.d.ts +15 -0
- package/dist/lib/payload-version.d.ts.map +1 -0
- package/dist/lib/payload-version.js +24 -0
- package/dist/lib/payload-version.js.map +1 -0
- package/dist/lib/phantom-detect.d.ts +21 -0
- package/dist/lib/phantom-detect.d.ts.map +1 -0
- package/dist/lib/phantom-detect.js +76 -0
- package/dist/lib/phantom-detect.js.map +1 -0
- package/dist/lib/project-context.d.ts +66 -0
- package/dist/lib/project-context.d.ts.map +1 -0
- package/dist/lib/project-context.js +112 -0
- package/dist/lib/project-context.js.map +1 -0
- package/dist/lib/recipe-id.d.ts +13 -0
- package/dist/lib/recipe-id.d.ts.map +1 -0
- package/dist/lib/recipe-id.js +15 -0
- package/dist/lib/recipe-id.js.map +1 -0
- package/dist/lib/registry.d.ts +98 -0
- package/dist/lib/registry.d.ts.map +1 -0
- package/dist/lib/registry.js +152 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/lib/retry.d.ts +26 -0
- package/dist/lib/retry.d.ts.map +1 -0
- package/dist/lib/retry.js +48 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/run-diagnostics.d.ts +64 -0
- package/dist/lib/run-diagnostics.d.ts.map +1 -0
- package/dist/lib/run-diagnostics.js +25 -0
- package/dist/lib/run-diagnostics.js.map +1 -0
- package/dist/lib/run-scope.d.ts +167 -0
- package/dist/lib/run-scope.d.ts.map +1 -0
- package/dist/lib/run-scope.js +176 -0
- package/dist/lib/run-scope.js.map +1 -0
- package/dist/lib/run-timer.d.ts +82 -0
- package/dist/lib/run-timer.d.ts.map +1 -0
- package/dist/lib/run-timer.js +79 -0
- package/dist/lib/run-timer.js.map +1 -0
- package/dist/lib/scope-types.d.ts +172 -0
- package/dist/lib/scope-types.d.ts.map +1 -0
- package/dist/lib/scope-types.js +27 -0
- package/dist/lib/scope-types.js.map +1 -0
- package/dist/lib/severity-policy.d.ts +38 -0
- package/dist/lib/severity-policy.d.ts.map +1 -0
- package/dist/lib/severity-policy.js +44 -0
- package/dist/lib/severity-policy.js.map +1 -0
- package/dist/lib/telemetry.d.ts +93 -0
- package/dist/lib/telemetry.d.ts.map +1 -0
- package/dist/lib/telemetry.js +144 -0
- package/dist/lib/telemetry.js.map +1 -0
- package/dist/lib/ui-context.d.ts +34 -0
- package/dist/lib/ui-context.d.ts.map +1 -0
- package/dist/lib/ui-context.js +16 -0
- package/dist/lib/ui-context.js.map +1 -0
- package/dist/lib/verdict-policy.d.ts +71 -0
- package/dist/lib/verdict-policy.d.ts.map +1 -0
- package/dist/lib/verdict-policy.js +82 -0
- package/dist/lib/verdict-policy.js.map +1 -0
- package/dist/lib/yaml.d.ts +74 -0
- package/dist/lib/yaml.d.ts.map +1 -0
- package/dist/lib/yaml.js +118 -0
- package/dist/lib/yaml.js.map +1 -0
- package/dist/plugins/__tests__/as-if-external.test.d.ts +18 -0
- package/dist/plugins/__tests__/as-if-external.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/as-if-external.test.js +159 -0
- package/dist/plugins/__tests__/as-if-external.test.js.map +1 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.d.ts +8 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.js +97 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-discovery.test.js +349 -0
- package/dist/plugins/__tests__/capability-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.js +172 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-loader.test.js +122 -0
- package/dist/plugins/__tests__/capability-loader.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-registry.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-registry.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-registry.test.js +185 -0
- package/dist/plugins/__tests__/capability-registry.test.js.map +1 -0
- package/dist/plugins/__tests__/discover.test.d.ts +2 -0
- package/dist/plugins/__tests__/discover.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/discover.test.js +311 -0
- package/dist/plugins/__tests__/discover.test.js.map +1 -0
- package/dist/plugins/__tests__/loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/loader.test.js +191 -0
- package/dist/plugins/__tests__/loader.test.js.map +1 -0
- package/dist/plugins/__tests__/manifest-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/manifest-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/manifest-discovery.test.js +132 -0
- package/dist/plugins/__tests__/manifest-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/manifest-loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/manifest-loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/manifest-loader.test.js +434 -0
- package/dist/plugins/__tests__/manifest-loader.test.js.map +1 -0
- package/dist/plugins/__tests__/marker-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/marker-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/marker-discovery.test.js +164 -0
- package/dist/plugins/__tests__/marker-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/node-modules-walk.test.d.ts +2 -0
- package/dist/plugins/__tests__/node-modules-walk.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/node-modules-walk.test.js +76 -0
- package/dist/plugins/__tests__/node-modules-walk.test.js.map +1 -0
- package/dist/plugins/__tests__/package-entry.test.d.ts +9 -0
- package/dist/plugins/__tests__/package-entry.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/package-entry.test.js +117 -0
- package/dist/plugins/__tests__/package-entry.test.js.map +1 -0
- package/dist/plugins/__tests__/recipe-loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/recipe-loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/recipe-loader.test.js +130 -0
- package/dist/plugins/__tests__/recipe-loader.test.js.map +1 -0
- package/dist/plugins/__tests__/scope-validation.test.d.ts +2 -0
- package/dist/plugins/__tests__/scope-validation.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/scope-validation.test.js +68 -0
- package/dist/plugins/__tests__/scope-validation.test.js.map +1 -0
- package/dist/plugins/__tests__/single-core-guard.test.d.ts +10 -0
- package/dist/plugins/__tests__/single-core-guard.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/single-core-guard.test.js +89 -0
- package/dist/plugins/__tests__/single-core-guard.test.js.map +1 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.js +215 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.js.map +1 -0
- package/dist/plugins/authored-tool-discovery.d.ts +45 -0
- package/dist/plugins/authored-tool-discovery.d.ts.map +1 -0
- package/dist/plugins/authored-tool-discovery.js +61 -0
- package/dist/plugins/authored-tool-discovery.js.map +1 -0
- package/dist/plugins/capability-discovery.d.ts +80 -0
- package/dist/plugins/capability-discovery.d.ts.map +1 -0
- package/dist/plugins/capability-discovery.js +278 -0
- package/dist/plugins/capability-discovery.js.map +1 -0
- package/dist/plugins/capability-loader.d.ts +50 -0
- package/dist/plugins/capability-loader.d.ts.map +1 -0
- package/dist/plugins/capability-loader.js +85 -0
- package/dist/plugins/capability-loader.js.map +1 -0
- package/dist/plugins/capability-registry.d.ts +169 -0
- package/dist/plugins/capability-registry.d.ts.map +1 -0
- package/dist/plugins/capability-registry.js +319 -0
- package/dist/plugins/capability-registry.js.map +1 -0
- package/dist/plugins/discover.d.ts +64 -0
- package/dist/plugins/discover.d.ts.map +1 -0
- package/dist/plugins/discover.js +303 -0
- package/dist/plugins/discover.js.map +1 -0
- package/dist/plugins/index.d.ts +37 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +40 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/json-guards.d.ts +11 -0
- package/dist/plugins/json-guards.d.ts.map +1 -0
- package/dist/plugins/json-guards.js +15 -0
- package/dist/plugins/json-guards.js.map +1 -0
- package/dist/plugins/loader.d.ts +67 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +137 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/manifest-discovery.d.ts +28 -0
- package/dist/plugins/manifest-discovery.d.ts.map +1 -0
- package/dist/plugins/manifest-discovery.js +103 -0
- package/dist/plugins/manifest-discovery.js.map +1 -0
- package/dist/plugins/manifest-loader.d.ts +120 -0
- package/dist/plugins/manifest-loader.d.ts.map +1 -0
- package/dist/plugins/manifest-loader.js +410 -0
- package/dist/plugins/manifest-loader.js.map +1 -0
- package/dist/plugins/marker-discovery.d.ts +115 -0
- package/dist/plugins/marker-discovery.d.ts.map +1 -0
- package/dist/plugins/marker-discovery.js +172 -0
- package/dist/plugins/marker-discovery.js.map +1 -0
- package/dist/plugins/node-modules-walk.d.ts +61 -0
- package/dist/plugins/node-modules-walk.d.ts.map +1 -0
- package/dist/plugins/node-modules-walk.js +99 -0
- package/dist/plugins/node-modules-walk.js.map +1 -0
- package/dist/plugins/package-entry.d.ts +38 -0
- package/dist/plugins/package-entry.d.ts.map +1 -0
- package/dist/plugins/package-entry.js +86 -0
- package/dist/plugins/package-entry.js.map +1 -0
- package/dist/plugins/recipe-loader.d.ts +63 -0
- package/dist/plugins/recipe-loader.d.ts.map +1 -0
- package/dist/plugins/recipe-loader.js +67 -0
- package/dist/plugins/recipe-loader.js.map +1 -0
- package/dist/plugins/scope-validation.d.ts +35 -0
- package/dist/plugins/scope-validation.d.ts.map +1 -0
- package/dist/plugins/scope-validation.js +55 -0
- package/dist/plugins/scope-validation.js.map +1 -0
- package/dist/plugins/single-core-guard.d.ts +28 -0
- package/dist/plugins/single-core-guard.d.ts.map +1 -0
- package/dist/plugins/single-core-guard.js +69 -0
- package/dist/plugins/single-core-guard.js.map +1 -0
- package/dist/plugins/tool-package-discovery.d.ts +93 -0
- package/dist/plugins/tool-package-discovery.d.ts.map +1 -0
- package/dist/plugins/tool-package-discovery.js +118 -0
- package/dist/plugins/tool-package-discovery.js.map +1 -0
- package/dist/plugins/types.d.ts +78 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +15 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/recipes/__tests__/registry.test.d.ts +2 -0
- package/dist/recipes/__tests__/registry.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/registry.test.js +170 -0
- package/dist/recipes/__tests__/registry.test.js.map +1 -0
- package/dist/recipes/__tests__/selector.test.d.ts +20 -0
- package/dist/recipes/__tests__/selector.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/selector.test.js +173 -0
- package/dist/recipes/__tests__/selector.test.js.map +1 -0
- package/dist/recipes/__tests__/unit-config.test.d.ts +7 -0
- package/dist/recipes/__tests__/unit-config.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/unit-config.test.js +52 -0
- package/dist/recipes/__tests__/unit-config.test.js.map +1 -0
- package/dist/recipes/registry.d.ts +105 -0
- package/dist/recipes/registry.d.ts.map +1 -0
- package/dist/recipes/registry.js +141 -0
- package/dist/recipes/registry.js.map +1 -0
- package/dist/recipes/selector.d.ts +112 -0
- package/dist/recipes/selector.d.ts.map +1 -0
- package/dist/recipes/selector.js +134 -0
- package/dist/recipes/selector.js.map +1 -0
- package/dist/recipes/unit-config.d.ts +63 -0
- package/dist/recipes/unit-config.d.ts.map +1 -0
- package/dist/recipes/unit-config.js +68 -0
- package/dist/recipes/unit-config.js.map +1 -0
- package/dist/runtime/__tests__/in-process-transport.test.d.ts +6 -0
- package/dist/runtime/__tests__/in-process-transport.test.d.ts.map +1 -0
- package/dist/runtime/__tests__/in-process-transport.test.js +73 -0
- package/dist/runtime/__tests__/in-process-transport.test.js.map +1 -0
- package/dist/runtime/__tests__/subprocess-transport.test.d.ts +11 -0
- package/dist/runtime/__tests__/subprocess-transport.test.d.ts.map +1 -0
- package/dist/runtime/__tests__/subprocess-transport.test.js +118 -0
- package/dist/runtime/__tests__/subprocess-transport.test.js.map +1 -0
- package/dist/runtime/in-process-transport.d.ts +20 -0
- package/dist/runtime/in-process-transport.d.ts.map +1 -0
- package/dist/runtime/in-process-transport.js +49 -0
- package/dist/runtime/in-process-transport.js.map +1 -0
- package/dist/runtime/progress-transport.d.ts +73 -0
- package/dist/runtime/progress-transport.d.ts.map +1 -0
- package/dist/runtime/progress-transport.js +17 -0
- package/dist/runtime/progress-transport.js.map +1 -0
- package/dist/runtime/subprocess-transport.d.ts +43 -0
- package/dist/runtime/subprocess-transport.d.ts.map +1 -0
- package/dist/runtime/subprocess-transport.js +134 -0
- package/dist/runtime/subprocess-transport.js.map +1 -0
- package/dist/signals/comment-openers.d.ts +29 -0
- package/dist/signals/comment-openers.d.ts.map +1 -0
- package/dist/signals/comment-openers.js +41 -0
- package/dist/signals/comment-openers.js.map +1 -0
- package/dist/signals/comment-openers.test.d.ts +7 -0
- package/dist/signals/comment-openers.test.d.ts.map +1 -0
- package/dist/signals/comment-openers.test.js +41 -0
- package/dist/signals/comment-openers.test.js.map +1 -0
- package/dist/signals/create-signal-from-violation.d.ts +29 -0
- package/dist/signals/create-signal-from-violation.d.ts.map +1 -0
- package/dist/signals/create-signal-from-violation.js +29 -0
- package/dist/signals/create-signal-from-violation.js.map +1 -0
- package/dist/signals/signal-sink.d.ts +49 -0
- package/dist/signals/signal-sink.d.ts.map +1 -0
- package/dist/signals/signal-sink.js +6 -0
- package/dist/signals/signal-sink.js.map +1 -0
- package/dist/signals/suppress.d.ts +102 -0
- package/dist/signals/suppress.d.ts.map +1 -0
- package/dist/signals/suppress.js +325 -0
- package/dist/signals/suppress.js.map +1 -0
- package/dist/signals/suppress.test.d.ts +2 -0
- package/dist/signals/suppress.test.d.ts.map +1 -0
- package/dist/signals/suppress.test.js +213 -0
- package/dist/signals/suppress.test.js.map +1 -0
- package/dist/tools/__tests__/command-spec.test.d.ts +2 -0
- package/dist/tools/__tests__/command-spec.test.d.ts.map +1 -0
- package/dist/tools/__tests__/command-spec.test.js +191 -0
- package/dist/tools/__tests__/command-spec.test.js.map +1 -0
- package/dist/tools/__tests__/compatibility.test.d.ts +5 -0
- package/dist/tools/__tests__/compatibility.test.d.ts.map +1 -0
- package/dist/tools/__tests__/compatibility.test.js +41 -0
- package/dist/tools/__tests__/compatibility.test.js.map +1 -0
- package/dist/tools/__tests__/ids.test.d.ts +5 -0
- package/dist/tools/__tests__/ids.test.d.ts.map +1 -0
- package/dist/tools/__tests__/ids.test.js +56 -0
- package/dist/tools/__tests__/ids.test.js.map +1 -0
- package/dist/tools/__tests__/manifest-assert.test.d.ts +5 -0
- package/dist/tools/__tests__/manifest-assert.test.d.ts.map +1 -0
- package/dist/tools/__tests__/manifest-assert.test.js +66 -0
- package/dist/tools/__tests__/manifest-assert.test.js.map +1 -0
- package/dist/tools/__tests__/registry.test.d.ts +2 -0
- package/dist/tools/__tests__/registry.test.d.ts.map +1 -0
- package/dist/tools/__tests__/registry.test.js +93 -0
- package/dist/tools/__tests__/registry.test.js.map +1 -0
- package/dist/tools/__tests__/types.test.d.ts +2 -0
- package/dist/tools/__tests__/types.test.d.ts.map +1 -0
- package/dist/tools/__tests__/types.test.js +51 -0
- package/dist/tools/__tests__/types.test.js.map +1 -0
- package/dist/tools/capability.d.ts +257 -0
- package/dist/tools/capability.d.ts.map +1 -0
- package/dist/tools/capability.js +46 -0
- package/dist/tools/capability.js.map +1 -0
- package/dist/tools/command-spec.d.ts +211 -0
- package/dist/tools/command-spec.d.ts.map +1 -0
- package/dist/tools/command-spec.js +110 -0
- package/dist/tools/command-spec.js.map +1 -0
- package/dist/tools/compatibility.d.ts +45 -0
- package/dist/tools/compatibility.d.ts.map +1 -0
- package/dist/tools/compatibility.js +49 -0
- package/dist/tools/compatibility.js.map +1 -0
- package/dist/tools/ids.d.ts +61 -0
- package/dist/tools/ids.d.ts.map +1 -0
- package/dist/tools/ids.js +61 -0
- package/dist/tools/ids.js.map +1 -0
- package/dist/tools/index.d.ts +22 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +28 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/manifest-assert.d.ts +35 -0
- package/dist/tools/manifest-assert.d.ts.map +1 -0
- package/dist/tools/manifest-assert.js +67 -0
- package/dist/tools/manifest-assert.js.map +1 -0
- package/dist/tools/manifest.d.ts +178 -0
- package/dist/tools/manifest.d.ts.map +1 -0
- package/dist/tools/manifest.js +35 -0
- package/dist/tools/manifest.js.map +1 -0
- package/dist/tools/registry.d.ts +37 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +49 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +1021 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +77 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types/__tests__/signal.test.d.ts +2 -0
- package/dist/types/__tests__/signal.test.d.ts.map +1 -0
- package/dist/types/__tests__/signal.test.js +111 -0
- package/dist/types/__tests__/signal.test.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/signal-batch.d.ts +56 -0
- package/dist/types/signal-batch.d.ts.map +1 -0
- package/dist/types/signal-batch.js +54 -0
- package/dist/types/signal-batch.js.map +1 -0
- package/dist/types/signal.d.ts +77 -0
- package/dist/types/signal.d.ts.map +1 -0
- package/dist/types/signal.js +42 -0
- package/dist/types/signal.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Generic marker-based plugin discovery.
|
|
3
|
+
*
|
|
4
|
+
* Walks ancestor `node_modules/` directories from a project root, looking
|
|
5
|
+
* for packages whose `package.json` declares an `opensipTools.kind` value
|
|
6
|
+
* matching the requested kind. Returns the deduplicated list (first
|
|
7
|
+
* occurrence walking outward wins, matching Node's nearest-ancestor
|
|
8
|
+
* module resolution).
|
|
9
|
+
*
|
|
10
|
+
* `MarkerKind` is the closed union of HOST marker kinds — just `'tool'` now
|
|
11
|
+
* (whole-subcommand Tool plugins, a host concern). The former DOMAIN markers
|
|
12
|
+
* (`'fit-pack'`, `'sim-pack'`, `'graph-adapter'`) were RETIRED from this union
|
|
13
|
+
* once discovery became descriptor-driven (§5.3): a tool's manifest declares its
|
|
14
|
+
* own marker kind, the generic substrate discovers it via the string-typed
|
|
15
|
+
* {@link discoverPackagesByDeclaredKind}, and nothing in the host compiles in the
|
|
16
|
+
* domain vocabulary. Use {@link readDeclaredKind} for any kind that is not the
|
|
17
|
+
* host `'tool'` marker.
|
|
18
|
+
*
|
|
19
|
+
* Why a marker rather than a name pattern (for `'tool'`): a name-prefix rule
|
|
20
|
+
* breaks down once organisations publish their own scoped tool packages. The
|
|
21
|
+
* marker decouples publication scope from plugin shape.
|
|
22
|
+
*/
|
|
23
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
24
|
+
import { dirname, join } from 'node:path';
|
|
25
|
+
import { logger } from '../lib/logger.js';
|
|
26
|
+
import { safeReaddir } from './node-modules-walk.js';
|
|
27
|
+
/**
|
|
28
|
+
* The closed vocabulary of HOST `opensipTools.kind` markers — `'tool'` only.
|
|
29
|
+
* Domain markers (fit-pack/sim-pack/graph-adapter) are NOT here anymore: they are
|
|
30
|
+
* declared per-tool in manifests and discovered via {@link discoverPackagesByDeclaredKind}
|
|
31
|
+
* (§5.3). The workspace-invariant test validates a package.json marker against
|
|
32
|
+
* `'tool'` PLUS the marker kinds the bundled manifests declare — descriptor-driven,
|
|
33
|
+
* not a compiled-in domain list.
|
|
34
|
+
*/
|
|
35
|
+
export const MARKER_KINDS = ['tool'];
|
|
36
|
+
/**
|
|
37
|
+
* Narrow an unknown string to MarkerKind. Used by readMarkerKind below
|
|
38
|
+
* and re-exported for callers that need to validate dynamic input.
|
|
39
|
+
*/
|
|
40
|
+
export function isMarkerKind(value) {
|
|
41
|
+
return typeof value === 'string' && MARKER_KINDS.includes(value);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Walk up from `projectDir` looking for `node_modules/` directories.
|
|
45
|
+
* For each one, scan top-level entries (and one level into scoped
|
|
46
|
+
* directories like `@opensip-cli/`) for packages declaring
|
|
47
|
+
* `opensipTools.kind === options.kind`. Return the deduplicated list.
|
|
48
|
+
*
|
|
49
|
+
* Same-named packages are returned once — the first occurrence walking
|
|
50
|
+
* from `projectDir` outward wins, matching Node's nearest-ancestor
|
|
51
|
+
* resolution behavior.
|
|
52
|
+
*/
|
|
53
|
+
export function discoverPackagesByMarker(options) {
|
|
54
|
+
// Typed narrowing wrapper over the raw-string walker: the kind passed in is a
|
|
55
|
+
// MarkerKind, so every result's echoed kind is that same MarkerKind.
|
|
56
|
+
return discoverPackagesByDeclaredKind(options.projectDir, options.kind).map((p) => ({
|
|
57
|
+
name: p.name,
|
|
58
|
+
packageDir: p.packageDir,
|
|
59
|
+
kind: p.kind,
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Scan EXACTLY ONE `node_modules` directory for packages declaring
|
|
64
|
+
* `opensipTools.kind === kind` — no ancestor walk. Used for fixed plugin
|
|
65
|
+
* host dirs (`~/.opensip-cli/plugins/tool/node_modules`,
|
|
66
|
+
* `<project>/.runtime/plugins/tool/node_modules`) where walking up would
|
|
67
|
+
* wrongly pull in `$HOME/node_modules` or unrelated ancestor trees.
|
|
68
|
+
*/
|
|
69
|
+
export function discoverPackagesInNodeModules(nodeModulesDir, kind) {
|
|
70
|
+
const out = [];
|
|
71
|
+
if (existsSync(nodeModulesDir)) {
|
|
72
|
+
collectByDeclaredKind(nodeModulesDir, kind, new Set(), out);
|
|
73
|
+
}
|
|
74
|
+
return out.map((p) => ({ name: p.name, packageDir: p.packageDir, kind: p.kind }));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Walk ancestor `node_modules/` directories from `projectDir`, returning every
|
|
78
|
+
* package whose `package.json` declares `opensipTools.kind === kind` for the
|
|
79
|
+
* given raw-string kind. The string-typed generalization of
|
|
80
|
+
* {@link discoverPackagesByMarker}: the closed-union version is a thin wrapper
|
|
81
|
+
* over this. Deduplicated; first occurrence walking outward wins.
|
|
82
|
+
*/
|
|
83
|
+
export function discoverPackagesByDeclaredKind(projectDir, kind) {
|
|
84
|
+
const seen = new Set();
|
|
85
|
+
const out = [];
|
|
86
|
+
let dir = projectDir;
|
|
87
|
+
let prev = '';
|
|
88
|
+
while (dir !== prev) {
|
|
89
|
+
const nodeModules = join(dir, 'node_modules');
|
|
90
|
+
if (existsSync(nodeModules)) {
|
|
91
|
+
collectByDeclaredKind(nodeModules, kind, seen, out);
|
|
92
|
+
}
|
|
93
|
+
prev = dir;
|
|
94
|
+
dir = dirname(dir);
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- node_modules walker: handles both flat and @scope/* layouts and skips invalid entries inline
|
|
99
|
+
function collectByDeclaredKind(nodeModulesDir, kind, seen, out) {
|
|
100
|
+
for (const entry of safeReaddir(nodeModulesDir)) {
|
|
101
|
+
if (entry.startsWith('.'))
|
|
102
|
+
continue;
|
|
103
|
+
const entryPath = join(nodeModulesDir, entry);
|
|
104
|
+
if (entry.startsWith('@')) {
|
|
105
|
+
// Scoped — descend one level
|
|
106
|
+
for (const scopedEntry of safeReaddir(entryPath)) {
|
|
107
|
+
if (scopedEntry.startsWith('.'))
|
|
108
|
+
continue;
|
|
109
|
+
const name = `${entry}/${scopedEntry}`;
|
|
110
|
+
if (seen.has(name))
|
|
111
|
+
continue;
|
|
112
|
+
const pkgDir = join(entryPath, scopedEntry);
|
|
113
|
+
if (readDeclaredKind(pkgDir) === kind) {
|
|
114
|
+
seen.add(name);
|
|
115
|
+
out.push({ name, packageDir: pkgDir, kind });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (seen.has(entry))
|
|
121
|
+
continue;
|
|
122
|
+
if (readDeclaredKind(entryPath) === kind) {
|
|
123
|
+
seen.add(entry);
|
|
124
|
+
out.push({ name: entry, packageDir: entryPath, kind });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Read the declared `opensipTools.kind` from a package's package.json.
|
|
130
|
+
* Returns the kind if it parses, is a string, and matches the closed
|
|
131
|
+
* MarkerKind union; otherwise undefined. Parse failures are logged at
|
|
132
|
+
* debug — a malformed package.json under node_modules is not a discovery
|
|
133
|
+
* concern, just an entry to skip.
|
|
134
|
+
*
|
|
135
|
+
* Exported as the canonical host-tool marker reader. Domain markers such as
|
|
136
|
+
* fit-pack and graph-adapter are descriptor-driven and use the string-typed
|
|
137
|
+
* `readDeclaredKind` / `discoverPackagesByDeclaredKind` path.
|
|
138
|
+
*/
|
|
139
|
+
export function readMarkerKind(packageDir) {
|
|
140
|
+
const kind = readDeclaredKind(packageDir);
|
|
141
|
+
return isMarkerKind(kind) ? kind : undefined;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Read the RAW `opensipTools.kind` string from a package's package.json — the
|
|
145
|
+
* string-typed sibling of {@link readMarkerKind}, with no closed-union narrowing.
|
|
146
|
+
* Returns the string if it parses and is a string; otherwise undefined. Parse
|
|
147
|
+
* failures are logged at debug (a malformed node_modules package.json is an
|
|
148
|
+
* entry to skip, not a discovery error). The generic discovery substrate reads
|
|
149
|
+
* declared kinds through this one function so there is no second implementation
|
|
150
|
+
* to drift.
|
|
151
|
+
*/
|
|
152
|
+
export function readDeclaredKind(packageDir) {
|
|
153
|
+
const pkgJsonPath = join(packageDir, 'package.json');
|
|
154
|
+
if (!existsSync(pkgJsonPath))
|
|
155
|
+
return undefined;
|
|
156
|
+
try {
|
|
157
|
+
const pkg = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
|
|
158
|
+
const kind = pkg.opensipTools?.kind;
|
|
159
|
+
return typeof kind === 'string' ? kind : undefined;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
163
|
+
logger.debug({
|
|
164
|
+
evt: 'core.marker_discovery.read_failed',
|
|
165
|
+
module: 'core:plugins',
|
|
166
|
+
packageDir,
|
|
167
|
+
error: msg,
|
|
168
|
+
});
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=marker-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker-discovery.js","sourceRoot":"","sources":["../../src/plugins/marker-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,CAAU,CAAC;AAuB9C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,YAAkC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1F,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAA+B;IA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
2
|
+
* @fileoverview Shared node_modules ancestor-walk primitives for plugin
|
|
3
|
+
* auto-discovery.
|
|
4
|
+
*
|
|
5
|
+
* Scoped package discovery (`scenarios-*`, future packs) walks up the
|
|
6
|
+
* directory tree from a project root, scanning
|
|
7
|
+
* `node_modules/<scope>/` directories — mirroring Node's nearest-ancestor
|
|
8
|
+
* module resolution, which handles pnpm hoisting and monorepo layouts
|
|
9
|
+
* where the scope may live in the workspace root.
|
|
10
|
+
*
|
|
11
|
+
* The leaf filesystem probes (`safeReaddir`, `hasPackageJson`) and the
|
|
12
|
+
* explicit-name resolver (`resolvePackageDir`) are shared by marker
|
|
13
|
+
* discovery, exact package resolution, and simulation's scoped scenario-pack
|
|
14
|
+
* discovery. They live here now — one home for the generic walk plumbing the
|
|
15
|
+
* kernel already owns.
|
|
16
|
+
*
|
|
17
|
+
* These are pure `node:fs` / `node:path` primitives — no fitness/sim
|
|
18
|
+
* vocabulary leaks down into the kernel. The per-tool policy (explicit
|
|
19
|
+
* list vs opt-out vs auto-discover, the domain-specific not-resolved
|
|
20
|
+
* warning events) stays in each engine's outer discovery function.
|
|
21
|
+
*/
|
|
22
|
+
/** A package discovered (or resolved) inside node_modules. */
|
|
23
|
+
export interface DiscoveredScopedPackage {
|
|
24
|
+
/** npm package name, e.g. '@opensip-cli/checks-python'. */
|
|
25
|
+
readonly name: string;
|
|
26
|
+
/** Absolute path to the package's directory inside node_modules. */
|
|
27
|
+
readonly packageDir: string;
|
|
28
|
+
}
|
|
29
|
+
/** Inputs for {@link discoverScopedPackages}: the project root, the npm scopes to scan, and the package-name prefix to match. */
|
|
30
|
+
export interface DiscoverScopedPackagesOptions {
|
|
31
|
+
/** Absolute path to the project root. */
|
|
32
|
+
readonly projectDir: string;
|
|
33
|
+
/** Effective npm scopes to scan (already validated/deduped). */
|
|
34
|
+
readonly scopes: readonly string[];
|
|
35
|
+
/** Package-name prefix to match within each scope, e.g. `checks-`. */
|
|
36
|
+
readonly prefix: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Walk up the directory tree from `projectDir` looking for
|
|
40
|
+
* `node_modules/<scope>/` directories under every configured scope, and
|
|
41
|
+
* return all packages whose name (the entry under the scope dir) starts
|
|
42
|
+
* with `prefix` and contains a `package.json`. Deduplicated by full
|
|
43
|
+
* package name; the first occurrence walking from `projectDir` outward
|
|
44
|
+
* wins, matching Node's nearest-ancestor resolution.
|
|
45
|
+
*/
|
|
46
|
+
export declare function discoverScopedPackages(options: DiscoverScopedPackagesOptions): DiscoveredScopedPackage[];
|
|
47
|
+
/**
|
|
48
|
+
* Resolve an *explicit* package name to its on-disk directory by walking
|
|
49
|
+
* ancestor `node_modules` directories. Returns the first directory that
|
|
50
|
+
* contains a `package.json`, or undefined if the package is not installed.
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolvePackageDir(projectDir: string, name: string): string | undefined;
|
|
53
|
+
/** True when `packageDir` exists and contains a `package.json`. */
|
|
54
|
+
export declare function hasPackageJson(packageDir: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Read a directory's entries, returning `[]` on any failure. A filesystem
|
|
57
|
+
* probe: a missing directory or permission denial yields "no entries",
|
|
58
|
+
* indistinguishable from a genuinely empty directory.
|
|
59
|
+
*/
|
|
60
|
+
export declare function safeReaddir(dir: string): string[];
|
|
61
|
+
//# sourceMappingURL=node-modules-walk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-modules-walk.d.ts","sourceRoot":"","sources":["../../src/plugins/node-modules-walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,8DAA8D;AAC9D,MAAM,WAAW,uBAAuB;IACtC,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,iIAAiI;AACjI,MAAM,WAAW,6BAA6B;IAC5C,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AAEH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,6BAA6B,GACrC,uBAAuB,EAAE,CAwB3B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUtF;AAED,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAOjD"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared node_modules ancestor-walk primitives for plugin
|
|
3
|
+
* auto-discovery.
|
|
4
|
+
*
|
|
5
|
+
* Scoped package discovery (`scenarios-*`, future packs) walks up the
|
|
6
|
+
* directory tree from a project root, scanning
|
|
7
|
+
* `node_modules/<scope>/` directories — mirroring Node's nearest-ancestor
|
|
8
|
+
* module resolution, which handles pnpm hoisting and monorepo layouts
|
|
9
|
+
* where the scope may live in the workspace root.
|
|
10
|
+
*
|
|
11
|
+
* The leaf filesystem probes (`safeReaddir`, `hasPackageJson`) and the
|
|
12
|
+
* explicit-name resolver (`resolvePackageDir`) are shared by marker
|
|
13
|
+
* discovery, exact package resolution, and simulation's scoped scenario-pack
|
|
14
|
+
* discovery. They live here now — one home for the generic walk plumbing the
|
|
15
|
+
* kernel already owns.
|
|
16
|
+
*
|
|
17
|
+
* These are pure `node:fs` / `node:path` primitives — no fitness/sim
|
|
18
|
+
* vocabulary leaks down into the kernel. The per-tool policy (explicit
|
|
19
|
+
* list vs opt-out vs auto-discover, the domain-specific not-resolved
|
|
20
|
+
* warning events) stays in each engine's outer discovery function.
|
|
21
|
+
*/
|
|
22
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
23
|
+
import { dirname, join } from 'node:path';
|
|
24
|
+
/**
|
|
25
|
+
* Walk up the directory tree from `projectDir` looking for
|
|
26
|
+
* `node_modules/<scope>/` directories under every configured scope, and
|
|
27
|
+
* return all packages whose name (the entry under the scope dir) starts
|
|
28
|
+
* with `prefix` and contains a `package.json`. Deduplicated by full
|
|
29
|
+
* package name; the first occurrence walking from `projectDir` outward
|
|
30
|
+
* wins, matching Node's nearest-ancestor resolution.
|
|
31
|
+
*/
|
|
32
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- ancestor-walk discovery: walks node_modules trees up the directory tree until the filesystem root
|
|
33
|
+
export function discoverScopedPackages(options) {
|
|
34
|
+
const { projectDir, scopes, prefix } = options;
|
|
35
|
+
const seen = new Set();
|
|
36
|
+
const out = [];
|
|
37
|
+
let dir = projectDir;
|
|
38
|
+
let prev = '';
|
|
39
|
+
while (dir !== prev) {
|
|
40
|
+
for (const scope of scopes) {
|
|
41
|
+
const scopeDir = join(dir, 'node_modules', scope);
|
|
42
|
+
if (!existsSync(scopeDir))
|
|
43
|
+
continue;
|
|
44
|
+
for (const entry of safeReaddir(scopeDir)) {
|
|
45
|
+
if (!entry.startsWith(prefix))
|
|
46
|
+
continue;
|
|
47
|
+
const name = `${scope}/${entry}`;
|
|
48
|
+
if (seen.has(name))
|
|
49
|
+
continue;
|
|
50
|
+
const packageDir = join(scopeDir, entry);
|
|
51
|
+
if (!hasPackageJson(packageDir))
|
|
52
|
+
continue;
|
|
53
|
+
seen.add(name);
|
|
54
|
+
out.push({ name, packageDir });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
prev = dir;
|
|
58
|
+
dir = dirname(dir);
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resolve an *explicit* package name to its on-disk directory by walking
|
|
64
|
+
* ancestor `node_modules` directories. Returns the first directory that
|
|
65
|
+
* contains a `package.json`, or undefined if the package is not installed.
|
|
66
|
+
*/
|
|
67
|
+
export function resolvePackageDir(projectDir, name) {
|
|
68
|
+
let dir = projectDir;
|
|
69
|
+
let prev = '';
|
|
70
|
+
while (dir !== prev) {
|
|
71
|
+
const candidate = join(dir, 'node_modules', name);
|
|
72
|
+
if (hasPackageJson(candidate))
|
|
73
|
+
return candidate;
|
|
74
|
+
prev = dir;
|
|
75
|
+
dir = dirname(dir);
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
/** True when `packageDir` exists and contains a `package.json`. */
|
|
80
|
+
export function hasPackageJson(packageDir) {
|
|
81
|
+
if (!existsSync(packageDir))
|
|
82
|
+
return false;
|
|
83
|
+
return existsSync(join(packageDir, 'package.json'));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Read a directory's entries, returning `[]` on any failure. A filesystem
|
|
87
|
+
* probe: a missing directory or permission denial yields "no entries",
|
|
88
|
+
* indistinguishable from a genuinely empty directory.
|
|
89
|
+
*/
|
|
90
|
+
export function safeReaddir(dir) {
|
|
91
|
+
try {
|
|
92
|
+
return readdirSync(dir);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// @fitness-ignore-next-line error-handling-quality -- filesystem probe; exception → empty array is the function's contract (missing directory or permission denied returns "no entries", same as a genuinely empty dir).
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=node-modules-walk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-modules-walk.js","sourceRoot":"","sources":["../../src/plugins/node-modules-walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,OAA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ED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAkB,EAAE,IAAY;IAChE,IAAI,GAAG,GAAG,UAAU,CAAC;IACrB,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,OAAO,GAAG,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;QAClD,IAAI,cAAc,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;QAChD,IAAI,GAAG,GAAG,CAAC;QACX,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC/C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,OAAO,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,IAAI,CAAC;QACH,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,yNAAyN;QACzN,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Resolve a package's main entry point from its
|
|
3
|
+
* `package.json` — shared between plugin discovery (project-local
|
|
4
|
+
* `.runtime/plugins/<domain>/node_modules/`) and tool-package discovery
|
|
5
|
+
* (any installed `opensipTools.kind === 'tool'` package).
|
|
6
|
+
*
|
|
7
|
+
* The two discovery sites previously inlined the same exports-map walk,
|
|
8
|
+
* each with its own `eslint-disable-next-line sonarjs/cognitive-complexity`
|
|
9
|
+
* suppression. Extracting the resolver removes the duplication and keeps
|
|
10
|
+
* each caller small enough to satisfy the rule on its own.
|
|
11
|
+
*
|
|
12
|
+
* Resolution order matches Node's: `exports['.']` (string or condition
|
|
13
|
+
* object — `import` / `default` / `node` selected in that order) →
|
|
14
|
+
* `pkg.main` → `./index.js`. Returns the joined absolute path of the
|
|
15
|
+
* entry, plus the package name from `pkg.name`. Returns `undefined`
|
|
16
|
+
* when `package.json` is missing, malformed, or has no resolvable
|
|
17
|
+
* entry.
|
|
18
|
+
*/
|
|
19
|
+
/** The result of {@link resolvePackageEntryPoint}: a package's resolved entry point plus its name. */
|
|
20
|
+
export interface PackageEntryResolution {
|
|
21
|
+
/** Package name from `pkg.name`. Falls back to caller-supplied default if absent. */
|
|
22
|
+
readonly name: string;
|
|
23
|
+
/** Absolute path to the resolved entry point. */
|
|
24
|
+
readonly entry: string;
|
|
25
|
+
/** Raw entry path before joining (for callers that want the relative form). */
|
|
26
|
+
readonly rawEntry: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve a package's entry-point from its directory.
|
|
30
|
+
*
|
|
31
|
+
* @param packageDir Absolute path to the package directory.
|
|
32
|
+
* @param fallbackName Name to use if `pkg.name` is missing — typically
|
|
33
|
+
* the directory entry the caller iterated over.
|
|
34
|
+
* @returns The resolved entry plus name, or `undefined` if `package.json`
|
|
35
|
+
* is absent, malformed, or has no resolvable entry.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolvePackageEntryPoint(packageDir: string, fallbackName?: string): PackageEntryResolution | undefined;
|
|
38
|
+
//# sourceMappingURL=package-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-entry.d.ts","sourceRoot":"","sources":["../../src/plugins/package-entry.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;GAiBG;AAKH,sGAAsG;AACtG,MAAM,WAAW,sBAAsB;IACrC,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAQD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GACpB,sBAAsB,GAAG,SAAS,CAqBpC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// @fitness-ignore-file unbounded-memory -- reads npm package.json files; bounded by standard package metadata size
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Resolve a package's main entry point from its
|
|
4
|
+
* `package.json` — shared between plugin discovery (project-local
|
|
5
|
+
* `.runtime/plugins/<domain>/node_modules/`) and tool-package discovery
|
|
6
|
+
* (any installed `opensipTools.kind === 'tool'` package).
|
|
7
|
+
*
|
|
8
|
+
* The two discovery sites previously inlined the same exports-map walk,
|
|
9
|
+
* each with its own `eslint-disable-next-line sonarjs/cognitive-complexity`
|
|
10
|
+
* suppression. Extracting the resolver removes the duplication and keeps
|
|
11
|
+
* each caller small enough to satisfy the rule on its own.
|
|
12
|
+
*
|
|
13
|
+
* Resolution order matches Node's: `exports['.']` (string or condition
|
|
14
|
+
* object — `import` / `default` / `node` selected in that order) →
|
|
15
|
+
* `pkg.main` → `./index.js`. Returns the joined absolute path of the
|
|
16
|
+
* entry, plus the package name from `pkg.name`. Returns `undefined`
|
|
17
|
+
* when `package.json` is missing, malformed, or has no resolvable
|
|
18
|
+
* entry.
|
|
19
|
+
*/
|
|
20
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
21
|
+
import { join } from 'node:path';
|
|
22
|
+
/**
|
|
23
|
+
* Resolve a package's entry-point from its directory.
|
|
24
|
+
*
|
|
25
|
+
* @param packageDir Absolute path to the package directory.
|
|
26
|
+
* @param fallbackName Name to use if `pkg.name` is missing — typically
|
|
27
|
+
* the directory entry the caller iterated over.
|
|
28
|
+
* @returns The resolved entry plus name, or `undefined` if `package.json`
|
|
29
|
+
* is absent, malformed, or has no resolvable entry.
|
|
30
|
+
*/
|
|
31
|
+
export function resolvePackageEntryPoint(packageDir, fallbackName) {
|
|
32
|
+
const pkgJsonPath = join(packageDir, 'package.json');
|
|
33
|
+
if (!existsSync(pkgJsonPath))
|
|
34
|
+
return undefined;
|
|
35
|
+
let pkg;
|
|
36
|
+
try {
|
|
37
|
+
pkg = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// @fitness-ignore-next-line error-handling-quality -- malformed/unreadable package.json deliberately surfaces via undefined return; caller treats as "no resolvable entry" (documented in the function's JSDoc).
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
const name = pkg.name ?? fallbackName;
|
|
44
|
+
if (!name)
|
|
45
|
+
return undefined;
|
|
46
|
+
const rawEntry = resolveEntryFromExportsField(pkg.exports) ?? pkg.main ?? './index.js';
|
|
47
|
+
return {
|
|
48
|
+
name,
|
|
49
|
+
entry: join(packageDir, rawEntry),
|
|
50
|
+
rawEntry,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Walk the `exports` field of a parsed `package.json` and pick the
|
|
55
|
+
* main entry. Returns the raw (relative) entry string or `undefined`
|
|
56
|
+
* when no resolvable entry is present.
|
|
57
|
+
*
|
|
58
|
+
* Handles three shapes:
|
|
59
|
+
* - `"exports": "./dist/index.js"` (string)
|
|
60
|
+
* - `"exports": { ".": "./dist/index.js" }` (object, string `.`)
|
|
61
|
+
* - `"exports": { ".": { "import": "./..." } }` (object, condition `.`)
|
|
62
|
+
*/
|
|
63
|
+
function resolveEntryFromExportsField(exportsField) {
|
|
64
|
+
if (typeof exportsField === 'string')
|
|
65
|
+
return exportsField;
|
|
66
|
+
if (!exportsField || typeof exportsField !== 'object')
|
|
67
|
+
return undefined;
|
|
68
|
+
if (!('.' in exportsField))
|
|
69
|
+
return undefined;
|
|
70
|
+
const dot = exportsField['.'];
|
|
71
|
+
if (typeof dot === 'string')
|
|
72
|
+
return dot;
|
|
73
|
+
if (!dot || typeof dot !== 'object')
|
|
74
|
+
return undefined;
|
|
75
|
+
const conditions = dot;
|
|
76
|
+
// Order matches Node's "exports" condition resolution priority for
|
|
77
|
+
// ESM consumers: prefer 'import', then 'default', then 'node'.
|
|
78
|
+
if (typeof conditions.import === 'string')
|
|
79
|
+
return conditions.import;
|
|
80
|
+
if (typeof conditions.default === 'string')
|
|
81
|
+
return conditions.default;
|
|
82
|
+
if (typeof conditions.node === 'string')
|
|
83
|
+
return conditions.node;
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=package-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-entry.js","sourceRoot":"","sources":["../../src/plugins/package-entry.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAkBjC;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CACtC,UAAkB,EAClB,YAAqB;IAErB,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IACrD,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,SAAS,CAAC;IAE/C,IAAI,GAAqB,CAAC;IAC1B,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAqB,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,iNAAiN;QACjN,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,YAAY,CAAC;IACtC,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAE5B,MAAM,QAAQ,GAAG,4BAA4B,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,YAAY,CAAC;IACvF,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;QACjC,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,4BAA4B,CACnC,YAAyC;IAEzC,IAAI,OAAO,YAAY,KAAK,QAAQ;QAAE,OAAO,YAAY,CAAC;IAC1D,IAAI,CAAC,YAAY,IAAI,OAAO,YAAY,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACxE,IAAI,CAAC,CAAC,GAAG,IAAI,YAAY,CAAC;QAAE,OAAO,SAAS,CAAC;IAC7C,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC;IACxC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACtD,MAAM,UAAU,GAAG,GAA8B,CAAC;IAClD,mEAAmE;IACnE,+DAA+D;IAC/D,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC,MAAM,CAAC;IACpE,IAAI,OAAO,UAAU,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC,OAAO,CAAC;IACtE,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC,IAAI,CAAC;IAChE,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared recipe-registration helper for fitness + simulation
|
|
3
|
+
* plugin loaders. Single implementation of the "iterate mod.recipes,
|
|
4
|
+
* shape-check each, register, count" pattern that previously appeared in
|
|
5
|
+
* three near-identical sites (fitness/engine/src/plugins/loader.ts,
|
|
6
|
+
* fitness/engine/src/cli/fit.ts, simulation/engine/src/cli/sim.ts).
|
|
7
|
+
*
|
|
8
|
+
* The malformed-recipe warning preserves the careful pattern from
|
|
9
|
+
* loader.ts — recipes that fail the `id + name` shape check emit a
|
|
10
|
+
* `plugin.recipe.invalid_item` warning so the customer can see what
|
|
11
|
+
* was skipped.
|
|
12
|
+
*
|
|
13
|
+
* Duplicate handling: the underlying `RecipeRegistry.register` doesn't
|
|
14
|
+
* throw on duplicate when `allowOverwrite: false` (the default) — it
|
|
15
|
+
* logs a `recipe.registry.duplicate` warning and silently returns.
|
|
16
|
+
* This helper uses `registry.has()` to check first, so `recipesRegistered`
|
|
17
|
+
* counts only entries that genuinely landed in the registry. The
|
|
18
|
+
* optional `onDuplicate` callback lets the caller observe the rejection
|
|
19
|
+
* (no-op by default).
|
|
20
|
+
*
|
|
21
|
+
* No try/catch around `register` itself — if the registry throws for
|
|
22
|
+
* an unexpected reason (validation error, internal failure), the error
|
|
23
|
+
* propagates to the caller's outer try/catch in cli/fit.ts or cli/sim.ts,
|
|
24
|
+
* surfacing as a per-package load failure rather than being silently
|
|
25
|
+
* misattributed as a duplicate.
|
|
26
|
+
*/
|
|
27
|
+
import type { RecipeBase, RecipeRegistry } from '../recipes/registry.js';
|
|
28
|
+
/** Options for {@link registerRecipesFromMod}: the warning namespace, warn callback, and an optional duplicate observer. */
|
|
29
|
+
export interface RegisterRecipesOptions<R extends RecipeBase> {
|
|
30
|
+
/** Package name (or plugin namespace) used in warning messages. */
|
|
31
|
+
readonly namespace: string;
|
|
32
|
+
/**
|
|
33
|
+
* Warn callback. Adapts to loader.ts's `ctx.warn(evt, message, extra)`
|
|
34
|
+
* channel and the CLI sites' `logger.warn(...)` shape.
|
|
35
|
+
*/
|
|
36
|
+
readonly onWarn: (evt: string, message: string, extra?: Record<string, unknown>) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Invoked when a recipe is skipped because the registry already has
|
|
39
|
+
* one with the same id/name. Defaults to a no-op. Useful for tests
|
|
40
|
+
* and for callers that want a structured count of duplicates.
|
|
41
|
+
*/
|
|
42
|
+
readonly onDuplicate?: (recipe: R) => void;
|
|
43
|
+
}
|
|
44
|
+
/** Result of {@link registerRecipesFromMod}: how many recipes actually entered the registry. */
|
|
45
|
+
export interface RegisterRecipesResult {
|
|
46
|
+
/** Count of recipes that actually entered the registry. */
|
|
47
|
+
readonly recipesRegistered: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Iterate `mod.recipes` (if present), shape-check each item, and
|
|
51
|
+
* register valid entries into the registry. Returns the count of
|
|
52
|
+
* successful registrations.
|
|
53
|
+
*
|
|
54
|
+
* - `mod.recipes` undefined or not an array → returns `{ recipesRegistered: 0 }`.
|
|
55
|
+
* - Item fails the shape check (`'id' in recipe && 'name' in recipe`) →
|
|
56
|
+
* emits `plugin.recipe.invalid_item` via `onWarn` and skips.
|
|
57
|
+
* - Item is a duplicate of an existing entry (by id or name) → skipped
|
|
58
|
+
* without incrementing; `onDuplicate` invoked if provided. The
|
|
59
|
+
* registry's own warning surfaces the duplicate event.
|
|
60
|
+
* - Registry throws on `register` for any other reason → propagates.
|
|
61
|
+
*/
|
|
62
|
+
export declare function registerRecipesFromMod<R extends RecipeBase>(mod: unknown, registry: RecipeRegistry<R>, options: RegisterRecipesOptions<R>): RegisterRecipesResult;
|
|
63
|
+
//# sourceMappingURL=recipe-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe-loader.d.ts","sourceRoot":"","sources":["../../src/plugins/recipe-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEzE,4HAA4H;AAC5H,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,UAAU;IAC1D,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACzF;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;CAC5C;AAED,gGAAgG;AAChG,MAAM,WAAW,qBAAqB;IACpC,2DAA2D;IAC3D,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,UAAU,EACzD,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACjC,qBAAqB,CAwBvB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared recipe-registration helper for fitness + simulation
|
|
3
|
+
* plugin loaders. Single implementation of the "iterate mod.recipes,
|
|
4
|
+
* shape-check each, register, count" pattern that previously appeared in
|
|
5
|
+
* three near-identical sites (fitness/engine/src/plugins/loader.ts,
|
|
6
|
+
* fitness/engine/src/cli/fit.ts, simulation/engine/src/cli/sim.ts).
|
|
7
|
+
*
|
|
8
|
+
* The malformed-recipe warning preserves the careful pattern from
|
|
9
|
+
* loader.ts — recipes that fail the `id + name` shape check emit a
|
|
10
|
+
* `plugin.recipe.invalid_item` warning so the customer can see what
|
|
11
|
+
* was skipped.
|
|
12
|
+
*
|
|
13
|
+
* Duplicate handling: the underlying `RecipeRegistry.register` doesn't
|
|
14
|
+
* throw on duplicate when `allowOverwrite: false` (the default) — it
|
|
15
|
+
* logs a `recipe.registry.duplicate` warning and silently returns.
|
|
16
|
+
* This helper uses `registry.has()` to check first, so `recipesRegistered`
|
|
17
|
+
* counts only entries that genuinely landed in the registry. The
|
|
18
|
+
* optional `onDuplicate` callback lets the caller observe the rejection
|
|
19
|
+
* (no-op by default).
|
|
20
|
+
*
|
|
21
|
+
* No try/catch around `register` itself — if the registry throws for
|
|
22
|
+
* an unexpected reason (validation error, internal failure), the error
|
|
23
|
+
* propagates to the caller's outer try/catch in cli/fit.ts or cli/sim.ts,
|
|
24
|
+
* surfacing as a per-package load failure rather than being silently
|
|
25
|
+
* misattributed as a duplicate.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Iterate `mod.recipes` (if present), shape-check each item, and
|
|
29
|
+
* register valid entries into the registry. Returns the count of
|
|
30
|
+
* successful registrations.
|
|
31
|
+
*
|
|
32
|
+
* - `mod.recipes` undefined or not an array → returns `{ recipesRegistered: 0 }`.
|
|
33
|
+
* - Item fails the shape check (`'id' in recipe && 'name' in recipe`) →
|
|
34
|
+
* emits `plugin.recipe.invalid_item` via `onWarn` and skips.
|
|
35
|
+
* - Item is a duplicate of an existing entry (by id or name) → skipped
|
|
36
|
+
* without incrementing; `onDuplicate` invoked if provided. The
|
|
37
|
+
* registry's own warning surfaces the duplicate event.
|
|
38
|
+
* - Registry throws on `register` for any other reason → propagates.
|
|
39
|
+
*/
|
|
40
|
+
export function registerRecipesFromMod(mod, registry, options) {
|
|
41
|
+
const recipes = mod?.recipes;
|
|
42
|
+
if (!Array.isArray(recipes)) {
|
|
43
|
+
return { recipesRegistered: 0 };
|
|
44
|
+
}
|
|
45
|
+
let recipesRegistered = 0;
|
|
46
|
+
for (const [index, item] of recipes.entries()) {
|
|
47
|
+
if (!isShapedLikeRecipe(item)) {
|
|
48
|
+
options.onWarn('plugin.recipe.invalid_item', `${options.namespace} recipes[${index}] is not a valid Recipe object (missing id or name) — skipping.`, { index });
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const recipe = item;
|
|
52
|
+
if (registry.has(recipe.id) || registry.has(recipe.name)) {
|
|
53
|
+
options.onDuplicate?.(recipe);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
registry.register(recipe, { allowOverwrite: false });
|
|
57
|
+
recipesRegistered++;
|
|
58
|
+
}
|
|
59
|
+
return { recipesRegistered };
|
|
60
|
+
}
|
|
61
|
+
function isShapedLikeRecipe(value) {
|
|
62
|
+
if (value === null || typeof value !== 'object')
|
|
63
|
+
return false;
|
|
64
|
+
const obj = value;
|
|
65
|
+
return typeof obj.id === 'string' && typeof obj.name === 'string';
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=recipe-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe-loader.js","sourceRoot":"","sources":["../../src/plugins/recipe-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AA2BH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,sBAAsB,CACpC,GAAY,EACZ,QAA2B,EAC3B,OAAkC;IAElC,MAAM,OAAO,GAAI,GAAgD,EAAE,OAAO,CAAC;IAC3E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IAClC,CAAC;IACD,IAAI,iBAAiB,GAAG,CAAC,CAAC;IAC1B,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QAC9C,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,OAAO,CAAC,MAAM,CACZ,4BAA4B,EAC5B,GAAG,OAAO,CAAC,SAAS,YAAY,KAAK,iEAAiE,EACtG,EAAE,KAAK,EAAE,CACV,CAAC;YACF,SAAS;QACX,CAAC;QACD,MAAM,MAAM,GAAG,IAAS,CAAC;QACzB,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,MA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