packtory 0.0.95 → 0.0.97
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/artifacts/artifacts-builder.d.ts +28 -0
- package/artifacts/artifacts-builder.d.ts.map +1 -0
- package/artifacts/artifacts-builder.js +37 -4
- package/artifacts/artifacts-builder.js.map +1 -1
- package/artifacts/content-collection.js +59 -2
- package/artifacts/content-collection.js.map +1 -1
- package/artifacts/folder-writer.js +25 -2
- package/artifacts/folder-writer.js.map +1 -1
- package/bundle-emitter/emitter.d.ts +8 -0
- package/bundle-emitter/emitter.d.ts.map +1 -1
- package/bundle-emitter/emitter.js +137 -6
- package/bundle-emitter/emitter.js.map +1 -1
- package/bundle-emitter/extract-package-tarball.js +13 -2
- package/bundle-emitter/extract-package-tarball.js.map +1 -1
- package/bundle-emitter/fetch-published-artifacts.d.ts +2 -0
- package/bundle-emitter/fetch-published-artifacts.d.ts.map +1 -1
- package/bundle-emitter/fetch-published-artifacts.js +19 -2
- package/bundle-emitter/fetch-published-artifacts.js.map +1 -1
- package/bundle-emitter/publication-outcome.d.ts +3 -0
- package/bundle-emitter/publication-outcome.d.ts.map +1 -1
- package/bundle-emitter/publication-outcome.js +5 -0
- package/bundle-emitter/publication-outcome.js.map +1 -1
- package/bundle-emitter/publish-error/auto-mode-error-matching.js +28 -2
- package/bundle-emitter/publish-error/auto-mode-error-matching.js.map +1 -1
- package/bundle-emitter/publish-error/error-shape-helpers.js +9 -0
- package/bundle-emitter/publish-error/error-shape-helpers.js.map +1 -1
- package/bundle-emitter/publish-error/file-mode-error-matching.js +33 -2
- package/bundle-emitter/publish-error/file-mode-error-matching.js.map +1 -1
- package/bundle-emitter/publish-error/publish-error-messages.js +24 -0
- package/bundle-emitter/publish-error/publish-error-messages.js.map +1 -1
- package/bundle-emitter/registry/metadata-auth-retry.js +24 -1
- package/bundle-emitter/registry/metadata-auth-retry.js.map +1 -1
- package/bundle-emitter/registry/oidc-token-exchange.js +68 -3
- package/bundle-emitter/registry/oidc-token-exchange.js.map +1 -1
- package/bundle-emitter/registry/package-metadata-fetcher.d.ts +14 -0
- package/bundle-emitter/registry/package-metadata-fetcher.d.ts.map +1 -1
- package/bundle-emitter/registry/package-metadata-fetcher.js +210 -7
- package/bundle-emitter/registry/package-metadata-fetcher.js.map +1 -1
- package/bundle-emitter/registry/publish-settings-bridge.js +34 -3
- package/bundle-emitter/registry/publish-settings-bridge.js.map +1 -1
- package/bundle-emitter/registry/registry-auth-config.d.ts +17 -0
- package/bundle-emitter/registry/registry-auth-config.d.ts.map +1 -0
- package/bundle-emitter/registry/registry-auth-config.js +106 -0
- package/bundle-emitter/registry/registry-auth-config.js.map +1 -1
- package/bundle-emitter/registry/registry-client.d.ts +13 -1
- package/bundle-emitter/registry/registry-client.d.ts.map +1 -1
- package/bundle-emitter/registry/registry-client.js +74 -4
- package/bundle-emitter/registry/registry-client.js.map +1 -1
- package/bundle-emitter/registry/registry-package-path.js +3 -0
- package/bundle-emitter/registry/registry-package-path.js.map +1 -1
- package/bundle-emitter/registry/registry-response-schemas.js +50 -2
- package/bundle-emitter/registry/registry-response-schemas.js.map +1 -1
- package/bundle-emitter/registry/tarball-integrity.d.ts +1 -0
- package/bundle-emitter/registry/tarball-integrity.d.ts.map +1 -1
- package/bundle-emitter/registry/tarball-integrity.js +31 -1
- package/bundle-emitter/registry/tarball-integrity.js.map +1 -1
- package/bundle-emitter/registry/validate-tarball-host.js +26 -1
- package/bundle-emitter/registry/validate-tarball-host.js.map +1 -1
- package/bundle-emitter/release-artifact-canonicalizer.js +31 -5
- package/bundle-emitter/release-artifact-canonicalizer.js.map +1 -1
- package/checks/check-runner.d.ts +18 -0
- package/checks/check-runner.d.ts.map +1 -0
- package/checks/check-runner.js +8 -0
- package/checks/check-runner.js.map +1 -1
- package/checks/rule.d.ts +42 -0
- package/checks/rule.d.ts.map +1 -0
- package/checks/rule.js +12 -2
- package/checks/rule.js.map +1 -1
- package/checks/rules/duplicate-detection.js +23 -1
- package/checks/rules/duplicate-detection.js.map +1 -1
- package/checks/rules/duplicate-messages.js +22 -0
- package/checks/rules/duplicate-messages.js.map +1 -1
- package/checks/rules/file-ownership.js +15 -0
- package/checks/rules/file-ownership.js.map +1 -1
- package/checks/rules/max-bundle-size.d.ts +13 -0
- package/checks/rules/max-bundle-size.d.ts.map +1 -0
- package/checks/rules/max-bundle-size.js +55 -1
- package/checks/rules/max-bundle-size.js.map +1 -1
- package/checks/rules/no-dev-dependency-imports.d.ts +11 -0
- package/checks/rules/no-dev-dependency-imports.d.ts.map +1 -0
- package/checks/rules/no-dev-dependency-imports.js +51 -1
- package/checks/rules/no-dev-dependency-imports.js.map +1 -1
- package/checks/rules/no-duplicated-files.d.ts +11 -0
- package/checks/rules/no-duplicated-files.d.ts.map +1 -0
- package/checks/rules/no-duplicated-files.js +53 -3
- package/checks/rules/no-duplicated-files.js.map +1 -1
- package/checks/rules/no-side-effects.d.ts +15 -0
- package/checks/rules/no-side-effects.d.ts.map +1 -0
- package/checks/rules/no-side-effects.js +50 -1
- package/checks/rules/no-side-effects.js.map +1 -1
- package/checks/rules/no-unexposed-executables.d.ts +8 -0
- package/checks/rules/no-unexposed-executables.d.ts.map +1 -0
- package/checks/rules/no-unexposed-executables.js +43 -2
- package/checks/rules/no-unexposed-executables.js.map +1 -1
- package/checks/rules/no-unused-bundle-dependencies.d.ts +8 -0
- package/checks/rules/no-unused-bundle-dependencies.d.ts.map +1 -0
- package/checks/rules/no-unused-bundle-dependencies.js +30 -2
- package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
- package/checks/rules/registry.d.ts +23 -0
- package/checks/rules/registry.d.ts.map +1 -0
- package/checks/rules/registry.js +22 -9
- package/checks/rules/registry.js.map +1 -1
- package/checks/rules/required-files.d.ts +15 -0
- package/checks/rules/required-files.d.ts.map +1 -0
- package/checks/rules/required-files.js +41 -3
- package/checks/rules/required-files.js.map +1 -1
- package/checks/rules/type-script-declaration-integrity.d.ts +9 -0
- package/checks/rules/type-script-declaration-integrity.d.ts.map +1 -0
- package/checks/rules/type-script-declaration-integrity.js +81 -3
- package/checks/rules/type-script-declaration-integrity.js.map +1 -1
- package/checks/rules/type-script-declaration-paths.js +55 -1
- package/checks/rules/type-script-declaration-paths.js.map +1 -1
- package/checks/rules/type-script-declaration-project.d.ts +29 -0
- package/checks/rules/type-script-declaration-project.d.ts.map +1 -0
- package/checks/rules/type-script-declaration-project.js +202 -3
- package/checks/rules/type-script-declaration-project.js.map +1 -1
- package/checks/rules/type-script-declaration-reachability.js +38 -2
- package/checks/rules/type-script-declaration-reachability.js.map +1 -1
- package/checks/rules/type-script-declaration-roots.js +29 -0
- package/checks/rules/type-script-declaration-roots.js.map +1 -1
- package/checks/rules/type-script-integrity.d.ts +24 -0
- package/checks/rules/type-script-integrity.d.ts.map +1 -0
- package/checks/rules/type-script-integrity.js +72 -2
- package/checks/rules/type-script-integrity.js.map +1 -1
- package/checks/rules/type-script-package-resolution.d.ts +29 -0
- package/checks/rules/type-script-package-resolution.d.ts.map +1 -0
- package/checks/rules/type-script-package-resolution.js +42 -1
- package/checks/rules/type-script-package-resolution.js.map +1 -1
- package/checks/rules/type-script-resolution-summary.js +53 -0
- package/checks/rules/type-script-resolution-summary.js.map +1 -1
- package/checks/rules/unique-target-paths.d.ts +8 -0
- package/checks/rules/unique-target-paths.d.ts.map +1 -0
- package/checks/rules/unique-target-paths.js +34 -2
- package/checks/rules/unique-target-paths.js.map +1 -1
- package/common/bundled-dependency-groups.js +27 -0
- package/common/bundled-dependency-groups.js.map +1 -1
- package/common/code-files.js +28 -0
- package/common/code-files.js.map +1 -1
- package/common/declaration-companion-paths.js +24 -0
- package/common/declaration-companion-paths.js.map +1 -1
- package/common/package-name-map.js +7 -0
- package/common/package-name-map.js.map +1 -1
- package/common/stable-json.js +42 -2
- package/common/stable-json.js.map +1 -1
- package/common/worklist.js +22 -0
- package/common/worklist.js.map +1 -1
- package/config/additional-files.d.ts +1 -1
- package/config/additional-files.js +6 -2
- package/config/additional-files.js.map +1 -1
- package/config/additional-package-json-attributes-schema.js +6 -2
- package/config/additional-package-json-attributes-schema.js.map +1 -1
- package/config/automatic-versioning-settings.js +6 -2
- package/config/automatic-versioning-settings.js.map +1 -1
- package/config/changelog-settings.d.ts +44 -0
- package/config/changelog-settings.d.ts.map +1 -1
- package/config/changelog-settings.js +120 -3
- package/config/changelog-settings.js.map +1 -1
- package/config/common-package-settings-schemas.js +19 -3
- package/config/common-package-settings-schemas.js.map +1 -1
- package/config/config.d.ts +6 -1
- package/config/config.d.ts.map +1 -1
- package/config/config.js +3 -1
- package/config/config.js.map +1 -1
- package/config/cross-package-validation.js +17 -0
- package/config/cross-package-validation.js.map +1 -1
- package/config/dead-code-elimination-settings.d.ts +1 -0
- package/config/dead-code-elimination-settings.d.ts.map +1 -1
- package/config/dead-code-elimination-settings.js +36 -2
- package/config/dead-code-elimination-settings.js.map +1 -1
- package/config/dependency-existence-validation.js +19 -1
- package/config/dependency-existence-validation.js.map +1 -1
- package/config/dependency-policy.js +5 -2
- package/config/dependency-policy.js.map +1 -1
- package/config/main-package-json-schema.js +13 -2
- package/config/main-package-json-schema.js.map +1 -1
- package/config/manual-versioning-settings.d.ts +12 -0
- package/config/manual-versioning-settings.d.ts.map +1 -1
- package/config/manual-versioning-settings.js +29 -2
- package/config/manual-versioning-settings.js.map +1 -1
- package/config/optional-package-settings-schema.js +16 -7
- package/config/optional-package-settings-schema.js.map +1 -1
- package/config/package-config.d.ts +4 -0
- package/config/package-config.d.ts.map +1 -1
- package/config/package-config.js +2 -1
- package/config/package-config.js.map +1 -1
- package/config/package-graph-builder.js +14 -2
- package/config/package-graph-builder.js.map +1 -1
- package/config/package-interface.js +25 -2
- package/config/package-interface.js.map +1 -1
- package/config/package-json.d.ts +2 -0
- package/config/package-json.d.ts.map +1 -1
- package/config/package-json.js +16 -0
- package/config/package-json.js.map +1 -1
- package/config/packtory-config-schema.d.ts +12 -12
- package/config/packtory-config-without-registry-schema.js +6 -0
- package/config/packtory-config-without-registry-schema.js.map +1 -1
- package/config/per-package-settings-schema.js +22 -6
- package/config/per-package-settings-schema.js.map +1 -1
- package/config/pre-graph-validation.js +20 -5
- package/config/pre-graph-validation.js.map +1 -1
- package/config/publish-settings.d.ts +3 -0
- package/config/publish-settings.d.ts.map +1 -1
- package/config/publish-settings.js +25 -3
- package/config/publish-settings.js.map +1 -1
- package/config/publish-settings.report.js +17 -1
- package/config/publish-settings.report.js.map +1 -1
- package/config/registry-settings.d.ts +41 -0
- package/config/registry-settings.d.ts.map +1 -1
- package/config/registry-settings.js +40 -2
- package/config/registry-settings.js.map +1 -1
- package/config/registry-settings.report.js +46 -0
- package/config/registry-settings.report.js.map +1 -1
- package/config/root-config-validation.js +141 -0
- package/config/root-config-validation.js.map +1 -1
- package/config/root.js +6 -2
- package/config/root.js.map +1 -1
- package/config/sbom-settings.js +4 -1
- package/config/sbom-settings.js.map +1 -1
- package/config/settings-validation.js +28 -0
- package/config/settings-validation.js.map +1 -1
- package/config/validation.d.ts.map +1 -1
- package/config/validation.js +35 -1
- package/config/validation.js.map +1 -1
- package/config/versioning-settings.d.ts +18 -1
- package/config/versioning-settings.d.ts.map +1 -1
- package/config/versioning-settings.js +10 -3
- package/config/versioning-settings.js.map +1 -1
- package/dead-code-eliminator/analyzed-bundle.d.ts +11 -0
- package/dead-code-eliminator/analyzed-bundle.d.ts.map +1 -1
- package/dead-code-eliminator/analyzed-bundle.js +7 -0
- package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
- package/dead-code-eliminator/bundle-analysis.js +38 -5
- package/dead-code-eliminator/bundle-analysis.js.map +1 -1
- package/dead-code-eliminator/class-purity.js +48 -2
- package/dead-code-eliminator/class-purity.js.map +1 -1
- package/dead-code-eliminator/code-file-analyzer.js +68 -4
- package/dead-code-eliminator/code-file-analyzer.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/bundle-index.js +10 -1
- package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +22 -3
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/import-export-walker.js +164 -4
- package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/seed-store.js +10 -0
- package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -1
- package/dead-code-eliminator/dependency-metadata.js +172 -3
- package/dead-code-eliminator/dependency-metadata.js.map +1 -1
- package/dead-code-eliminator/elimination-emitter.js +52 -0
- package/dead-code-eliminator/elimination-emitter.js.map +1 -1
- package/dead-code-eliminator/eliminator.js +22 -4
- package/dead-code-eliminator/eliminator.js.map +1 -1
- package/dead-code-eliminator/expression-unwrapping.js +16 -1
- package/dead-code-eliminator/expression-unwrapping.js.map +1 -1
- package/dead-code-eliminator/imported-expression-origin.js +101 -2
- package/dead-code-eliminator/imported-expression-origin.js.map +1 -1
- package/dead-code-eliminator/liveness/asset-side-effects.js +9 -1
- package/dead-code-eliminator/liveness/asset-side-effects.js.map +1 -1
- package/dead-code-eliminator/liveness/boolean-facts.js +98 -2
- package/dead-code-eliminator/liveness/boolean-facts.js.map +1 -1
- package/dead-code-eliminator/liveness/external-module-resolution.js +172 -2
- package/dead-code-eliminator/liveness/external-module-resolution.js.map +1 -1
- package/dead-code-eliminator/liveness/external-purity-summary.js +294 -3
- package/dead-code-eliminator/liveness/external-purity-summary.js.map +1 -1
- package/dead-code-eliminator/liveness/external-purity.js +39 -3
- package/dead-code-eliminator/liveness/external-purity.js.map +1 -1
- package/dead-code-eliminator/liveness/module-analysis.js +27 -2
- package/dead-code-eliminator/liveness/module-analysis.js.map +1 -1
- package/dead-code-eliminator/liveness/resource-retention.js +91 -1
- package/dead-code-eliminator/liveness/resource-retention.js.map +1 -1
- package/dead-code-eliminator/liveness/runtime-code.js +15 -1
- package/dead-code-eliminator/liveness/runtime-code.js.map +1 -1
- package/dead-code-eliminator/load-bundle.js +86 -5
- package/dead-code-eliminator/load-bundle.js.map +1 -1
- package/dead-code-eliminator/pure-expression.js +178 -5
- package/dead-code-eliminator/pure-expression.js.map +1 -1
- package/dead-code-eliminator/reachability/bfs-closure.js +53 -0
- package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -1
- package/dead-code-eliminator/reachability/binding-extractor.js +100 -2
- package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
- package/dead-code-eliminator/reachability/binding-id.js +106 -1
- package/dead-code-eliminator/reachability/binding-id.js.map +1 -1
- package/dead-code-eliminator/reachability/identifier-target-collector.js +96 -2
- package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -1
- package/dead-code-eliminator/reachability/impure-statements.js +11 -2
- package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
- package/dead-code-eliminator/reachability/local-seed-gathering.js +91 -4
- package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -1
- package/dead-code-eliminator/reachability/reachability.js +65 -4
- package/dead-code-eliminator/reachability/reachability.js.map +1 -1
- package/dead-code-eliminator/side-effect-classifier.js +39 -4
- package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
- package/dead-code-eliminator/side-effects-field.js +23 -1
- package/dead-code-eliminator/side-effects-field.js.map +1 -1
- package/dead-code-eliminator/source-map-recomposition.js +29 -2
- package/dead-code-eliminator/source-map-recomposition.js.map +1 -1
- package/dead-code-eliminator/statement-classifiers.js +94 -4
- package/dead-code-eliminator/statement-classifiers.js.map +1 -1
- package/dead-code-eliminator/syntax-kind-sets.js +16 -0
- package/dead-code-eliminator/syntax-kind-sets.js.map +1 -1
- package/dead-code-eliminator/transform/atom-translator.d.ts +8 -0
- package/dead-code-eliminator/transform/atom-translator.d.ts.map +1 -1
- package/dead-code-eliminator/transform/atom-translator.js +57 -2
- package/dead-code-eliminator/transform/atom-translator.js.map +1 -1
- package/dead-code-eliminator/transform/declaration-removal.js +183 -5
- package/dead-code-eliminator/transform/declaration-removal.js.map +1 -1
- package/dead-code-eliminator/transform/declaration-remover.js +17 -2
- package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
- package/dead-code-eliminator/transform/line-index.d.ts +7 -0
- package/dead-code-eliminator/transform/line-index.d.ts.map +1 -1
- package/dead-code-eliminator/transform/line-index.js +20 -0
- package/dead-code-eliminator/transform/line-index.js.map +1 -1
- package/dead-code-eliminator/transform/named-declaration-kinds.js +3 -0
- package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -1
- package/dead-code-eliminator/transform/source-map-composer.js +84 -3
- package/dead-code-eliminator/transform/source-map-composer.js.map +1 -1
- package/dead-code-eliminator/variable-declaration-bindings.js +25 -1
- package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -1
- package/dependency-scanner/dependency-graph.d.ts +41 -0
- package/dependency-scanner/dependency-graph.d.ts.map +1 -0
- package/dependency-scanner/dependency-graph.js +77 -3
- package/dependency-scanner/dependency-graph.js.map +1 -1
- package/dependency-scanner/external-dependencies.d.ts +10 -1
- package/dependency-scanner/external-dependencies.d.ts.map +1 -1
- package/dependency-scanner/external-dependencies.js +55 -1
- package/dependency-scanner/external-dependencies.js.map +1 -1
- package/dependency-scanner/file-host-predicates.js +9 -0
- package/dependency-scanner/file-host-predicates.js.map +1 -1
- package/dependency-scanner/host-method-binding.js +18 -0
- package/dependency-scanner/host-method-binding.js.map +1 -1
- package/dependency-scanner/injected-dynamic-imports.js +232 -1
- package/dependency-scanner/injected-dynamic-imports.js.map +1 -1
- package/dependency-scanner/node-modules-manifest-synthesizer.js +52 -4
- package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -1
- package/dependency-scanner/package-owned-asset-file-path.js +9 -1
- package/dependency-scanner/package-owned-asset-file-path.js.map +1 -1
- package/dependency-scanner/scanner.d.ts +20 -0
- package/dependency-scanner/scanner.d.ts.map +1 -0
- package/dependency-scanner/scanner.js +109 -4
- package/dependency-scanner/scanner.js.map +1 -1
- package/dependency-scanner/source-file-references.d.ts +37 -0
- package/dependency-scanner/source-file-references.d.ts.map +1 -0
- package/dependency-scanner/source-file-references.js +181 -6
- package/dependency-scanner/source-file-references.js.map +1 -1
- package/dependency-scanner/source-map-file-locator.d.ts +10 -0
- package/dependency-scanner/source-map-file-locator.d.ts.map +1 -0
- package/dependency-scanner/source-map-file-locator.js +66 -2
- package/dependency-scanner/source-map-file-locator.js.map +1 -1
- package/dependency-scanner/typescript-compiler-options.d.ts +8 -0
- package/dependency-scanner/typescript-compiler-options.d.ts.map +1 -0
- package/dependency-scanner/typescript-compiler-options.js +21 -1
- package/dependency-scanner/typescript-compiler-options.js.map +1 -1
- package/dependency-scanner/typescript-file-host.d.ts +12 -0
- package/dependency-scanner/typescript-file-host.d.ts.map +1 -0
- package/dependency-scanner/typescript-file-host.js +49 -5
- package/dependency-scanner/typescript-file-host.js.map +1 -1
- package/dependency-scanner/typescript-project-analyzer.d.ts +19 -0
- package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -0
- package/dependency-scanner/typescript-project-analyzer.js +35 -3
- package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
- package/dependency-scanner/virtual-package-json-host.js +45 -4
- package/dependency-scanner/virtual-package-json-host.js.map +1 -1
- package/directed-graph/graph.d.ts +1 -0
- package/directed-graph/graph.d.ts.map +1 -1
- package/directed-graph/graph.js +240 -1
- package/directed-graph/graph.js.map +1 -1
- package/file-manager/compare.js +23 -2
- package/file-manager/compare.js.map +1 -1
- package/file-manager/equal.js +5 -0
- package/file-manager/equal.js.map +1 -1
- package/file-manager/file-description.d.ts +2 -1
- package/file-manager/file-description.d.ts.map +1 -1
- package/file-manager/file-description.js +3 -0
- package/file-manager/file-description.js.map +1 -1
- package/file-manager/file-manager.d.ts +1 -1
- package/file-manager/file-manager.d.ts.map +1 -1
- package/file-manager/file-manager.js +4 -4
- package/file-manager/file-manager.js.map +1 -1
- package/file-manager/permissions.js +28 -1
- package/file-manager/permissions.js.map +1 -1
- package/git/current-git-head.d.ts +12 -0
- package/git/current-git-head.d.ts.map +1 -0
- package/git/current-git-head.js +24 -0
- package/git/current-git-head.js.map +1 -1
- package/git/git-command.js +49 -1
- package/git/git-command.js.map +1 -1
- package/linker/linked-bundle.d.ts +19 -2
- package/linker/linked-bundle.d.ts.map +1 -1
- package/linker/linked-bundle.js +5 -0
- package/linker/linked-bundle.js.map +1 -1
- package/linker/linker.d.ts +13 -0
- package/linker/linker.d.ts.map +1 -0
- package/linker/linker.js +51 -5
- package/linker/linker.js.map +1 -1
- package/linker/replacement-lookup.js +297 -8
- package/linker/replacement-lookup.js.map +1 -1
- package/linker/resource-graph.js +65 -2
- package/linker/resource-graph.js.map +1 -1
- package/linker/source-modifier/import-paths.js +76 -3
- package/linker/source-modifier/import-paths.js.map +1 -1
- package/linker/substitute-bundles.js +166 -3
- package/linker/substitute-bundles.js.map +1 -1
- package/linker/substituted-resource-graph.js +111 -2
- package/linker/substituted-resource-graph.js.map +1 -1
- package/npm-oidc-id-token-resolver.js +82 -0
- package/npm-oidc-id-token-resolver.js.map +1 -1
- package/pack-emitter/pack-emitter.d.ts +20 -0
- package/pack-emitter/pack-emitter.d.ts.map +1 -1
- package/pack-emitter/pack-emitter.js +27 -0
- package/pack-emitter/pack-emitter.js.map +1 -1
- package/package-surface/bin-field.js +8 -2
- package/package-surface/bin-field.js.map +1 -1
- package/package-surface/explicit-bin.js +24 -2
- package/package-surface/explicit-bin.js.map +1 -1
- package/package-surface/explicit-exports.js +26 -3
- package/package-surface/explicit-exports.js.map +1 -1
- package/package-surface/export-map.js +9 -2
- package/package-surface/export-map.js.map +1 -1
- package/package-surface/implicit-bin.js +25 -1
- package/package-surface/implicit-bin.js.map +1 -1
- package/package-surface/implicit-exports.js +10 -3
- package/package-surface/implicit-exports.js.map +1 -1
- package/package-surface/implicit-root-exports.js +13 -2
- package/package-surface/implicit-root-exports.js.map +1 -1
- package/package-surface/package-json-export.js +9 -0
- package/package-surface/package-json-export.js.map +1 -1
- package/package-surface/package-shape.js +10 -1
- package/package-surface/package-shape.js.map +1 -1
- package/package-surface/package-surface-index.js +165 -3
- package/package-surface/package-surface-index.js.map +1 -1
- package/package-surface/public-module-usage.js +46 -3
- package/package-surface/public-module-usage.js.map +1 -1
- package/package-surface/public-specifiers.js +7 -1
- package/package-surface/public-specifiers.js.map +1 -1
- package/package-surface/root-registry.js +26 -0
- package/package-surface/root-registry.js.map +1 -1
- package/package-surface/specifier-syntax.js +4 -0
- package/package-surface/specifier-syntax.js.map +1 -1
- package/package-surface/substitution-exports.js +101 -3
- package/package-surface/substitution-exports.js.map +1 -1
- package/package-surface/surface.d.ts +2 -0
- package/package-surface/surface.d.ts.map +1 -1
- package/package-surface/surface.js +12 -0
- package/package-surface/surface.js.map +1 -1
- package/package.json +1 -1
- package/packages/package-processor.composition.d.ts +22 -0
- package/packages/package-processor.composition.d.ts.map +1 -1
- package/packages/package-processor.composition.js +161 -34
- package/packages/package-processor.composition.js.map +1 -1
- package/packtory/changelog-source-attribution.js +16 -16
- package/packtory/changelog-source-attribution.js.map +1 -1
- package/packtory/map-config.d.ts +11 -1
- package/packtory/map-config.d.ts.map +1 -1
- package/packtory/map-config.js +35 -4
- package/packtory/map-config.js.map +1 -1
- package/packtory/normalize-paths.js +25 -1
- package/packtory/normalize-paths.js.map +1 -1
- package/packtory/options/bundle-dependency-resolution.js +17 -1
- package/packtory/options/bundle-dependency-resolution.js.map +1 -1
- package/packtory/options/dead-code-elimination-resolution.js +10 -1
- package/packtory/options/dead-code-elimination-resolution.js.map +1 -1
- package/packtory/options/prepare-package-options.d.ts +13 -1
- package/packtory/options/prepare-package-options.d.ts.map +1 -1
- package/packtory/options/prepare-package-options.js +46 -5
- package/packtory/options/prepare-package-options.js.map +1 -1
- package/packtory/options/required-value-helpers.js +17 -0
- package/packtory/options/required-value-helpers.js.map +1 -1
- package/packtory/options/setting-resolvers.d.ts +17 -1
- package/packtory/options/setting-resolvers.d.ts.map +1 -1
- package/packtory/options/setting-resolvers.js +47 -3
- package/packtory/options/setting-resolvers.js.map +1 -1
- package/packtory/options/surface-resolution.js +15 -2
- package/packtory/options/surface-resolution.js.map +1 -1
- package/packtory/options/version-provider-context.js +24 -2
- package/packtory/options/version-provider-context.js.map +1 -1
- package/packtory/options/version-trigger.js +39 -2
- package/packtory/options/version-trigger.js.map +1 -1
- package/packtory/pack-output-preflight.js +60 -3
- package/packtory/pack-output-preflight.js.map +1 -1
- package/packtory/package-processor-build.js +97 -3
- package/packtory/package-processor-build.js.map +1 -1
- package/packtory/package-processor-publish-result.d.ts +3 -0
- package/packtory/package-processor-publish-result.d.ts.map +1 -1
- package/packtory/package-processor-publish.d.ts +2 -0
- package/packtory/package-processor-publish.d.ts.map +1 -1
- package/packtory/package-processor-publish.js +297 -6
- package/packtory/package-processor-publish.js.map +1 -1
- package/packtory/package-processor.d.ts +34 -0
- package/packtory/package-processor.d.ts.map +1 -1
- package/packtory/package-processor.js +10 -2
- package/packtory/package-processor.js.map +1 -1
- package/packtory/packtory-pack.js +298 -10
- package/packtory/packtory-pack.js.map +1 -1
- package/packtory/packtory-package-dependencies.js +116 -3
- package/packtory/packtory-package-dependencies.js.map +1 -1
- package/packtory/packtory-package-inspection.js +26 -5
- package/packtory/packtory-package-inspection.js.map +1 -1
- package/packtory/packtory-package-side-effects.js +64 -3
- package/packtory/packtory-package-side-effects.js.map +1 -1
- package/packtory/packtory-package-tree.js +43 -4
- package/packtory/packtory-package-tree.js.map +1 -1
- package/packtory/packtory-publish.js +17 -4
- package/packtory/packtory-publish.js.map +1 -1
- package/packtory/packtory-release-analysis.js +64 -6
- package/packtory/packtory-release-analysis.js.map +1 -1
- package/packtory/packtory-release-diff.js +48 -5
- package/packtory/packtory-release-diff.js.map +1 -1
- package/packtory/packtory-release-plan.js +87 -6
- package/packtory/packtory-release-plan.js.map +1 -1
- package/packtory/packtory-resolve.js +16 -5
- package/packtory/packtory-resolve.js.map +1 -1
- package/packtory/packtory.d.ts +28 -1
- package/packtory/packtory.d.ts.map +1 -1
- package/packtory/packtory.js +242 -13
- package/packtory/packtory.js.map +1 -1
- package/packtory/publish-failure-mapping.js +6 -0
- package/packtory/publish-failure-mapping.js.map +1 -1
- package/packtory/publish-target-preflight.js +25 -3
- package/packtory/publish-target-preflight.js.map +1 -1
- package/packtory/published-release-state.d.ts +19 -0
- package/packtory/published-release-state.d.ts.map +1 -1
- package/packtory/published-release-state.js +11 -0
- package/packtory/published-release-state.js.map +1 -1
- package/packtory/release-analysis.js +153 -5
- package/packtory/release-analysis.js.map +1 -1
- package/packtory/release-diff-failure-mapping.js +6 -0
- package/packtory/release-diff-failure-mapping.js.map +1 -1
- package/packtory/release-plan.js +135 -7
- package/packtory/release-plan.js.map +1 -1
- package/packtory/report-attachment.js +35 -2
- package/packtory/report-attachment.js.map +1 -1
- package/packtory/resolved-package.d.ts +11 -0
- package/packtory/resolved-package.d.ts.map +1 -1
- package/packtory/resolved-package.js +97 -3
- package/packtory/resolved-package.js.map +1 -1
- package/packtory/scheduler.d.ts +47 -0
- package/packtory/scheduler.d.ts.map +1 -1
- package/packtory/scheduler.js +99 -1
- package/packtory/scheduler.js.map +1 -1
- package/packtory/stages/package-analysis-stage.js +50 -2
- package/packtory/stages/package-analysis-stage.js.map +1 -1
- package/packtory/stages/package-resolution-stage.js +80 -5
- package/packtory/stages/package-resolution-stage.js.map +1 -1
- package/packtory/stages/publish-stage.js +125 -4
- package/packtory/stages/publish-stage.js.map +1 -1
- package/packtory/stages/release-diff-stage.js +84 -5
- package/packtory/stages/release-diff-stage.js.map +1 -1
- package/progress/progress-broadcaster.d.ts +1 -0
- package/progress/progress-broadcaster.d.ts.map +1 -1
- package/progress/progress-broadcaster.js +45 -0
- package/progress/progress-broadcaster.js.map +1 -1
- package/published-package/published-package.d.ts +2 -0
- package/published-package/published-package.d.ts.map +1 -1
- package/published-package/published-package.js +12 -1
- package/published-package/published-package.js.map +1 -1
- package/report/aggregator/artifact-entry-merger.js +20 -0
- package/report/aggregator/artifact-entry-merger.js.map +1 -1
- package/report/aggregator/package-report-materialization.js +75 -2
- package/report/aggregator/package-report-materialization.js.map +1 -1
- package/report/aggregator/report-aggregator.js +37 -2
- package/report/aggregator/report-aggregator.js.map +1 -1
- package/report/aggregator/report-event-handlers.js +141 -2
- package/report/aggregator/report-event-handlers.js.map +1 -1
- package/report/aggregator/report-types.d.ts +21 -0
- package/report/aggregator/report-types.d.ts.map +1 -1
- package/report/aggregator/report-types.js +3 -0
- package/report/aggregator/report-types.js.map +1 -1
- package/report/config-redactor.js +29 -3
- package/report/config-redactor.js.map +1 -1
- package/report/decorators.js +85 -0
- package/report/decorators.js.map +1 -1
- package/report/inspectors/inspect-artifact-sizes.js +34 -1
- package/report/inspectors/inspect-artifact-sizes.js.map +1 -1
- package/report/inspectors/inspect-linker-rewrites.js +14 -1
- package/report/inspectors/inspect-linker-rewrites.js.map +1 -1
- package/report/inspectors/inspect-package-json-provenance.js +15 -0
- package/report/inspectors/inspect-package-json-provenance.js.map +1 -1
- package/report/inspectors/inspect-scan-results.js +15 -0
- package/report/inspectors/inspect-scan-results.js.map +1 -1
- package/report/release-diff/release-version-transition.js +18 -0
- package/report/release-diff/release-version-transition.js.map +1 -1
- package/resource-resolver/bundle-resource-lookup.js +25 -0
- package/resource-resolver/bundle-resource-lookup.js.map +1 -1
- package/resource-resolver/content.js +136 -3
- package/resource-resolver/content.js.map +1 -1
- package/resource-resolver/dependency-resolution-walker.js +73 -2
- package/resource-resolver/dependency-resolution-walker.js.map +1 -1
- package/resource-resolver/resolved-bundle.d.ts +54 -0
- package/resource-resolver/resolved-bundle.d.ts.map +1 -1
- package/resource-resolver/resolved-bundle.js +3 -0
- package/resource-resolver/resolved-bundle.js.map +1 -1
- package/resource-resolver/resource-resolve-options.d.ts +5 -0
- package/resource-resolver/resource-resolve-options.d.ts.map +1 -1
- package/resource-resolver/resource-resolve-options.js +13 -1
- package/resource-resolver/resource-resolve-options.js.map +1 -1
- package/resource-resolver/resource-resolver.d.ts +15 -0
- package/resource-resolver/resource-resolver.d.ts.map +1 -0
- package/resource-resolver/resource-resolver.js +128 -5
- package/resource-resolver/resource-resolver.js.map +1 -1
- package/sbom/extract-license.js +11 -1
- package/sbom/extract-license.js.map +1 -1
- package/sbom/license-resolver.d.ts +14 -0
- package/sbom/license-resolver.d.ts.map +1 -0
- package/sbom/license-resolver.js +23 -2
- package/sbom/license-resolver.js.map +1 -1
- package/sbom/sbom-builder.js +57 -2
- package/sbom/sbom-builder.js.map +1 -1
- package/sbom/sbom-canonicalizer.js +45 -3
- package/sbom/sbom-canonicalizer.js.map +1 -1
- package/sbom/sbom-file.d.ts +10 -0
- package/sbom/sbom-file.d.ts.map +1 -1
- package/sbom/sbom-file.js +54 -5
- package/sbom/sbom-file.js.map +1 -1
- package/sbom/sbom-serializer.d.ts +8 -0
- package/sbom/sbom-serializer.d.ts.map +1 -0
- package/sbom/sbom-serializer.js +14 -1
- package/sbom/sbom-serializer.js.map +1 -1
- package/sbom/tool-version.js +49 -1
- package/sbom/tool-version.js.map +1 -1
- package/sbom.cdx.json +5 -5
- package/tar/extract-tar.js +83 -3
- package/tar/extract-tar.js.map +1 -1
- package/tar/gzipped-pack.js +20 -0
- package/tar/gzipped-pack.js.map +1 -1
- package/tar/tarball-builder.d.ts +14 -0
- package/tar/tarball-builder.d.ts.map +1 -0
- package/tar/tarball-builder.js +44 -4
- package/tar/tarball-builder.js.map +1 -1
- package/vendor-materializer/vendor-entry.d.ts +12 -0
- package/vendor-materializer/vendor-entry.d.ts.map +1 -0
- package/vendor-materializer/vendor-entry.js +20 -1
- package/vendor-materializer/vendor-entry.js.map +1 -1
- package/vendor-materializer/vendor-materializer.d.ts +55 -0
- package/vendor-materializer/vendor-materializer.d.ts.map +1 -0
- package/vendor-materializer/vendor-materializer.js +240 -8
- package/vendor-materializer/vendor-materializer.js.map +1 -1
- package/version-manager/dependencies/bundle-dependency-grouping.js +32 -2
- package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -1
- package/version-manager/dependencies/dependency-groups.js +11 -1
- package/version-manager/dependencies/dependency-groups.js.map +1 -1
- package/version-manager/dependencies/external-dependency-classification.js +82 -3
- package/version-manager/dependencies/external-dependency-classification.js.map +1 -1
- package/version-manager/dependencies/versioned-bundle-dependencies.js +8 -3
- package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -1
- package/version-manager/imports/hash-import-scanner.js +20 -2
- package/version-manager/imports/hash-import-scanner.js.map +1 -1
- package/version-manager/imports/imports-key-matcher.js +22 -0
- package/version-manager/imports/imports-key-matcher.js.map +1 -1
- package/version-manager/imports/versioned-bundle-imports.js +44 -2
- package/version-manager/imports/versioned-bundle-imports.js.map +1 -1
- package/version-manager/manager.d.ts +5 -0
- package/version-manager/manager.d.ts.map +1 -1
- package/version-manager/manager.js +46 -6
- package/version-manager/manager.js.map +1 -1
- package/version-manager/manifest/builder.js +51 -1
- package/version-manager/manifest/builder.js.map +1 -1
- package/version-manager/manifest/serialize.js +8 -1
- package/version-manager/manifest/serialize.js.map +1 -1
- package/version-manager/optional-bundle-fields.js +5 -1
- package/version-manager/optional-bundle-fields.js.map +1 -1
- package/version-manager/representative-root.js +9 -1
- package/version-manager/representative-root.js.map +1 -1
- package/version-manager/specifier-classifier.js +42 -2
- package/version-manager/specifier-classifier.js.map +1 -1
- package/version-manager/specifier-errors.js +58 -0
- package/version-manager/specifier-errors.js.map +1 -1
- package/version-manager/versioned-bundle.d.ts +3 -1
- package/version-manager/versioned-bundle.d.ts.map +1 -1
- package/version-manager/versioned-bundle.js +31 -6
- package/version-manager/versioned-bundle.js.map +1 -1
- package/zip/zip-builder.d.ts +22 -0
- package/zip/zip-builder.d.ts.map +1 -0
- package/zip/zip-builder.js +81 -2
- package/zip/zip-builder.js.map +1 -1
|
@@ -13,5 +13,10 @@ export type ResourceResolveOptions = {
|
|
|
13
13
|
readonly roots: Roots;
|
|
14
14
|
readonly surface?: PackageSurface | undefined;
|
|
15
15
|
};
|
|
16
|
+
export type ResolvedRootsAndSurface = {
|
|
17
|
+
readonly roots: Roots;
|
|
18
|
+
readonly surface: PackageSurface;
|
|
19
|
+
};
|
|
20
|
+
export declare function resolveRootsAndSurface(options: ResourceResolveOptions): ResolvedRootsAndSurface;
|
|
16
21
|
export {};
|
|
17
22
|
//# sourceMappingURL=resource-resolve-options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-resolve-options.d.ts","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolve-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE5F,KAAK,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AAE5C,MAAM,MAAM,sBAAsB,GAAG;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC,yBAAyB,GAAG,MAAM,CAAC,EAAE,CAAC;IAC1E,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;CACjD,CAAC;AAEF,MAAM,
|
|
1
|
+
{"version":3,"file":"resource-resolve-options.d.ts","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolve-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE5F,KAAK,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AAE5C,MAAM,MAAM,sBAAsB,GAAG;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC,yBAAyB,GAAG,MAAM,CAAC,EAAE,CAAC;IAC1E,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CACpC,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,sBAAsB,GAAG,uBAAuB,CAY/F"}
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import "../package-surface/surface.js";
|
|
1
|
+
import { implicitPackageSurface } from "../package-surface/surface.js";
|
|
2
|
+
export function resolveRootsAndSurface(options) {
|
|
3
|
+
const rootEntries = Object.entries(options.roots);
|
|
4
|
+
const [firstRootEntry] = rootEntries;
|
|
5
|
+
if (firstRootEntry === undefined) {
|
|
6
|
+
throw new Error(`Package "${options.name}" must define at least one root`);
|
|
7
|
+
}
|
|
8
|
+
const [firstRootId] = firstRootEntry;
|
|
9
|
+
return {
|
|
10
|
+
roots: options.roots,
|
|
11
|
+
surface: options.surface ?? implicitPackageSurface(firstRootId)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
2
14
|
//# sourceMappingURL=resource-resolve-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-resolve-options.js","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolve-options.ts"],"names":[],"mappings":"AAGA,
|
|
1
|
+
{"version":3,"file":"resource-resolve-options.js","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolve-options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAuB,MAAM,+BAA+B,CAAC;AAoB5F,MAAM,UAAU,sBAAsB,CAAC,OAA+B;IAClE,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAE,cAAc,CAAE,GAAG,WAAW,CAAC;IACvC,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,CAAC,IAAI,iCAAiC,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,CAAE,WAAW,CAAE,GAAG,cAAc,CAAC;IACvC,OAAO;QACH,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,sBAAsB,CAAC,WAAW,CAAC;KAClE,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DependencyScanner } from '../dependency-scanner/scanner.ts';
|
|
2
|
+
import type { FileManager } from '../file-manager/file-manager.ts';
|
|
3
|
+
import type { ResolvedBundle } from './resolved-bundle.ts';
|
|
4
|
+
import { type ResourceResolveOptions } from './resource-resolve-options.ts';
|
|
5
|
+
export type ResourceResolverDependencies = {
|
|
6
|
+
readonly dependencyScanner: DependencyScanner;
|
|
7
|
+
readonly fileManager: FileManager;
|
|
8
|
+
};
|
|
9
|
+
export type ResourceResolver = {
|
|
10
|
+
resolve: (options: ResourceResolveOptions) => Promise<ResolvedBundle>;
|
|
11
|
+
resolveWithPromotedDeclarations: (options: ResourceResolveOptions, promotedDeclarationEntryFiles: readonly string[]) => Promise<ResolvedBundle>;
|
|
12
|
+
resolveWithPromotedDeclarationCompanions: (options: ResourceResolveOptions, substitutedInputFilePaths: ReadonlySet<string>) => Promise<ResolvedBundle>;
|
|
13
|
+
};
|
|
14
|
+
export declare function createResourceResolver(dependencies: ResourceResolverDependencies): ResourceResolver;
|
|
15
|
+
//# sourceMappingURL=resource-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-resolver.d.ts","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAO1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEpG,MAAM,MAAM,4BAA4B,GAAG;IACvC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,OAAO,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACtE,+BAA+B,EAAE,CAC7B,OAAO,EAAE,sBAAsB,EAC/B,6BAA6B,EAAE,SAAS,MAAM,EAAE,KAC/C,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7B,wCAAwC,EAAE,CACtC,OAAO,EAAE,sBAAsB,EAC/B,yBAAyB,EAAE,WAAW,CAAC,MAAM,CAAC,KAC7C,OAAO,CAAC,cAAc,CAAC,CAAC;CAChC,CAAC;AAmIF,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,4BAA4B,GAAG,gBAAgB,CAmEnG"}
|
|
@@ -1,6 +1,129 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
1
|
+
import { mergeExternalDependencyReference } from "../dependency-scanner/external-dependencies.js";
|
|
2
|
+
import { declarationCompanionCandidates } from "../common/declaration-companion-paths.js";
|
|
3
|
+
import { combineAllBundleFiles } from "./content.js";
|
|
4
|
+
import { buildResolvedRoots } from "./bundle-resource-lookup.js";
|
|
5
|
+
import { resolveDependenciesForAllRoots } from "./dependency-resolution-walker.js";
|
|
6
|
+
import { resolveRootsAndSurface } from "./resource-resolve-options.js";
|
|
7
|
+
const packageJsonIndentationSpaces = 4;
|
|
8
|
+
function serializeVirtualManifest(mainPackageJson) {
|
|
9
|
+
return `${JSON.stringify(mainPackageJson, null, packageJsonIndentationSpaces)}\n`;
|
|
10
|
+
}
|
|
11
|
+
function hasDeclarationRoots(options) {
|
|
12
|
+
const normalized = resolveRootsAndSurface(options);
|
|
13
|
+
return Object.values(normalized.roots).some(function (root) {
|
|
14
|
+
return root.declarationFile !== undefined;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async function findReadableDeclarationCompanion(fileManager, inputFilePath) {
|
|
18
|
+
for (const candidate of declarationCompanionCandidates(inputFilePath)) {
|
|
19
|
+
const readability = await fileManager.checkReadability(candidate);
|
|
20
|
+
if (readability.isReadable) {
|
|
21
|
+
return candidate;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
async function findReadableDeclarationCompanions(fileManager, substitutedInputFilePaths) {
|
|
27
|
+
const companions = [];
|
|
28
|
+
for (const inputFilePath of substitutedInputFilePaths) {
|
|
29
|
+
const companion = await findReadableDeclarationCompanion(fileManager, inputFilePath);
|
|
30
|
+
if (companion !== undefined) {
|
|
31
|
+
companions.push(companion);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return companions;
|
|
35
|
+
}
|
|
36
|
+
async function resolveFileDescription(fileManager, bundleFile, mainPackageJson) {
|
|
37
|
+
if (bundleFile.isGeneratedManifest) {
|
|
38
|
+
return {
|
|
39
|
+
content: serializeVirtualManifest(mainPackageJson),
|
|
40
|
+
isExecutable: false,
|
|
41
|
+
inputFilePath: bundleFile.inputFilePath,
|
|
42
|
+
targetFilePath: bundleFile.targetFilePath
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return await fileManager.getTransferableFileDescriptionFromPath(bundleFile.inputFilePath, bundleFile.targetFilePath);
|
|
46
|
+
}
|
|
47
|
+
function targetPathByInputPath(resources) {
|
|
48
|
+
return new Map(resources.map(function (resource) {
|
|
49
|
+
return [resource.fileDescription.inputFilePath, resource.fileDescription.targetFilePath];
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
function targetFilePathFor(targetByInputPath, inputFilePath) {
|
|
53
|
+
return targetByInputPath.get(inputFilePath) ?? inputFilePath;
|
|
54
|
+
}
|
|
55
|
+
function dependencySpecifierReferences(dependency) {
|
|
56
|
+
if (dependency.references !== undefined) {
|
|
57
|
+
return dependency.references.map(function (reference) {
|
|
58
|
+
return {
|
|
59
|
+
name: dependency.name,
|
|
60
|
+
targetFilePath: reference.targetFilePath,
|
|
61
|
+
sourceSpecifier: reference.sourceSpecifier,
|
|
62
|
+
emittedSpecifier: reference.emittedSpecifier
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return dependency.referencedFrom.map(function (targetFilePath) {
|
|
67
|
+
return {
|
|
68
|
+
name: dependency.name,
|
|
69
|
+
targetFilePath,
|
|
70
|
+
sourceSpecifier: dependency.name,
|
|
71
|
+
emittedSpecifier: dependency.name
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function externalDependenciesWithTargetPaths(dependencies, targetByInputPath) {
|
|
76
|
+
const dependenciesByName = new Map();
|
|
77
|
+
for (const dependency of dependencies.values()) {
|
|
78
|
+
for (const reference of dependencySpecifierReferences(dependency)) {
|
|
79
|
+
const existing = dependenciesByName.get(reference.name);
|
|
80
|
+
dependenciesByName.set(reference.name, mergeExternalDependencyReference({
|
|
81
|
+
name: reference.name,
|
|
82
|
+
sourceSpecifier: reference.sourceSpecifier,
|
|
83
|
+
emittedSpecifier: reference.emittedSpecifier
|
|
84
|
+
}, targetFilePathFor(targetByInputPath, reference.targetFilePath), existing));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return dependenciesByName;
|
|
88
|
+
}
|
|
89
|
+
export function createResourceResolver(dependencies) {
|
|
90
|
+
const { dependencyScanner, fileManager } = dependencies;
|
|
91
|
+
async function resolveWithPromotedDeclarations(options, promotedDeclarationEntryFiles) {
|
|
92
|
+
const normalized = resolveRootsAndSurface(options);
|
|
93
|
+
const resolvedDependencies = await resolveDependenciesForAllRoots({ dependencyScanner, fileManager }, options, promotedDeclarationEntryFiles);
|
|
94
|
+
const bundleFiles = combineAllBundleFiles(options.sourcesFolder, resolvedDependencies.localFiles, options.additionalFiles);
|
|
95
|
+
const contents = await Promise.all(bundleFiles.map(async function (bundleFile) {
|
|
96
|
+
const fileDescription = await resolveFileDescription(fileManager, bundleFile, options.mainPackageJson);
|
|
97
|
+
return {
|
|
98
|
+
fileDescription,
|
|
99
|
+
directDependencies: bundleFile.directDependencies,
|
|
100
|
+
moduleReferences: bundleFile.moduleReferences,
|
|
101
|
+
project: bundleFile.project,
|
|
102
|
+
isExplicitlyIncluded: bundleFile.isExplicitlyIncluded,
|
|
103
|
+
...bundleFile.isGeneratedManifest ? { isGeneratedManifest: true } : {}
|
|
104
|
+
};
|
|
105
|
+
}));
|
|
106
|
+
const targetByInputPath = targetPathByInputPath(contents);
|
|
107
|
+
return {
|
|
108
|
+
contents,
|
|
109
|
+
name: options.name,
|
|
110
|
+
exportPackageJson: options.exportPackageJson,
|
|
111
|
+
surface: normalized.surface,
|
|
112
|
+
externalDependencies: externalDependenciesWithTargetPaths(resolvedDependencies.externalDependencies, targetByInputPath),
|
|
113
|
+
roots: buildResolvedRoots(normalized, contents)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
async resolve(options) {
|
|
118
|
+
return await resolveWithPromotedDeclarations(options, []);
|
|
119
|
+
},
|
|
120
|
+
resolveWithPromotedDeclarations,
|
|
121
|
+
async resolveWithPromotedDeclarationCompanions(options, substitutedInputFilePaths) {
|
|
122
|
+
const promotedDeclarationEntryFiles = hasDeclarationRoots(options)
|
|
123
|
+
? await findReadableDeclarationCompanions(fileManager, substitutedInputFilePaths)
|
|
124
|
+
: [];
|
|
125
|
+
return await resolveWithPromotedDeclarations(options, promotedDeclarationEntryFiles);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
6
129
|
//# sourceMappingURL=resource-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-resolver.js","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resource-resolver.js","sourceRoot":"","sources":["../../../../source/resource-resolver/resource-resolver.ts"],"names":[],"mappings":"AACA,OAAO,EACH,gCAAgC,EAInC,MAAM,gDAAgD,CAAC;AAExD,OAAO,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAEnF,OAAO,EAAE,sBAAsB,EAA+B,MAAM,+BAA+B,CAAC;AAmBpG,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAQvC,SAAS,wBAAwB,CA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
|
|
1
|
-
import 'remeda';
|
|
1
|
+
import { isPlainObject } from 'remeda';
|
|
2
|
+
export function extractLicenseFromManifest(packageJson) {
|
|
3
|
+
if (!isPlainObject(packageJson)) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
const { license } = packageJson;
|
|
7
|
+
if (typeof license === 'string' && license.length > 0) {
|
|
8
|
+
return license;
|
|
9
|
+
}
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
2
12
|
//# sourceMappingURL=extract-license.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-license.js","sourceRoot":"","sources":["../../../../source/sbom/extract-license.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"extract-license.js","sourceRoot":"","sources":["../../../../source/sbom/extract-license.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,UAAU,0BAA0B,CAAC,WAAoB;IAC3D,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;IAChC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpD,OAAO,OAAO,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FileManager } from '../file-manager/file-manager.ts';
|
|
2
|
+
type LicenseResolverDependencies = {
|
|
3
|
+
readonly fileManager: FileManager;
|
|
4
|
+
};
|
|
5
|
+
type LicenseResolveOptions = {
|
|
6
|
+
readonly projectFolder: string;
|
|
7
|
+
readonly dependencyName: string;
|
|
8
|
+
};
|
|
9
|
+
export type LicenseResolver = {
|
|
10
|
+
resolveLicense: (options: LicenseResolveOptions) => Promise<string | undefined>;
|
|
11
|
+
};
|
|
12
|
+
export declare function createLicenseResolver(dependencies: LicenseResolverDependencies): LicenseResolver;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=license-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license-resolver.d.ts","sourceRoot":"","sources":["../../../../source/sbom/license-resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAGnE,KAAK,2BAA2B,GAAG;IAC/B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACrC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,cAAc,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACnF,CAAC;AAMF,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,2BAA2B,GAAG,eAAe,CAoBhG"}
|
package/sbom/license-resolver.js
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
import "../common/package-layout.js";
|
|
2
|
-
import "./extract-license.js";
|
|
1
|
+
import { installedDependenciesFolderName, installedDependencyManifestPathIn } from "../common/package-layout.js";
|
|
2
|
+
import { extractLicenseFromManifest } from "./extract-license.js";
|
|
3
|
+
function parseJsonString(content) {
|
|
4
|
+
return JSON.parse(content);
|
|
5
|
+
}
|
|
6
|
+
export function createLicenseResolver(dependencies) {
|
|
7
|
+
const { fileManager } = dependencies;
|
|
8
|
+
function buildMissingDependencyMessage(dependencyName) {
|
|
9
|
+
const intro = `Dependency "${dependencyName}" is declared in the published manifest`;
|
|
10
|
+
return `${intro} but is not installed in ${installedDependenciesFolderName}`;
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
async resolveLicense({ projectFolder, dependencyName }) {
|
|
14
|
+
const packageJsonPath = installedDependencyManifestPathIn(projectFolder, dependencyName);
|
|
15
|
+
const readability = await fileManager.checkReadability(packageJsonPath);
|
|
16
|
+
if (!readability.isReadable) {
|
|
17
|
+
throw new Error(buildMissingDependencyMessage(dependencyName));
|
|
18
|
+
}
|
|
19
|
+
const parsed = parseJsonString(await fileManager.readFile(packageJsonPath));
|
|
20
|
+
return extractLicenseFromManifest(parsed);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
3
24
|
//# sourceMappingURL=license-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license-resolver.js","sourceRoot":"","sources":["../../../../source/sbom/license-resolver.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"license-resolver.js","sourceRoot":"","sources":["../../../../source/sbom/license-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAEjH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAelE,SAAS,eAAe,CAAC,OAAe;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAY,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,YAAyC;IAC3E,MAAM,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC;IAErC,SAAS,6BAA6B,CAAC,cAAsB;QACzD,MAAM,KAAK,GAAG,eAAe,cAAc,yCAAyC,CAAC;QACrF,OAAO,GAAG,KAAK,4BAA4B,+BAA+B,EAAE,CAAC;IACjF,CAAC;IAED,OAAO;QACH,KAAK,CAAC,cAAc,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE;YAClD,MAAM,eAAe,GAAG,iCAAiC,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;YACzF,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;YACxE,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,cAAc,CAAC,CAAC,CAAC;YACnE,CAAC;YAED,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;YAC5E,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;KACJ,CAAC;AACN,CAAC"}
|
package/sbom/sbom-builder.js
CHANGED
|
@@ -1,3 +1,58 @@
|
|
|
1
|
-
import '@cyclonedx/cyclonedx-library';
|
|
2
|
-
import 'spdx-expression-parse';
|
|
1
|
+
import * as cdx from '@cyclonedx/cyclonedx-library';
|
|
2
|
+
import spdxParse from 'spdx-expression-parse';
|
|
3
|
+
function isParseableSpdxExpression(value) {
|
|
4
|
+
try {
|
|
5
|
+
spdxParse(value);
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
function buildPurl(name, versionOrSpecifier) {
|
|
13
|
+
return `pkg:npm/${name}@${encodeURIComponent(versionOrSpecifier)}`;
|
|
14
|
+
}
|
|
15
|
+
function buildRootComponent(rootComponent) {
|
|
16
|
+
const purl = buildPurl(rootComponent.name, rootComponent.version);
|
|
17
|
+
return new cdx.Models.Component(cdx.Enums.ComponentType.Library, rootComponent.name, {
|
|
18
|
+
version: rootComponent.version,
|
|
19
|
+
bomRef: purl,
|
|
20
|
+
purl
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function buildDependencyComponent(dependency) {
|
|
24
|
+
const purl = buildPurl(dependency.name, dependency.specifier);
|
|
25
|
+
const component = new cdx.Models.Component(cdx.Enums.ComponentType.Library, dependency.name, {
|
|
26
|
+
version: dependency.specifier,
|
|
27
|
+
bomRef: purl,
|
|
28
|
+
purl,
|
|
29
|
+
scope: dependency.scope
|
|
30
|
+
});
|
|
31
|
+
if (dependency.license === undefined) {
|
|
32
|
+
return component;
|
|
33
|
+
}
|
|
34
|
+
if (isParseableSpdxExpression(dependency.license)) {
|
|
35
|
+
component.licenses.add(new cdx.Models.LicenseExpression(dependency.license));
|
|
36
|
+
return component;
|
|
37
|
+
}
|
|
38
|
+
component.licenses.add(new cdx.Models.NamedLicense(dependency.license));
|
|
39
|
+
return component;
|
|
40
|
+
}
|
|
41
|
+
function buildToolComponent(toolVersion) {
|
|
42
|
+
return new cdx.Models.Component(cdx.Enums.ComponentType.Application, 'packtory', {
|
|
43
|
+
version: toolVersion
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export function buildSbom(options) {
|
|
47
|
+
const bom = new cdx.Models.Bom();
|
|
48
|
+
bom.metadata.tools.components.add(buildToolComponent(options.toolVersion));
|
|
49
|
+
const rootComponent = buildRootComponent(options.rootComponent);
|
|
50
|
+
bom.metadata.component = rootComponent;
|
|
51
|
+
for (const dependency of options.dependencies) {
|
|
52
|
+
const component = buildDependencyComponent(dependency);
|
|
53
|
+
bom.components.add(component);
|
|
54
|
+
rootComponent.dependencies.add(component.bomRef);
|
|
55
|
+
}
|
|
56
|
+
return bom;
|
|
57
|
+
}
|
|
3
58
|
//# sourceMappingURL=sbom-builder.js.map
|
package/sbom/sbom-builder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sbom-builder.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-builder.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"sbom-builder.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAoB9C,SAAS,yBAAyB,CAAC,KAAa;IAC5C,IAAI,CAAC;QACD,SAAS,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAAC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OAAO,SAAS,CAAC;IACrB,CAAC;IACD,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,SAAS,kBAAkB,CAAC,WAAmB;IAC3C,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE,UAAU,EAAE;QAC7E,OAAO,EAAE,WAAW;KACvB,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAA2B;IACjD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IACjC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IAE3E,MAAM,aAAa,GAAG,kBAAkB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAChE,GAAG,CAAC,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC;IAEvC,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QAC5C,MAAM,SAAS,GAAG,wBAAwB,CAAC,UAAU,CAAC,CAAC;QACvD,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC9B,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC"}
|
|
@@ -1,4 +1,46 @@
|
|
|
1
|
-
import 'remeda';
|
|
2
|
-
import "../common/package-layout.js";
|
|
3
|
-
import "../common/stable-json.js";
|
|
1
|
+
import { isArray, isPlainObject } from 'remeda';
|
|
2
|
+
import { bundleRelativePath, sbomArtifactFilePath } from "../common/package-layout.js";
|
|
3
|
+
import { serializeStableJson } from "../common/stable-json.js";
|
|
4
|
+
const packtoryToolName = 'packtory';
|
|
5
|
+
function pluckObjectField(value, key) {
|
|
6
|
+
if (!isPlainObject(value)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return value[key];
|
|
10
|
+
}
|
|
11
|
+
function resolveToolComponents(parsed) {
|
|
12
|
+
const metadata = pluckObjectField(parsed, 'metadata');
|
|
13
|
+
const tools = pluckObjectField(metadata, 'tools');
|
|
14
|
+
const components = pluckObjectField(tools, 'components');
|
|
15
|
+
return isArray(components) ? components : undefined;
|
|
16
|
+
}
|
|
17
|
+
function stripPacktoryVersion(parsed) {
|
|
18
|
+
const components = resolveToolComponents(parsed);
|
|
19
|
+
if (components === undefined) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
for (const entry of components) {
|
|
23
|
+
if (isPlainObject(entry) && entry.name === packtoryToolName) {
|
|
24
|
+
delete entry.version;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function canonicalizeSbomContent(content) {
|
|
29
|
+
try {
|
|
30
|
+
const parsed = JSON.parse(content);
|
|
31
|
+
stripPacktoryVersion(parsed);
|
|
32
|
+
return serializeStableJson(parsed);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return content;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function canonicalizeSbomInFileSet(files) {
|
|
39
|
+
return files.map(function (file) {
|
|
40
|
+
if (bundleRelativePath(file.filePath) !== sbomArtifactFilePath) {
|
|
41
|
+
return file;
|
|
42
|
+
}
|
|
43
|
+
return { ...file, content: canonicalizeSbomContent(file.content) };
|
|
44
|
+
});
|
|
45
|
+
}
|
|
4
46
|
//# sourceMappingURL=sbom-canonicalizer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sbom-canonicalizer.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-canonicalizer.ts"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;AAED,SAAS,uBAAuB,CAAC,OAAe;IAC5C,IAAI,CAAC;QACD,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC5C,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAC7B,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,OAAO,CAAC;IACnB,CAAC;AACL,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,KAAiC;IACvE,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,IAAI;QAC3B,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,oBAAoB,EAAE,CAAC;YAC7D,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;IACvE,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/sbom/sbom-file.d.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import type { PublishSettings } from '../config/publish-settings.ts';
|
|
2
2
|
import { type FileDescription } from '../file-manager/file-description.ts';
|
|
3
3
|
import type { SbomPackage, SbomSiblingPackage } from '../published-package/published-package.ts';
|
|
4
|
+
import type { LicenseResolver } from './license-resolver.ts';
|
|
5
|
+
import type { SbomSerializer } from './sbom-serializer.ts';
|
|
6
|
+
type ToolVersionProvider = () => Promise<string>;
|
|
7
|
+
type SbomFileBuilderDependencies = {
|
|
8
|
+
readonly licenseResolver: LicenseResolver;
|
|
9
|
+
readonly sbomSerializer: SbomSerializer;
|
|
10
|
+
readonly toolVersionProvider: ToolVersionProvider;
|
|
11
|
+
readonly projectFolder: string;
|
|
12
|
+
};
|
|
4
13
|
export type SbomFileBuilder = {
|
|
5
14
|
generate: (bundle: SbomPackage, siblings: readonly SbomSiblingPackage[], publishSettings: PublishSettings) => Promise<readonly FileDescription[] | undefined>;
|
|
6
15
|
};
|
|
16
|
+
export declare function createSbomFileBuilder(dependencies: SbomFileBuilderDependencies): SbomFileBuilder;
|
|
7
17
|
export {};
|
|
8
18
|
//# sourceMappingURL=sbom-file.d.ts.map
|
package/sbom/sbom-file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sbom-file.d.ts","sourceRoot":"","sources":["../../../../source/sbom/sbom-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"sbom-file.d.ts","sourceRoot":"","sources":["../../../../source/sbom/sbom-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAEjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D,KAAK,mBAAmB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;AAEjD,KAAK,2BAA2B,GAAG;IAC/B,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAClD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,EAAE,CACN,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,SAAS,kBAAkB,EAAE,EACvC,eAAe,EAAE,eAAe,KAC/B,OAAO,CAAC,SAAS,eAAe,EAAE,GAAG,SAAS,CAAC,CAAC;CACxD,CAAC;AAuBF,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,2BAA2B,GAAG,eAAe,CA6ChG"}
|
package/sbom/sbom-file.js
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
|
-
import '@cyclonedx/cyclonedx-library';
|
|
2
|
-
import "../common/package-layout.js";
|
|
3
|
-
import "../file-manager/file-description.js";
|
|
4
|
-
import "./extract-license.js";
|
|
5
|
-
import "./sbom-builder.js";
|
|
1
|
+
import * as cdx from '@cyclonedx/cyclonedx-library';
|
|
2
|
+
import { sbomArtifactFilePath } from "../common/package-layout.js";
|
|
3
|
+
import { createFileDescription } from "../file-manager/file-description.js";
|
|
4
|
+
import { extractLicenseFromManifest } from "./extract-license.js";
|
|
5
|
+
import { buildSbom } from "./sbom-builder.js";
|
|
6
|
+
function isSbomEnabled(publishSettings) {
|
|
7
|
+
return publishSettings.sbom?.enabled ?? true;
|
|
8
|
+
}
|
|
9
|
+
function listDependencyEntries(bundle) {
|
|
10
|
+
return [
|
|
11
|
+
...Object.entries(bundle.dependencies).map(function ([name, specifier]) {
|
|
12
|
+
return { name, specifier, scope: cdx.Enums.ComponentScope.Required };
|
|
13
|
+
}),
|
|
14
|
+
...Object.entries(bundle.peerDependencies).map(function ([name, specifier]) {
|
|
15
|
+
return { name, specifier, scope: cdx.Enums.ComponentScope.Optional };
|
|
16
|
+
})
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
export function createSbomFileBuilder(dependencies) {
|
|
20
|
+
const { licenseResolver, sbomSerializer, toolVersionProvider, projectFolder } = dependencies;
|
|
21
|
+
async function resolveDependencyEntries(bundle, siblings) {
|
|
22
|
+
const siblingsByName = new Map(siblings.map(function (sibling) {
|
|
23
|
+
return [sibling.name, sibling];
|
|
24
|
+
}));
|
|
25
|
+
const entries = listDependencyEntries(bundle);
|
|
26
|
+
return Promise.all(entries.map(async function (entry) {
|
|
27
|
+
const sibling = siblingsByName.get(entry.name);
|
|
28
|
+
const license = sibling === undefined
|
|
29
|
+
? await licenseResolver.resolveLicense({ projectFolder, dependencyName: entry.name })
|
|
30
|
+
: extractLicenseFromManifest(sibling.packageJson);
|
|
31
|
+
return { ...entry, license };
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
async function buildFile(bundle, siblings) {
|
|
35
|
+
const [resolvedToolVersion, sbomDependencies] = await Promise.all([
|
|
36
|
+
toolVersionProvider(),
|
|
37
|
+
resolveDependencyEntries(bundle, siblings)
|
|
38
|
+
]);
|
|
39
|
+
const bom = buildSbom({
|
|
40
|
+
toolVersion: resolvedToolVersion,
|
|
41
|
+
rootComponent: { name: bundle.packageJson.name, version: bundle.packageJson.version },
|
|
42
|
+
dependencies: sbomDependencies
|
|
43
|
+
});
|
|
44
|
+
return createFileDescription(sbomArtifactFilePath, sbomSerializer.serialize(bom));
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
async generate(bundle, siblings, publishSettings) {
|
|
48
|
+
if (!isSbomEnabled(publishSettings)) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return [await buildFile(bundle, siblings)];
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
6
55
|
//# sourceMappingURL=sbom-file.js.map
|
package/sbom/sbom-file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sbom-file.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-file.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"sbom-file.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EA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,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as cdx from '@cyclonedx/cyclonedx-library';
|
|
2
|
+
type SerializableBom = Readonly<cdx.Models.Bom>;
|
|
3
|
+
export type SbomSerializer = {
|
|
4
|
+
serialize: (bom: SerializableBom) => string;
|
|
5
|
+
};
|
|
6
|
+
export declare function createSbomSerializer(): SbomSerializer;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=sbom-serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sbom-serializer.d.ts","sourceRoot":"","sources":["../../../../source/sbom/sbom-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AAEpD,KAAK,eAAe,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IACzB,SAAS,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,MAAM,CAAC;CAC/C,CAAC;AAUF,wBAAgB,oBAAoB,IAAI,cAAc,CAOrD"}
|
package/sbom/sbom-serializer.js
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import '@cyclonedx/cyclonedx-library';
|
|
1
|
+
import * as cdx from '@cyclonedx/cyclonedx-library';
|
|
2
|
+
function createCycloneDxJsonSerializer() {
|
|
3
|
+
return new cdx.Serialize.JsonSerializer(new cdx.Serialize.JSON.Normalize.Factory(cdx.Spec.Spec1dot6));
|
|
4
|
+
}
|
|
5
|
+
function serializeBom(serializer, bom) {
|
|
6
|
+
return String(Reflect.apply(serializer.serialize, serializer, [bom, { sortLists: true, space: 4 }]));
|
|
7
|
+
}
|
|
8
|
+
export function createSbomSerializer() {
|
|
9
|
+
const serializer = createCycloneDxJsonSerializer();
|
|
10
|
+
const serialize = function (bom) {
|
|
11
|
+
return serializeBom(serializer, bom);
|
|
12
|
+
};
|
|
13
|
+
return { serialize };
|
|
14
|
+
}
|
|
2
15
|
//# sourceMappingURL=sbom-serializer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sbom-serializer.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-serializer.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"sbom-serializer.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AAQpD,SAAS,6BAA6B;IAClC,OAAO,IAAI,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1G,CAAC;AAED,SAAS,YAAY,CAAC,UAAwC,EAAE,GAAoB;IAChF,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,CAAE,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAE,CAAC,CAAC,CAAC;AAC3G,CAAC;AAED,MAAM,UAAU,oBAAoB;IAChC,MAAM,UAAU,GAAG,6BAA6B,EAAE,CAAC;IACnD,MAAM,SAAS,GAAG,UAAU,GAAoB;QAC5C,OAAO,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC,CAAC;IAEF,OAAO,EAAE,SAAS,EAAE,CAAC;AACzB,CAAC"}
|
package/sbom/tool-version.js
CHANGED
|
@@ -1,2 +1,50 @@
|
|
|
1
|
-
import 'remeda';
|
|
1
|
+
import { isObjectType, isPlainObject } from 'remeda';
|
|
2
|
+
const candidatePackageNames = ['@packtory/cli', 'packtory'];
|
|
3
|
+
function buildUnresolvableMessage() {
|
|
4
|
+
const intro = 'Cannot determine packtory tool version: neither "@packtory/cli" nor "packtory" is resolvable.';
|
|
5
|
+
return `${intro} Install packtory via npm so it lives under node_modules/.`;
|
|
6
|
+
}
|
|
7
|
+
function isCandidatePackageName(value) {
|
|
8
|
+
return value === '@packtory/cli' || value === 'packtory';
|
|
9
|
+
}
|
|
10
|
+
function isImportResolutionError(error) {
|
|
11
|
+
if (!isObjectType(error) || !Object.hasOwn(error, 'code')) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
const code = Reflect.get(error, 'code');
|
|
15
|
+
return code === 'ERR_MODULE_NOT_FOUND' || code === 'ERR_PACKAGE_PATH_NOT_EXPORTED';
|
|
16
|
+
}
|
|
17
|
+
function unwrapJsonModule(importedModule) {
|
|
18
|
+
if (!isPlainObject(importedModule) || !Object.hasOwn(importedModule, 'default')) {
|
|
19
|
+
return importedModule;
|
|
20
|
+
}
|
|
21
|
+
return importedModule.default;
|
|
22
|
+
}
|
|
23
|
+
function parseToolPackageJson(specifier, importedModule) {
|
|
24
|
+
const parsed = unwrapJsonModule(importedModule);
|
|
25
|
+
if (!isPlainObject(parsed) || typeof parsed.version !== 'string') {
|
|
26
|
+
throw new Error(`Imported packtory package.json from "${specifier}" is missing a version field`);
|
|
27
|
+
}
|
|
28
|
+
if (!isCandidatePackageName(parsed.name)) {
|
|
29
|
+
throw new Error(`Imported packtory package.json from "${specifier}" has unexpected package name`);
|
|
30
|
+
}
|
|
31
|
+
return parsed.version;
|
|
32
|
+
}
|
|
33
|
+
export function createPacktoryToolVersionResolver(dependencies) {
|
|
34
|
+
const { importPackageJson } = dependencies;
|
|
35
|
+
return async function resolvePacktoryToolVersion() {
|
|
36
|
+
for (const candidatePackageName of candidatePackageNames) {
|
|
37
|
+
const specifier = `${candidatePackageName}/package.json`;
|
|
38
|
+
try {
|
|
39
|
+
return parseToolPackageJson(specifier, await importPackageJson(specifier));
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (!isImportResolutionError(error)) {
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
throw new Error(buildUnresolvableMessage());
|
|
48
|
+
};
|
|
49
|
+
}
|
|
2
50
|
//# sourceMappingURL=tool-version.js.map
|
package/sbom/tool-version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-version.js","sourceRoot":"","sources":["../../../../source/sbom/tool-version.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"tool-version.js","sourceRoot":"","sources":["../../../../source/sbom/tool-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAErD,MAAM,qBAAqB,GAAG,CAAE,eAAe,EAAE,UAAU,CAAW,CAAC;AAQvE,SAAS,wBAAwB;IAC7B,MAAM,KAAK,GAAG,+FAA+F,CAAC;IAC9G,OAAO,GAAG,KAAK,4DAA4D,CAAC;AAChF,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAc;IAC1C,OAAO,KAAK,KAAK,eAAe,IAAI,KAAK,KAAK,UAAU,CAAC;AAC7D,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAc;IAC3C,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;QACxD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,GAAY,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,IAAI,KAAK,sBAAsB,IAAI,IAAI,KAAK,+BAA+B,CAAC;AACvF,CAAC;AAED,SAAS,gBAAgB,CAAC,cAAuB;IAC7C,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,CAAC;QAC9E,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED,OAAO,cAAc,CAAC,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