packtory 0.0.8 → 0.0.10
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 +7 -5
- package/artifacts/artifacts-builder.d.ts.map +1 -1
- package/artifacts/artifacts-builder.js +1 -47
- package/artifacts/artifacts-builder.js.map +1 -1
- package/bundle-emitter/emitter.d.ts +12 -2
- package/bundle-emitter/emitter.d.ts.map +1 -1
- package/bundle-emitter/emitter.js +2 -31
- package/bundle-emitter/emitter.js.map +1 -1
- package/bundle-emitter/extract-package-tarball.js +0 -12
- package/bundle-emitter/extract-package-tarball.js.map +1 -1
- package/bundle-emitter/publish-settings-bridge.js +133 -0
- package/bundle-emitter/publish-settings-bridge.js.map +1 -0
- package/bundle-emitter/registry-client.d.ts +13 -6
- package/bundle-emitter/registry-client.d.ts.map +1 -1
- package/bundle-emitter/registry-client.js +1 -90
- package/bundle-emitter/registry-client.js.map +1 -1
- package/bundle-emitter/repository-coherence.js +54 -0
- package/bundle-emitter/repository-coherence.js.map +1 -0
- package/bundle-emitter/repository-url-normalizer.js +2 -0
- package/bundle-emitter/repository-url-normalizer.js.map +1 -0
- package/checks/check-runner.js +1 -12
- package/checks/check-runner.js.map +1 -1
- package/checks/rule.js +5 -0
- package/checks/rule.js.map +1 -0
- package/checks/rules/max-bundle-size.js +9 -0
- package/checks/rules/max-bundle-size.js.map +1 -0
- package/checks/rules/no-dev-dependency-imports.js +9 -0
- package/checks/rules/no-dev-dependency-imports.js.map +1 -0
- package/checks/rules/no-duplicated-files.js +6 -38
- package/checks/rules/no-duplicated-files.js.map +1 -1
- package/checks/rules/no-side-effects.js +9 -0
- package/checks/rules/no-side-effects.js.map +1 -0
- package/checks/rules/no-unused-bundle-dependencies.js +9 -0
- package/checks/rules/no-unused-bundle-dependencies.js.map +1 -0
- package/checks/rules/registry.js +8 -0
- package/checks/rules/registry.js.map +1 -0
- package/checks/rules/required-files.js +10 -0
- package/checks/rules/required-files.js.map +1 -0
- package/checks/rules/unique-target-paths.js +9 -0
- package/checks/rules/unique-target-paths.js.map +1 -0
- package/common/clock.d.ts +7 -0
- package/common/clock.d.ts.map +1 -0
- package/common/clock.js +11 -0
- package/common/clock.js.map +1 -0
- package/common/code-files.js +5 -0
- package/common/code-files.js.map +1 -0
- package/config/additional-files.js +0 -4
- package/config/additional-files.js.map +1 -1
- package/config/additional-package-json-attributes-schema.js +7 -0
- package/config/additional-package-json-attributes-schema.js.map +1 -0
- package/config/automatic-versioning-settings.js +3 -0
- package/config/automatic-versioning-settings.js.map +1 -0
- package/config/checks-schema.d.ts +74 -0
- package/config/checks-schema.d.ts.map +1 -0
- package/config/checks-schema.js +27 -0
- package/config/checks-schema.js.map +1 -0
- package/config/common-package-settings-schemas.js +20 -0
- package/config/common-package-settings-schemas.js.map +1 -0
- package/config/config.d.ts +16 -704
- package/config/config.d.ts.map +1 -1
- package/config/config.js +1 -71
- package/config/config.js.map +1 -1
- package/config/dead-code-elimination-settings.d.ts +12 -0
- package/config/dead-code-elimination-settings.d.ts.map +1 -0
- package/config/dead-code-elimination-settings.js +3 -0
- package/config/dead-code-elimination-settings.js.map +1 -0
- package/config/dependency-policy.d.ts +6 -0
- package/config/dependency-policy.d.ts.map +1 -0
- package/config/dependency-policy.js +3 -0
- package/config/dependency-policy.js.map +1 -0
- package/config/main-package-json-schema.js +13 -0
- package/config/main-package-json-schema.js.map +1 -0
- package/config/manual-versioning-settings.js +3 -0
- package/config/manual-versioning-settings.js.map +1 -0
- package/config/optional-package-settings-schema.js +15 -0
- package/config/optional-package-settings-schema.js.map +1 -0
- package/config/package-config.d.ts +49 -0
- package/config/package-config.d.ts.map +1 -0
- package/config/package-config.js +1 -0
- package/config/package-config.js.map +1 -0
- package/config/package-interface.d.ts +36 -0
- package/config/package-interface.d.ts.map +1 -0
- package/config/package-interface.js +3 -0
- package/config/package-interface.js.map +1 -0
- package/config/package-json.d.ts +10 -10
- package/config/package-json.d.ts.map +1 -1
- package/config/package-json.js +0 -24
- package/config/package-json.js.map +1 -1
- package/config/package-schemas.js +10 -0
- package/config/package-schemas.js.map +1 -0
- package/config/packtory-config-schema.js +4 -0
- package/config/packtory-config-schema.js.map +1 -0
- package/config/packtory-config-without-registry-schema.js +32 -0
- package/config/packtory-config-without-registry-schema.js.map +1 -0
- package/config/per-package-settings-schema.js +22 -0
- package/config/per-package-settings-schema.js.map +1 -0
- package/config/publish-settings.d.ts +22 -0
- package/config/publish-settings.d.ts.map +1 -0
- package/config/publish-settings.js +4 -0
- package/config/publish-settings.js.map +1 -0
- package/config/publish-settings.report.js +17 -0
- package/config/publish-settings.report.js.map +1 -0
- package/config/registry-settings.d.ts +63 -1
- package/config/registry-settings.d.ts.map +1 -1
- package/config/registry-settings.js +0 -4
- package/config/registry-settings.js.map +1 -1
- package/config/registry-settings.report.js +41 -0
- package/config/registry-settings.report.js.map +1 -0
- package/config/root.d.ts +7 -0
- package/config/root.d.ts.map +1 -0
- package/config/root.js +3 -0
- package/config/root.js.map +1 -0
- package/config/sbom-settings.js +2 -0
- package/config/sbom-settings.js.map +1 -0
- package/config/validation.d.ts +2 -2
- package/config/validation.d.ts.map +1 -1
- package/config/validation.js +4 -118
- package/config/validation.js.map +1 -1
- package/config/versioning-settings.d.ts.map +1 -1
- package/config/versioning-settings.js +2 -10
- package/config/versioning-settings.js.map +1 -1
- package/dead-code-eliminator/analyzed-bundle.d.ts +29 -0
- package/dead-code-eliminator/analyzed-bundle.d.ts.map +1 -0
- package/dead-code-eliminator/analyzed-bundle.js +1 -0
- package/dead-code-eliminator/analyzed-bundle.js.map +1 -0
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +126 -0
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -0
- package/dead-code-eliminator/elimination-emitter.js +53 -0
- package/dead-code-eliminator/elimination-emitter.js.map +1 -0
- package/dead-code-eliminator/eliminator.js +142 -0
- package/dead-code-eliminator/eliminator.js.map +1 -0
- package/dead-code-eliminator/load-bundle.js +53 -0
- package/dead-code-eliminator/load-bundle.js.map +1 -0
- package/dead-code-eliminator/reachability/binding-extractor.js +88 -0
- package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -0
- package/dead-code-eliminator/reachability/impure-statements.js +12 -0
- package/dead-code-eliminator/reachability/impure-statements.js.map +1 -0
- package/dead-code-eliminator/reachability/reachability.js +141 -0
- package/dead-code-eliminator/reachability/reachability.js.map +1 -0
- package/dead-code-eliminator/side-effect-classifier.js +406 -0
- package/dead-code-eliminator/side-effect-classifier.js.map +1 -0
- package/dead-code-eliminator/side-effects-field.js +25 -0
- package/dead-code-eliminator/side-effects-field.js.map +1 -0
- package/dead-code-eliminator/transform/atom-translator.js +13 -0
- package/dead-code-eliminator/transform/atom-translator.js.map +1 -0
- package/dead-code-eliminator/transform/declaration-remover.js +92 -0
- package/dead-code-eliminator/transform/declaration-remover.js.map +1 -0
- package/dead-code-eliminator/transform/line-index.js +27 -0
- package/dead-code-eliminator/transform/line-index.js.map +1 -0
- package/dead-code-eliminator/transform/source-map-composer.js +68 -0
- package/dead-code-eliminator/transform/source-map-composer.js.map +1 -0
- package/dependency-scanner/dependency-graph.d.ts +1 -3
- package/dependency-scanner/dependency-graph.d.ts.map +1 -1
- package/dependency-scanner/dependency-graph.js +1 -76
- package/dependency-scanner/dependency-graph.js.map +1 -1
- package/dependency-scanner/external-dependencies.d.ts +0 -1
- package/dependency-scanner/external-dependencies.d.ts.map +1 -1
- package/dependency-scanner/external-dependencies.js +1 -17
- package/dependency-scanner/external-dependencies.js.map +1 -1
- package/dependency-scanner/scanner.d.ts +7 -7
- package/dependency-scanner/scanner.d.ts.map +1 -1
- package/dependency-scanner/scanner.js +1 -75
- package/dependency-scanner/scanner.js.map +1 -1
- package/dependency-scanner/source-file-references.js +2 -73
- package/dependency-scanner/source-file-references.js.map +1 -1
- package/dependency-scanner/source-map-file-locator.d.ts.map +1 -1
- package/dependency-scanner/source-map-file-locator.js +0 -20
- package/dependency-scanner/source-map-file-locator.js.map +1 -1
- package/dependency-scanner/typescript-file-host.d.ts +2 -0
- package/dependency-scanner/typescript-file-host.d.ts.map +1 -1
- package/dependency-scanner/typescript-file-host.js +1 -48
- package/dependency-scanner/typescript-file-host.js.map +1 -1
- package/dependency-scanner/typescript-project-analyzer.d.ts +4 -6
- package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -1
- package/dependency-scanner/typescript-project-analyzer.js +0 -64
- package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
- package/directed-graph/graph.d.ts +1 -2
- package/directed-graph/graph.d.ts.map +1 -1
- package/directed-graph/graph.js +0 -194
- package/directed-graph/graph.js.map +1 -1
- package/file-manager/compare.js +1 -16
- package/file-manager/compare.js.map +1 -1
- package/file-manager/equal.js +0 -5
- package/file-manager/equal.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 +0 -46
- package/file-manager/file-manager.js.map +1 -1
- package/file-manager/permissions.js +0 -12
- package/file-manager/permissions.js.map +1 -1
- package/linker/linked-bundle.d.ts +5 -3
- package/linker/linked-bundle.d.ts.map +1 -1
- package/linker/linker.d.ts.map +1 -1
- package/linker/linker.js +0 -22
- package/linker/linker.js.map +1 -1
- package/linker/resource-graph.js +1 -29
- package/linker/resource-graph.js.map +1 -1
- package/linker/source-modifier/import-paths.js +0 -33
- package/linker/source-modifier/import-paths.js.map +1 -1
- package/linker/substitute-bundles.js +1 -73
- package/linker/substitute-bundles.js.map +1 -1
- package/linker/substituted-resource-graph.js +1 -76
- package/linker/substituted-resource-graph.js.map +1 -1
- package/npm-oidc-id-token-resolver.js +56 -0
- package/npm-oidc-id-token-resolver.js.map +1 -0
- package/package-surface/modules.js +89 -0
- package/package-surface/modules.js.map +1 -0
- package/package-surface/public-module-usage.js +37 -0
- package/package-surface/public-module-usage.js.map +1 -0
- package/package-surface/surface.d.ts +12 -0
- package/package-surface/surface.d.ts.map +1 -0
- package/package-surface/surface.js +1 -0
- package/package-surface/surface.js.map +1 -0
- package/package.json +53 -11
- package/packages/package-processor.composition.js +127 -0
- package/packages/package-processor.composition.js.map +1 -0
- package/packages/packtory/packtory.entry-point.d.ts +10 -5
- package/packages/packtory/packtory.entry-point.d.ts.map +1 -1
- package/packages/packtory/packtory.entry-point.js +7 -43
- package/packages/packtory/packtory.entry-point.js.map +1 -1
- package/packtory/map-config.d.ts +7 -16
- package/packtory/map-config.d.ts.map +1 -1
- package/packtory/map-config.js +1 -70
- package/packtory/map-config.js.map +1 -1
- package/packtory/normalize-paths.js +0 -24
- package/packtory/normalize-paths.js.map +1 -1
- package/packtory/package-processor-build.js +3 -0
- package/packtory/package-processor-build.js.map +1 -0
- package/packtory/package-processor-publish.d.ts +18 -0
- package/packtory/package-processor-publish.d.ts.map +1 -0
- package/packtory/package-processor-publish.js +1 -0
- package/packtory/package-processor-publish.js.map +1 -0
- package/packtory/package-processor.d.ts +17 -21
- package/packtory/package-processor.d.ts.map +1 -1
- package/packtory/package-processor.js +2 -85
- package/packtory/package-processor.js.map +1 -1
- package/packtory/packtory-publish.js +66 -0
- package/packtory/packtory-publish.js.map +1 -0
- package/packtory/packtory-resolve.js +84 -0
- package/packtory/packtory-resolve.js.map +1 -0
- package/packtory/packtory-results.d.ts +47 -0
- package/packtory/packtory-results.d.ts.map +1 -0
- package/packtory/packtory-results.js +1 -0
- package/packtory/packtory-results.js.map +1 -0
- package/packtory/packtory.d.ts +16 -37
- package/packtory/packtory.d.ts.map +1 -1
- package/packtory/packtory.js +33 -114
- package/packtory/packtory.js.map +1 -1
- package/packtory/prepare-package-options.d.ts +16 -0
- package/packtory/prepare-package-options.d.ts.map +1 -0
- package/packtory/prepare-package-options.js +5 -0
- package/packtory/prepare-package-options.js.map +1 -0
- package/packtory/report-attachment.js +25 -0
- package/packtory/report-attachment.js.map +1 -0
- package/packtory/resolved-package.d.ts +17 -0
- package/packtory/resolved-package.d.ts.map +1 -0
- package/packtory/resolved-package.js +4 -0
- package/packtory/resolved-package.js.map +1 -0
- package/packtory/scheduler.d.ts.map +1 -1
- package/packtory/scheduler.js +17 -15
- package/packtory/scheduler.js.map +1 -1
- package/progress/progress-broadcaster.d.ts +128 -5
- package/progress/progress-broadcaster.d.ts.map +1 -1
- package/progress/progress-broadcaster.js +0 -16
- package/progress/progress-broadcaster.js.map +1 -1
- package/report/artifact-entry-merger.js +2 -0
- package/report/artifact-entry-merger.js.map +1 -0
- package/report/config-redactor.js +27 -0
- package/report/config-redactor.js.map +1 -0
- package/report/decorators.js +68 -0
- package/report/decorators.js.map +1 -0
- package/report/inspectors.js +1 -0
- package/report/inspectors.js.map +1 -0
- package/report/report-aggregator.d.ts +61 -0
- package/report/report-aggregator.d.ts.map +1 -0
- package/report/report-aggregator.js +2 -0
- package/report/report-aggregator.js.map +1 -0
- package/resource-resolver/content.js +1 -40
- package/resource-resolver/content.js.map +1 -1
- package/resource-resolver/resolved-bundle.d.ts +4 -2
- package/resource-resolver/resolved-bundle.d.ts.map +1 -1
- package/resource-resolver/resource-resolve-options.d.ts +12 -5
- package/resource-resolver/resource-resolve-options.d.ts.map +1 -1
- package/resource-resolver/resource-resolve-options.js +2 -0
- package/resource-resolver/resource-resolve-options.js.map +1 -0
- package/resource-resolver/resource-resolver.d.ts +1 -1
- package/resource-resolver/resource-resolver.d.ts.map +1 -1
- package/resource-resolver/resource-resolver.js +1 -64
- package/resource-resolver/resource-resolver.js.map +1 -1
- package/sbom/extract-license.js +2 -0
- package/sbom/extract-license.js.map +1 -0
- package/sbom/license-resolver.d.ts +14 -0
- package/sbom/license-resolver.d.ts.map +1 -0
- package/sbom/license-resolver.js +3 -0
- package/sbom/license-resolver.js.map +1 -0
- package/sbom/sbom-builder.js +68 -0
- package/sbom/sbom-builder.js.map +1 -0
- package/sbom/sbom-file.d.ts +19 -0
- package/sbom/sbom-file.d.ts.map +1 -0
- package/sbom/sbom-file.js +3 -0
- package/sbom/sbom-file.js.map +1 -0
- package/sbom/sbom-serializer.d.ts +6 -0
- package/sbom/sbom-serializer.d.ts.map +1 -0
- package/sbom/sbom-serializer.js +2 -0
- package/sbom/sbom-serializer.js.map +1 -0
- package/sbom/tool-version.js +44 -0
- package/sbom/tool-version.js.map +1 -0
- package/sbom.cdx.json +390 -0
- package/tar/extract-tar.js +0 -13
- package/tar/extract-tar.js.map +1 -1
- package/tar/tarball-builder.d.ts.map +1 -1
- package/tar/tarball-builder.js +10 -7
- package/tar/tarball-builder.js.map +1 -1
- package/version-manager/manager.d.ts +5 -1
- package/version-manager/manager.d.ts.map +1 -1
- package/version-manager/manager.js +1 -39
- package/version-manager/manager.js.map +1 -1
- package/version-manager/manifest/builder.js +2 -12
- package/version-manager/manifest/builder.js.map +1 -1
- package/version-manager/manifest/serialize.js +1 -55
- package/version-manager/manifest/serialize.js.map +1 -1
- package/version-manager/manifest/sort-values.js +1 -0
- package/version-manager/manifest/sort-values.js.map +1 -0
- package/version-manager/specifier-classifier.js +2 -0
- package/version-manager/specifier-classifier.js.map +1 -0
- package/version-manager/specifier-errors.js +1 -0
- package/version-manager/specifier-errors.js.map +1 -0
- package/version-manager/versioned-bundle-dependencies.js +5 -0
- package/version-manager/versioned-bundle-dependencies.js.map +1 -0
- package/version-manager/versioned-bundle-imports.d.ts +4 -0
- package/version-manager/versioned-bundle-imports.d.ts.map +1 -0
- package/version-manager/versioned-bundle-imports.js +3 -0
- package/version-manager/versioned-bundle-imports.js.map +1 -0
- package/version-manager/versioned-bundle.d.ts +16 -9
- package/version-manager/versioned-bundle.d.ts.map +1 -1
- package/version-manager/versioned-bundle.js +4 -78
- package/version-manager/versioned-bundle.js.map +1 -1
- package/config/entry-point.d.ts +0 -7
- package/config/entry-point.d.ts.map +0 -1
- package/config/entry-point.js +0 -7
- package/config/entry-point.js.map +0 -1
- package/file-manager/sort.js +0 -13
- package/file-manager/sort.js.map +0 -1
- package/list/unique-list.js +0 -5
- package/list/unique-list.js.map +0 -1
- package/version-manager/manifest/builder.d.ts +0 -5
- package/version-manager/manifest/builder.d.ts.map +0 -1
|
@@ -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;AAEF,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,2BAA2B,GAAG,eAAe,CAqBhG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license-resolver.js","sourceRoot":"","sources":["../../../../source/sbom/license-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW;AAE5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
const componentScopeByKind = {
|
|
16
|
+
peer: cdx.Enums.ComponentScope.Optional,
|
|
17
|
+
runtime: cdx.Enums.ComponentScope.Required
|
|
18
|
+
};
|
|
19
|
+
function scopeFor(kind) {
|
|
20
|
+
return componentScopeByKind[kind];
|
|
21
|
+
}
|
|
22
|
+
function attachLicense(component, license) {
|
|
23
|
+
if (license === undefined) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (isParseableSpdxExpression(license)) {
|
|
27
|
+
component.licenses.add(new cdx.Models.LicenseExpression(license));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
component.licenses.add(new cdx.Models.NamedLicense(license));
|
|
31
|
+
}
|
|
32
|
+
function buildRootComponent(rootComponent) {
|
|
33
|
+
const purl = buildPurl(rootComponent.name, rootComponent.version);
|
|
34
|
+
return new cdx.Models.Component(cdx.Enums.ComponentType.Library, rootComponent.name, {
|
|
35
|
+
version: rootComponent.version,
|
|
36
|
+
bomRef: purl,
|
|
37
|
+
purl
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function buildDependencyComponent(dependency) {
|
|
41
|
+
const purl = buildPurl(dependency.name, dependency.specifier);
|
|
42
|
+
const component = new cdx.Models.Component(cdx.Enums.ComponentType.Library, dependency.name, {
|
|
43
|
+
version: dependency.specifier,
|
|
44
|
+
bomRef: purl,
|
|
45
|
+
purl,
|
|
46
|
+
scope: scopeFor(dependency.kind)
|
|
47
|
+
});
|
|
48
|
+
attachLicense(component, dependency.license);
|
|
49
|
+
return component;
|
|
50
|
+
}
|
|
51
|
+
function buildToolComponent(toolVersion) {
|
|
52
|
+
return new cdx.Models.Component(cdx.Enums.ComponentType.Application, 'packtory', {
|
|
53
|
+
version: toolVersion
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export function buildSbom(options) {
|
|
57
|
+
const bom = new cdx.Models.Bom();
|
|
58
|
+
bom.metadata.tools.components.add(buildToolComponent(options.toolVersion));
|
|
59
|
+
const rootComponent = buildRootComponent(options.rootComponent);
|
|
60
|
+
bom.metadata.component = rootComponent;
|
|
61
|
+
for (const dependency of options.dependencies) {
|
|
62
|
+
const component = buildDependencyComponent(dependency);
|
|
63
|
+
bom.components.add(component);
|
|
64
|
+
rootComponent.dependencies.add(component.bomRef);
|
|
65
|
+
}
|
|
66
|
+
return bom;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=sbom-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sbom-builder.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-builder.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PublishSettings } from '../config/publish-settings.ts';
|
|
2
|
+
import type { FileDescription } from '../file-manager/file-description.ts';
|
|
3
|
+
import type { VersionedBundleWithManifest } from '../version-manager/versioned-bundle.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
|
+
};
|
|
13
|
+
type SbomSibling = Pick<VersionedBundleWithManifest, 'name' | 'packageJson'>;
|
|
14
|
+
export type SbomFileBuilder = {
|
|
15
|
+
generate: (bundle: VersionedBundleWithManifest, siblings: readonly SbomSibling[], publishSettings: PublishSettings) => Promise<readonly FileDescription[] | undefined>;
|
|
16
|
+
};
|
|
17
|
+
export declare function createSbomFileBuilder(dependencies: SbomFileBuilderDependencies): SbomFileBuilder;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=sbom-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sbom-file.d.ts","sourceRoot":"","sources":["../../../../source/sbom/sbom-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAE1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D,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,KAAK,WAAW,GAAG,IAAI,CAAC,2BAA2B,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC;AAE7E,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,EAAE,CACN,MAAM,EAAE,2BAA2B,EACnC,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,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,CAqDhG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sbom-file.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-file.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB;AAGjE,OAAO,EAAE,SAAS,EAAgD,MAAM,mBAAmB"}
|
|
@@ -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,MAAM,MAAM,cAAc,GAAG;IACzB,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC;CAC9C,CAAC;AAEF,wBAAgB,oBAAoB,IAAI,cAAc,CASrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sbom-serializer.js","sourceRoot":"","sources":["../../../../source/sbom/sbom-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,8BAA8B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { isPlainObject } from 'remeda';
|
|
2
|
+
const candidatePackageNames = ['@packtory/cli', 'packtory'];
|
|
3
|
+
const nodeModulesSegment = 'node_modules';
|
|
4
|
+
const pathSeparators = /[/\\]/u;
|
|
5
|
+
function isInsideNodeModules(filePath) {
|
|
6
|
+
return filePath.split(pathSeparators).includes(nodeModulesSegment);
|
|
7
|
+
}
|
|
8
|
+
function buildUnresolvableMessage() {
|
|
9
|
+
const intro = 'Cannot determine packtory tool version: neither "@packtory/cli" nor "packtory" is resolvable.';
|
|
10
|
+
return `${intro} Install packtory via npm so it lives under node_modules/.`;
|
|
11
|
+
}
|
|
12
|
+
function buildOutsideNodeModulesMessage(packageJsonPath) {
|
|
13
|
+
const intro = `Refusing to read packtory tool version from "${packageJsonPath}":`;
|
|
14
|
+
const reason = 'the resolved package.json is not inside a node_modules folder.';
|
|
15
|
+
return `${intro} ${reason} Install packtory via npm to make its real version available.`;
|
|
16
|
+
}
|
|
17
|
+
function findInstalledPackagePath(resolvePackagePath) {
|
|
18
|
+
for (const candidatePackageName of candidatePackageNames) {
|
|
19
|
+
const resolved = resolvePackagePath(`${candidatePackageName}/package.json`);
|
|
20
|
+
if (resolved !== undefined) {
|
|
21
|
+
return resolved;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
export function createPacktoryToolVersionResolver(dependencies) {
|
|
27
|
+
const { fileManager, resolvePackagePath } = dependencies;
|
|
28
|
+
return async function resolvePacktoryToolVersion() {
|
|
29
|
+
const packageJsonPath = findInstalledPackagePath(resolvePackagePath);
|
|
30
|
+
if (packageJsonPath === undefined) {
|
|
31
|
+
throw new Error(buildUnresolvableMessage());
|
|
32
|
+
}
|
|
33
|
+
if (!isInsideNodeModules(packageJsonPath)) {
|
|
34
|
+
throw new Error(buildOutsideNodeModulesMessage(packageJsonPath));
|
|
35
|
+
}
|
|
36
|
+
const content = await fileManager.readFile(packageJsonPath);
|
|
37
|
+
const parsed = JSON.parse(content);
|
|
38
|
+
if (!isPlainObject(parsed) || typeof parsed.version !== 'string') {
|
|
39
|
+
throw new Error(`Resolved packtory package.json at "${packageJsonPath}" is missing a version field`);
|
|
40
|
+
}
|
|
41
|
+
return parsed.version;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=tool-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-version.js","sourceRoot":"","sources":["../../../../source/sbom/tool-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAGvC,MAAM,qBAAqB,GAAG,CAAC,eAAe,EAAE,UAAU,CAAU,CAAC;AACrE,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAC1C,MAAM,cAAc,GAAG,QAAQ,CAAC;AAOhC,SAAS,mBAAmB,CAAC,QAAgB;IACzC,OAAO,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,wBAAwB;IAC7B,MAAM,KAAK,GAAG,+FAA+F,CAAC;IAC9G,OAAO,GAAG,KAAK,4DAA4D,CAAC;AAChF,CAAC;AAED,SAAS,8BAA8B,CAAC,eAAuB;IAC3D,MAAM,KAAK,GAAG,gDAAgD,eAAe,IAAI,CAAC;IAClF,MAAM,MAAM,GAAG,gEAAgE,CAAC;IAChF,OAAO,GAAG,KAAK,IAAI,MAAM,+DAA+D,CAAC;AAC7F,CAAC;AAED,SAAS,wBAAwB,CAC7B,kBAAyE;IAEzE,KAAK,MAAM,oBAAoB,IAAI,qBAAqB,EAAE,CAAC;QACvD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,GAAG,oBAAoB,eAAe,CAAC,CAAC;QAC5E,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,QAAQ,CAAC;QACpB,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC7C,YAA6C;IAE7C,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAC;IAEzD,OAAO,KAAK,UAAU,0BAA0B;QAC5C,MAAM,eAAe,GAAG,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;QACrE,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,wBAAwB,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,eAAe,CAAC,CAAC,CAAC;QACrE,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC/D,MAAM,IAAI,KAAK,CAAC,sCAAsC,eAAe,8BAA8B,CAAC,CAAC;QACzG,CAAC;QACD,OAAO,MAAM,CAAC,OAAO,CAAC;IAC1B,CAAC,CAAC;AACN,CAAC"}
|
package/sbom.cdx.json
ADDED
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
|
|
3
|
+
"bomFormat": "CycloneDX",
|
|
4
|
+
"specVersion": "1.6",
|
|
5
|
+
"version": 1,
|
|
6
|
+
"metadata": {
|
|
7
|
+
"tools": {
|
|
8
|
+
"components": [
|
|
9
|
+
{
|
|
10
|
+
"type": "application",
|
|
11
|
+
"name": "packtory",
|
|
12
|
+
"version": "0.0.9"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"component": {
|
|
17
|
+
"type": "library",
|
|
18
|
+
"name": "packtory",
|
|
19
|
+
"version": "0.0.10",
|
|
20
|
+
"bom-ref": "pkg:npm/packtory@0.0.10",
|
|
21
|
+
"purl": "pkg:npm/packtory@0.0.10"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"components": [
|
|
25
|
+
{
|
|
26
|
+
"type": "library",
|
|
27
|
+
"name": "@cyclonedx/cyclonedx-library",
|
|
28
|
+
"version": "10.0.0",
|
|
29
|
+
"bom-ref": "pkg:npm/@cyclonedx/cyclonedx-library@10.0.0",
|
|
30
|
+
"scope": "required",
|
|
31
|
+
"licenses": [
|
|
32
|
+
{
|
|
33
|
+
"expression": "Apache-2.0"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"purl": "pkg:npm/@cyclonedx/cyclonedx-library@10.0.0"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "library",
|
|
40
|
+
"name": "@jridgewell/gen-mapping",
|
|
41
|
+
"version": "0.3.13",
|
|
42
|
+
"bom-ref": "pkg:npm/@jridgewell/gen-mapping@0.3.13",
|
|
43
|
+
"scope": "required",
|
|
44
|
+
"licenses": [
|
|
45
|
+
{
|
|
46
|
+
"expression": "MIT"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"purl": "pkg:npm/@jridgewell/gen-mapping@0.3.13"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "library",
|
|
53
|
+
"name": "@jridgewell/trace-mapping",
|
|
54
|
+
"version": "0.3.31",
|
|
55
|
+
"bom-ref": "pkg:npm/@jridgewell/trace-mapping@0.3.31",
|
|
56
|
+
"scope": "required",
|
|
57
|
+
"licenses": [
|
|
58
|
+
{
|
|
59
|
+
"expression": "MIT"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"purl": "pkg:npm/@jridgewell/trace-mapping@0.3.31"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "library",
|
|
66
|
+
"name": "@schema-hub/zod-error-formatter",
|
|
67
|
+
"version": "0.0.11",
|
|
68
|
+
"bom-ref": "pkg:npm/@schema-hub/zod-error-formatter@0.0.11",
|
|
69
|
+
"scope": "required",
|
|
70
|
+
"licenses": [
|
|
71
|
+
{
|
|
72
|
+
"expression": "MIT"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"purl": "pkg:npm/@schema-hub/zod-error-formatter@0.0.11"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "library",
|
|
79
|
+
"name": "@ts-morph/common",
|
|
80
|
+
"version": "0.29.0",
|
|
81
|
+
"bom-ref": "pkg:npm/@ts-morph/common@0.29.0",
|
|
82
|
+
"scope": "required",
|
|
83
|
+
"licenses": [
|
|
84
|
+
{
|
|
85
|
+
"expression": "MIT"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"purl": "pkg:npm/@ts-morph/common@0.29.0"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"type": "library",
|
|
92
|
+
"name": "@types/libnpmpublish",
|
|
93
|
+
"version": "9.0.1",
|
|
94
|
+
"bom-ref": "pkg:npm/@types/libnpmpublish@9.0.1",
|
|
95
|
+
"scope": "required",
|
|
96
|
+
"licenses": [
|
|
97
|
+
{
|
|
98
|
+
"expression": "MIT"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"purl": "pkg:npm/@types/libnpmpublish@9.0.1"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"type": "library",
|
|
105
|
+
"name": "@types/npm-registry-fetch",
|
|
106
|
+
"version": "8.0.9",
|
|
107
|
+
"bom-ref": "pkg:npm/@types/npm-registry-fetch@8.0.9",
|
|
108
|
+
"scope": "required",
|
|
109
|
+
"licenses": [
|
|
110
|
+
{
|
|
111
|
+
"expression": "MIT"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"purl": "pkg:npm/@types/npm-registry-fetch@8.0.9"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"type": "library",
|
|
118
|
+
"name": "common-tags",
|
|
119
|
+
"version": "1.8.2",
|
|
120
|
+
"bom-ref": "pkg:npm/common-tags@1.8.2",
|
|
121
|
+
"scope": "required",
|
|
122
|
+
"licenses": [
|
|
123
|
+
{
|
|
124
|
+
"expression": "MIT"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"purl": "pkg:npm/common-tags@1.8.2"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"type": "library",
|
|
131
|
+
"name": "hosted-git-info",
|
|
132
|
+
"version": "10.1.0",
|
|
133
|
+
"bom-ref": "pkg:npm/hosted-git-info@10.1.0",
|
|
134
|
+
"scope": "required",
|
|
135
|
+
"licenses": [
|
|
136
|
+
{
|
|
137
|
+
"expression": "ISC"
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"purl": "pkg:npm/hosted-git-info@10.1.0"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"type": "library",
|
|
144
|
+
"name": "libnpmpublish",
|
|
145
|
+
"version": "11.1.3",
|
|
146
|
+
"bom-ref": "pkg:npm/libnpmpublish@11.1.3",
|
|
147
|
+
"scope": "required",
|
|
148
|
+
"licenses": [
|
|
149
|
+
{
|
|
150
|
+
"expression": "ISC"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"purl": "pkg:npm/libnpmpublish@11.1.3"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"type": "library",
|
|
157
|
+
"name": "npm-package-arg",
|
|
158
|
+
"version": "14.0.0",
|
|
159
|
+
"bom-ref": "pkg:npm/npm-package-arg@14.0.0",
|
|
160
|
+
"scope": "required",
|
|
161
|
+
"licenses": [
|
|
162
|
+
{
|
|
163
|
+
"expression": "ISC"
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"purl": "pkg:npm/npm-package-arg@14.0.0"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"type": "library",
|
|
170
|
+
"name": "npm-registry-fetch",
|
|
171
|
+
"version": "19.1.1",
|
|
172
|
+
"bom-ref": "pkg:npm/npm-registry-fetch@19.1.1",
|
|
173
|
+
"scope": "required",
|
|
174
|
+
"licenses": [
|
|
175
|
+
{
|
|
176
|
+
"expression": "ISC"
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
"purl": "pkg:npm/npm-registry-fetch@19.1.1"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"type": "library",
|
|
183
|
+
"name": "remeda",
|
|
184
|
+
"version": "2.34.1",
|
|
185
|
+
"bom-ref": "pkg:npm/remeda@2.34.1",
|
|
186
|
+
"scope": "required",
|
|
187
|
+
"licenses": [
|
|
188
|
+
{
|
|
189
|
+
"expression": "MIT"
|
|
190
|
+
}
|
|
191
|
+
],
|
|
192
|
+
"purl": "pkg:npm/remeda@2.34.1"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"type": "library",
|
|
196
|
+
"name": "semver",
|
|
197
|
+
"version": "7.8.0",
|
|
198
|
+
"bom-ref": "pkg:npm/semver@7.8.0",
|
|
199
|
+
"scope": "required",
|
|
200
|
+
"licenses": [
|
|
201
|
+
{
|
|
202
|
+
"expression": "ISC"
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
"purl": "pkg:npm/semver@7.8.0"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"type": "library",
|
|
209
|
+
"name": "spdx-expression-parse",
|
|
210
|
+
"version": "4.0.0",
|
|
211
|
+
"bom-ref": "pkg:npm/spdx-expression-parse@4.0.0",
|
|
212
|
+
"scope": "required",
|
|
213
|
+
"licenses": [
|
|
214
|
+
{
|
|
215
|
+
"expression": "MIT"
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
"purl": "pkg:npm/spdx-expression-parse@4.0.0"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"type": "library",
|
|
222
|
+
"name": "tar-stream",
|
|
223
|
+
"version": "3.1.8",
|
|
224
|
+
"bom-ref": "pkg:npm/tar-stream@3.1.8",
|
|
225
|
+
"scope": "required",
|
|
226
|
+
"licenses": [
|
|
227
|
+
{
|
|
228
|
+
"expression": "MIT"
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"purl": "pkg:npm/tar-stream@3.1.8"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"type": "library",
|
|
235
|
+
"name": "true-myth",
|
|
236
|
+
"version": "9.3.1",
|
|
237
|
+
"bom-ref": "pkg:npm/true-myth@9.3.1",
|
|
238
|
+
"scope": "required",
|
|
239
|
+
"licenses": [
|
|
240
|
+
{
|
|
241
|
+
"expression": "MIT"
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
"purl": "pkg:npm/true-myth@9.3.1"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"type": "library",
|
|
248
|
+
"name": "ts-morph",
|
|
249
|
+
"version": "27.0.2",
|
|
250
|
+
"bom-ref": "pkg:npm/ts-morph@27.0.2",
|
|
251
|
+
"scope": "required",
|
|
252
|
+
"licenses": [
|
|
253
|
+
{
|
|
254
|
+
"expression": "MIT"
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"purl": "pkg:npm/ts-morph@27.0.2"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"type": "library",
|
|
261
|
+
"name": "type-fest",
|
|
262
|
+
"version": "5.6.0",
|
|
263
|
+
"bom-ref": "pkg:npm/type-fest@5.6.0",
|
|
264
|
+
"scope": "required",
|
|
265
|
+
"licenses": [
|
|
266
|
+
{
|
|
267
|
+
"expression": "(MIT OR CC0-1.0)"
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
"purl": "pkg:npm/type-fest@5.6.0"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"type": "library",
|
|
274
|
+
"name": "unix-permissions",
|
|
275
|
+
"version": "6.0.1",
|
|
276
|
+
"bom-ref": "pkg:npm/unix-permissions@6.0.1",
|
|
277
|
+
"scope": "required",
|
|
278
|
+
"licenses": [
|
|
279
|
+
{
|
|
280
|
+
"expression": "Apache-2.0"
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
"purl": "pkg:npm/unix-permissions@6.0.1"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"type": "library",
|
|
287
|
+
"name": "zod",
|
|
288
|
+
"version": "4.4.3",
|
|
289
|
+
"bom-ref": "pkg:npm/zod@4.4.3",
|
|
290
|
+
"scope": "required",
|
|
291
|
+
"licenses": [
|
|
292
|
+
{
|
|
293
|
+
"expression": "MIT"
|
|
294
|
+
}
|
|
295
|
+
],
|
|
296
|
+
"purl": "pkg:npm/zod@4.4.3"
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
"dependencies": [
|
|
300
|
+
{
|
|
301
|
+
"ref": "pkg:npm/@cyclonedx/cyclonedx-library@10.0.0"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"ref": "pkg:npm/@jridgewell/gen-mapping@0.3.13"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"ref": "pkg:npm/@jridgewell/trace-mapping@0.3.31"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"ref": "pkg:npm/@schema-hub/zod-error-formatter@0.0.11"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"ref": "pkg:npm/@ts-morph/common@0.29.0"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"ref": "pkg:npm/@types/libnpmpublish@9.0.1"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"ref": "pkg:npm/@types/npm-registry-fetch@8.0.9"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"ref": "pkg:npm/common-tags@1.8.2"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"ref": "pkg:npm/hosted-git-info@10.1.0"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"ref": "pkg:npm/libnpmpublish@11.1.3"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"ref": "pkg:npm/npm-package-arg@14.0.0"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"ref": "pkg:npm/npm-registry-fetch@19.1.1"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"ref": "pkg:npm/packtory@0.0.10",
|
|
338
|
+
"dependsOn": [
|
|
339
|
+
"pkg:npm/@cyclonedx/cyclonedx-library@10.0.0",
|
|
340
|
+
"pkg:npm/@jridgewell/gen-mapping@0.3.13",
|
|
341
|
+
"pkg:npm/@jridgewell/trace-mapping@0.3.31",
|
|
342
|
+
"pkg:npm/@schema-hub/zod-error-formatter@0.0.11",
|
|
343
|
+
"pkg:npm/@ts-morph/common@0.29.0",
|
|
344
|
+
"pkg:npm/@types/libnpmpublish@9.0.1",
|
|
345
|
+
"pkg:npm/@types/npm-registry-fetch@8.0.9",
|
|
346
|
+
"pkg:npm/common-tags@1.8.2",
|
|
347
|
+
"pkg:npm/hosted-git-info@10.1.0",
|
|
348
|
+
"pkg:npm/libnpmpublish@11.1.3",
|
|
349
|
+
"pkg:npm/npm-package-arg@14.0.0",
|
|
350
|
+
"pkg:npm/npm-registry-fetch@19.1.1",
|
|
351
|
+
"pkg:npm/remeda@2.34.1",
|
|
352
|
+
"pkg:npm/semver@7.8.0",
|
|
353
|
+
"pkg:npm/spdx-expression-parse@4.0.0",
|
|
354
|
+
"pkg:npm/tar-stream@3.1.8",
|
|
355
|
+
"pkg:npm/true-myth@9.3.1",
|
|
356
|
+
"pkg:npm/ts-morph@27.0.2",
|
|
357
|
+
"pkg:npm/type-fest@5.6.0",
|
|
358
|
+
"pkg:npm/unix-permissions@6.0.1",
|
|
359
|
+
"pkg:npm/zod@4.4.3"
|
|
360
|
+
]
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"ref": "pkg:npm/remeda@2.34.1"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"ref": "pkg:npm/semver@7.8.0"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"ref": "pkg:npm/spdx-expression-parse@4.0.0"
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"ref": "pkg:npm/tar-stream@3.1.8"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"ref": "pkg:npm/true-myth@9.3.1"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"ref": "pkg:npm/ts-morph@27.0.2"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"ref": "pkg:npm/type-fest@5.6.0"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"ref": "pkg:npm/unix-permissions@6.0.1"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
"ref": "pkg:npm/zod@4.4.3"
|
|
388
|
+
}
|
|
389
|
+
]
|
|
390
|
+
}
|
package/tar/extract-tar.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
import { createGunzip } from 'node:zlib';
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
3
|
import { extract } from 'tar-stream';
|
|
4
|
-
export async function extractTarEntries(buffer) {
|
|
5
|
-
const extractStream = extract();
|
|
6
|
-
const stream = Readable.from(buffer).pipe(createGunzip()).pipe(extractStream);
|
|
7
|
-
const entries = [];
|
|
8
|
-
for await (const entry of stream) {
|
|
9
|
-
let result = '';
|
|
10
|
-
for await (const chunk of entry) {
|
|
11
|
-
result += chunk.toString();
|
|
12
|
-
}
|
|
13
|
-
entries.push({ header: entry.header, content: result });
|
|
14
|
-
}
|
|
15
|
-
return entries;
|
|
16
|
-
}
|
|
17
4
|
//# sourceMappingURL=extract-tar.js.map
|
package/tar/extract-tar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-tar.js","sourceRoot":"","sources":["../../../../source/tar/extract-tar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"extract-tar.js","sourceRoot":"","sources":["../../../../source/tar/extract-tar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa;AACtC,OAAO,EAAE,OAAO,EAAmC,MAAM,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tarball-builder.d.ts","sourceRoot":"","sources":["../../../../source/tar/tarball-builder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,MAAM,MAAM,cAAc,GAAG;IACzB,KAAK,EAAE,CAAC,gBAAgB,EAAE,SAAS,eAAe,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5E,CAAC;
|
|
1
|
+
{"version":3,"file":"tarball-builder.d.ts","sourceRoot":"","sources":["../../../../source/tar/tarball-builder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,MAAM,MAAM,cAAc,GAAG;IACzB,KAAK,EAAE,CAAC,gBAAgB,EAAE,SAAS,eAAe,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5E,CAAC;AAmBF,wBAAgB,oBAAoB,IAAI,cAAc,CAsCrD"}
|
package/tar/tarball-builder.js
CHANGED
|
@@ -2,9 +2,13 @@ import zlib from 'node:zlib';
|
|
|
2
2
|
import tar, {} from 'tar-stream';
|
|
3
3
|
const gzipHeaderOperationSystemTypeFieldIndex = 9;
|
|
4
4
|
const gzipHeaderOperationSystemTypeUnknown = 255;
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function normalizeGzipHeader(data) {
|
|
6
|
+
const normalizedData = Buffer.from(data);
|
|
7
|
+
normalizedData[gzipHeaderOperationSystemTypeFieldIndex] = gzipHeaderOperationSystemTypeUnknown;
|
|
8
|
+
return normalizedData;
|
|
9
|
+
}
|
|
10
|
+
function toBuffer(chunk) {
|
|
11
|
+
return Buffer.from(chunk);
|
|
8
12
|
}
|
|
9
13
|
const staticFileModificationTime = new Date(0);
|
|
10
14
|
const executableFileMode = 493;
|
|
@@ -30,12 +34,11 @@ export function createTarballBuilder() {
|
|
|
30
34
|
const tarballStream = pack.pipe(gzipStream);
|
|
31
35
|
const chunks = [];
|
|
32
36
|
for await (const chunk of tarballStream) {
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion --
|
|
34
|
-
chunks.push(chunk);
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- gzip stream yields buffers in this usage
|
|
38
|
+
chunks.push(toBuffer(chunk));
|
|
35
39
|
}
|
|
36
40
|
const tarData = Buffer.concat(chunks);
|
|
37
|
-
|
|
38
|
-
return tarData;
|
|
41
|
+
return normalizeGzipHeader(tarData);
|
|
39
42
|
}
|
|
40
43
|
};
|
|
41
44
|
}
|