packtory 0.0.15 → 0.0.16
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 +3 -1
- package/artifacts/artifacts-builder.d.ts.map +1 -1
- package/artifacts/artifacts-builder.js +20 -74
- package/artifacts/artifacts-builder.js.map +1 -1
- package/artifacts/content-collection.js +60 -0
- package/artifacts/content-collection.js.map +1 -0
- package/artifacts/folder-writer.js +24 -0
- package/artifacts/folder-writer.js.map +1 -0
- package/bundle-emitter/emitter.d.ts +3 -2
- package/bundle-emitter/emitter.d.ts.map +1 -1
- package/bundle-emitter/emitter.js +10 -8
- package/bundle-emitter/emitter.js.map +1 -1
- package/bundle-emitter/fetch-published-artifacts.d.ts +10 -0
- package/bundle-emitter/fetch-published-artifacts.d.ts.map +1 -0
- package/bundle-emitter/fetch-published-artifacts.js +16 -0
- package/bundle-emitter/fetch-published-artifacts.js.map +1 -0
- package/bundle-emitter/publish-error/auto-mode-error-matching.js +30 -0
- package/bundle-emitter/publish-error/auto-mode-error-matching.js.map +1 -0
- package/bundle-emitter/publish-error/error-shape-helpers.js +10 -0
- package/bundle-emitter/publish-error/error-shape-helpers.js.map +1 -0
- package/bundle-emitter/publish-error/file-mode-error-matching.js +28 -0
- package/bundle-emitter/publish-error/file-mode-error-matching.js.map +1 -0
- package/bundle-emitter/publish-error/publish-error-messages.js +37 -0
- package/bundle-emitter/publish-error/publish-error-messages.js.map +1 -0
- package/bundle-emitter/registry/metadata-auth-retry.js +26 -0
- package/bundle-emitter/registry/metadata-auth-retry.js.map +1 -0
- package/bundle-emitter/registry/oidc-token-exchange.js +80 -0
- package/bundle-emitter/registry/oidc-token-exchange.js.map +1 -0
- package/bundle-emitter/registry/package-metadata-fetcher.d.ts +4 -0
- package/bundle-emitter/registry/package-metadata-fetcher.d.ts.map +1 -0
- package/bundle-emitter/registry/package-metadata-fetcher.js +99 -0
- package/bundle-emitter/registry/package-metadata-fetcher.js.map +1 -0
- package/bundle-emitter/registry/publish-settings-bridge.js +39 -0
- package/bundle-emitter/registry/publish-settings-bridge.js.map +1 -0
- package/bundle-emitter/registry/registry-auth-config.js +82 -0
- package/bundle-emitter/registry/registry-auth-config.js.map +1 -0
- package/bundle-emitter/registry/registry-client.d.ts +10 -0
- package/bundle-emitter/registry/registry-client.d.ts.map +1 -0
- package/bundle-emitter/registry/registry-client.js +38 -0
- package/bundle-emitter/registry/registry-client.js.map +1 -0
- package/bundle-emitter/registry/registry-response-schemas.js +44 -0
- package/bundle-emitter/registry/registry-response-schemas.js.map +1 -0
- package/bundle-emitter/repository-url-normalizer.js +2 -4
- package/bundle-emitter/repository-url-normalizer.js.map +1 -1
- package/checks/rules/duplicate-detection.js +26 -0
- package/checks/rules/duplicate-detection.js.map +1 -0
- package/checks/rules/duplicate-messages.js +26 -0
- package/checks/rules/duplicate-messages.js.map +1 -0
- package/checks/rules/file-ownership.js +16 -0
- package/checks/rules/file-ownership.js.map +1 -0
- package/checks/rules/no-duplicated-files.js +2 -76
- package/checks/rules/no-duplicated-files.js.map +1 -1
- package/checks/rules/required-files.js +2 -1
- package/checks/rules/required-files.js.map +1 -1
- package/checks/rules/set-intersection.js +14 -0
- package/checks/rules/set-intersection.js.map +1 -0
- package/checks/rules/unique-target-paths.js +11 -10
- package/checks/rules/unique-target-paths.js.map +1 -1
- package/common/code-files.js +21 -0
- package/common/code-files.js.map +1 -1
- package/common/max-date.js +6 -0
- package/common/max-date.js.map +1 -0
- package/common/sort-values.js.map +1 -0
- package/common/stable-json.js +42 -0
- package/common/stable-json.js.map +1 -0
- package/common/typed-diff.d.ts +3 -0
- package/common/typed-diff.d.ts.map +1 -0
- package/common/typed-diff.js +5 -0
- package/common/typed-diff.js.map +1 -0
- package/config/config.d.ts +0 -3
- package/config/config.d.ts.map +1 -1
- package/config/cross-package-validation.js +18 -0
- package/config/cross-package-validation.js.map +1 -0
- package/config/dependency-existence-validation.js +20 -0
- package/config/dependency-existence-validation.js.map +1 -0
- package/config/package-config.d.ts +0 -2
- package/config/package-config.d.ts.map +1 -1
- package/config/package-graph-builder.js +15 -0
- package/config/package-graph-builder.js.map +1 -0
- package/config/pre-graph-validation.js +19 -0
- package/config/pre-graph-validation.js.map +1 -0
- package/config/root-config-validation.js +126 -0
- package/config/root-config-validation.js.map +1 -0
- package/config/settings-validation.js +29 -0
- package/config/settings-validation.js.map +1 -0
- package/config/validation.d.ts +2 -2
- package/config/validation.d.ts.map +1 -1
- package/config/validation.js +9 -231
- package/config/validation.js.map +1 -1
- package/dead-code-eliminator/class-purity.js +33 -0
- package/dead-code-eliminator/class-purity.js.map +1 -0
- package/dead-code-eliminator/code-file-analyzer.js +56 -0
- package/dead-code-eliminator/code-file-analyzer.js.map +1 -0
- package/dead-code-eliminator/cross-bundle/bundle-index.js +31 -0
- package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -0
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +4 -111
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/import-export-walker.js +69 -0
- package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -0
- package/dead-code-eliminator/cross-bundle/seed-store.js +19 -0
- package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -0
- package/dead-code-eliminator/eliminator.js +3 -83
- package/dead-code-eliminator/eliminator.js.map +1 -1
- package/dead-code-eliminator/expression-unwrapping.js +17 -0
- package/dead-code-eliminator/expression-unwrapping.js.map +1 -0
- package/dead-code-eliminator/imported-expression-origin.js +95 -0
- package/dead-code-eliminator/imported-expression-origin.js.map +1 -0
- package/dead-code-eliminator/load-bundle.js +1 -1
- package/dead-code-eliminator/load-bundle.js.map +1 -1
- package/dead-code-eliminator/pure-expression.js +116 -0
- package/dead-code-eliminator/pure-expression.js.map +1 -0
- package/dead-code-eliminator/reachability/bfs-closure.js +40 -0
- package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -0
- package/dead-code-eliminator/reachability/binding-id.js +33 -0
- package/dead-code-eliminator/reachability/binding-id.js.map +1 -0
- package/dead-code-eliminator/reachability/identifier-target-collector.js +36 -0
- package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -0
- package/dead-code-eliminator/reachability/local-seed-gathering.js +24 -0
- package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -0
- package/dead-code-eliminator/reachability/reachability.js +19 -130
- package/dead-code-eliminator/reachability/reachability.js.map +1 -1
- package/dead-code-eliminator/side-effect-classifier.js +2 -394
- package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
- package/dead-code-eliminator/source-map-recomposition.js +27 -0
- package/dead-code-eliminator/source-map-recomposition.js.map +1 -0
- package/dead-code-eliminator/statement-classifiers.js +67 -0
- package/dead-code-eliminator/statement-classifiers.js.map +1 -0
- package/dead-code-eliminator/syntax-kind-sets.js +67 -0
- package/dead-code-eliminator/syntax-kind-sets.js.map +1 -0
- package/dead-code-eliminator/transform/declaration-removal.js +34 -0
- package/dead-code-eliminator/transform/declaration-removal.js.map +1 -0
- package/dead-code-eliminator/transform/declaration-remover.js +2 -72
- package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
- package/dead-code-eliminator/transform/named-declaration-kinds.js +13 -0
- package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -0
- package/dead-code-eliminator/transform/survivor-capture.js +33 -0
- package/dead-code-eliminator/transform/survivor-capture.js.map +1 -0
- package/dependency-scanner/dependency-graph.js +46 -28
- package/dependency-scanner/dependency-graph.js.map +1 -1
- package/dependency-scanner/file-host-predicates.js +10 -0
- package/dependency-scanner/file-host-predicates.js.map +1 -0
- package/dependency-scanner/host-method-binding.js +19 -0
- package/dependency-scanner/host-method-binding.js.map +1 -0
- package/dependency-scanner/node-modules-manifest-synthesizer.js +55 -0
- package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -0
- package/dependency-scanner/package-owned-asset-file-path.js +21 -0
- package/dependency-scanner/package-owned-asset-file-path.js.map +1 -0
- package/dependency-scanner/scanner.d.ts +1 -1
- package/dependency-scanner/scanner.d.ts.map +1 -1
- package/dependency-scanner/scanner.js +34 -39
- package/dependency-scanner/scanner.js.map +1 -1
- package/dependency-scanner/source-file-references.d.ts +3 -0
- package/dependency-scanner/source-file-references.d.ts.map +1 -0
- package/dependency-scanner/source-file-references.js +106 -7
- package/dependency-scanner/source-file-references.js.map +1 -1
- package/dependency-scanner/typescript-compiler-options.d.ts +3 -0
- package/dependency-scanner/typescript-compiler-options.d.ts.map +1 -0
- package/dependency-scanner/typescript-compiler-options.js +22 -0
- package/dependency-scanner/typescript-compiler-options.js.map +1 -0
- package/dependency-scanner/typescript-file-host.d.ts.map +1 -1
- package/dependency-scanner/typescript-file-host.js +15 -81
- package/dependency-scanner/typescript-file-host.js.map +1 -1
- package/dependency-scanner/typescript-project-analyzer.d.ts +3 -3
- package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -1
- package/dependency-scanner/typescript-project-analyzer.js +6 -26
- package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
- package/dependency-scanner/virtual-package-json-host.js +45 -0
- package/dependency-scanner/virtual-package-json-host.js.map +1 -0
- package/directed-graph/graph.js +19 -8
- package/directed-graph/graph.js.map +1 -1
- package/file-manager/file-description.d.ts.map +1 -1
- package/file-manager/file-description.js +4 -0
- package/file-manager/file-description.js.map +1 -0
- package/file-manager/file-manager.js +30 -1
- package/file-manager/file-manager.js.map +1 -1
- package/file-manager/permissions.js +5 -4
- package/file-manager/permissions.js.map +1 -1
- package/linker/linked-bundle.d.ts.map +1 -1
- package/linker/linked-bundle.js +6 -0
- package/linker/linked-bundle.js.map +1 -0
- package/linker/linker.d.ts +1 -1
- package/linker/linker.d.ts.map +1 -1
- package/linker/linker.js +2 -1
- package/linker/linker.js.map +1 -1
- package/linker/replacement-lookup.js +41 -0
- package/linker/replacement-lookup.js.map +1 -0
- package/linker/resource-graph.js +2 -1
- package/linker/resource-graph.js.map +1 -1
- package/linker/substitute-bundles.js +4 -42
- package/linker/substitute-bundles.js.map +1 -1
- package/linker/substituted-resource-graph.js +2 -1
- package/linker/substituted-resource-graph.js.map +1 -1
- package/pack-emitter/pack-emitter.d.ts +8 -0
- package/pack-emitter/pack-emitter.d.ts.map +1 -0
- package/pack-emitter/pack-emitter.js +28 -0
- package/pack-emitter/pack-emitter.js.map +1 -0
- package/package-surface/bin-field.js +9 -0
- package/package-surface/bin-field.js.map +1 -0
- package/package-surface/explicit-bin.js +25 -0
- package/package-surface/explicit-bin.js.map +1 -0
- package/package-surface/explicit-exports.js +12 -0
- package/package-surface/explicit-exports.js.map +1 -0
- package/package-surface/explicit-specifier-build.js +28 -0
- package/package-surface/explicit-specifier-build.js.map +1 -0
- package/package-surface/explicit-specifier-resolve.js +17 -0
- package/package-surface/explicit-specifier-resolve.js.map +1 -0
- package/package-surface/export-map.js +10 -0
- package/package-surface/export-map.js.map +1 -0
- package/package-surface/implicit-bin.js +23 -0
- package/package-surface/implicit-bin.js.map +1 -0
- package/package-surface/implicit-exports.js +11 -0
- package/package-surface/implicit-exports.js.map +1 -0
- package/package-surface/implicit-root-exports.js +14 -0
- package/package-surface/implicit-root-exports.js.map +1 -0
- package/package-surface/implicit-specifier-build.js +26 -0
- package/package-surface/implicit-specifier-build.js.map +1 -0
- package/package-surface/implicit-specifier-resolve.js +17 -0
- package/package-surface/implicit-specifier-resolve.js.map +1 -0
- package/package-surface/package-json-export.js +10 -0
- package/package-surface/package-json-export.js.map +1 -0
- package/package-surface/package-shape.js +10 -0
- package/package-surface/package-shape.js.map +1 -0
- package/package-surface/public-module-usage.js +1 -1
- package/package-surface/public-module-usage.js.map +1 -1
- package/package-surface/public-specifiers.js +17 -0
- package/package-surface/public-specifiers.js.map +1 -0
- package/package-surface/root-registry.js +35 -0
- package/package-surface/root-registry.js.map +1 -0
- package/package-surface/specifier-syntax.js +24 -0
- package/package-surface/specifier-syntax.js.map +1 -0
- package/package-surface/substitution-exports.js +67 -0
- package/package-surface/substitution-exports.js.map +1 -0
- package/package.json +23 -10
- package/packages/package-processor.composition.js +54 -25
- package/packages/package-processor.composition.js.map +1 -1
- package/packages/packtory/packtory.entry-point.d.ts +24 -14
- package/packages/packtory/packtory.entry-point.d.ts.map +1 -1
- package/packages/packtory/packtory.entry-point.js +7 -3
- package/packages/packtory/packtory.entry-point.js.map +1 -1
- package/packtory/map-config.d.ts +3 -2
- package/packtory/map-config.d.ts.map +1 -1
- package/packtory/map-config.js +2 -1
- package/packtory/map-config.js.map +1 -1
- package/packtory/options/bundle-dependency-resolution.js +20 -0
- package/packtory/options/bundle-dependency-resolution.js.map +1 -0
- package/packtory/options/dead-code-elimination-resolution.js +11 -0
- package/packtory/options/dead-code-elimination-resolution.js.map +1 -0
- package/packtory/options/prepare-package-options.d.ts +18 -0
- package/packtory/options/prepare-package-options.d.ts.map +1 -0
- package/packtory/options/prepare-package-options.js +46 -0
- package/packtory/options/prepare-package-options.js.map +1 -0
- package/packtory/options/required-value-helpers.js +18 -0
- package/packtory/options/required-value-helpers.js.map +1 -0
- package/packtory/options/setting-resolvers.d.ts +6 -0
- package/packtory/options/setting-resolvers.d.ts.map +1 -0
- package/packtory/options/setting-resolvers.js +42 -0
- package/packtory/options/setting-resolvers.js.map +1 -0
- package/packtory/options/surface-resolution.js +16 -0
- package/packtory/options/surface-resolution.js.map +1 -0
- package/packtory/options/version-trigger.js +31 -0
- package/packtory/options/version-trigger.js.map +1 -0
- package/packtory/package-processor-build.js +2 -1
- package/packtory/package-processor-build.js.map +1 -1
- package/packtory/package-processor-publish.d.ts +5 -0
- package/packtory/package-processor-publish.d.ts.map +1 -1
- package/packtory/package-processor-publish.js +25 -40
- package/packtory/package-processor-publish.js.map +1 -1
- package/packtory/packtory-pack.js +221 -0
- package/packtory/packtory-pack.js.map +1 -0
- package/packtory/packtory-publish.js +3 -51
- package/packtory/packtory-publish.js.map +1 -1
- package/packtory/packtory-release-analysis.js +69 -0
- package/packtory/packtory-release-analysis.js.map +1 -0
- package/packtory/packtory-release-diff.js +48 -0
- package/packtory/packtory-release-diff.js.map +1 -0
- package/packtory/packtory-resolve.js +3 -71
- package/packtory/packtory-resolve.js.map +1 -1
- package/packtory/packtory-results.d.ts +73 -1
- package/packtory/packtory-results.d.ts.map +1 -1
- package/packtory/packtory-results.js +15 -0
- package/packtory/packtory-results.js.map +1 -1
- package/packtory/packtory.d.ts +15 -1
- package/packtory/packtory.d.ts.map +1 -1
- package/packtory/packtory.js +58 -5
- package/packtory/packtory.js.map +1 -1
- package/packtory/publish-failure-mapping.js +7 -0
- package/packtory/publish-failure-mapping.js.map +1 -0
- package/packtory/release-analysis.js +147 -0
- package/packtory/release-analysis.js.map +1 -0
- package/packtory/release-diff-failure-mapping.js +7 -0
- package/packtory/release-diff-failure-mapping.js.map +1 -0
- package/packtory/report-attachment.js +12 -1
- package/packtory/report-attachment.js.map +1 -1
- package/packtory/stages/package-analysis-stage.js +24 -0
- package/packtory/stages/package-analysis-stage.js.map +1 -0
- package/packtory/stages/package-resolution-stage.js +44 -0
- package/packtory/stages/package-resolution-stage.js.map +1 -0
- package/packtory/stages/publish-stage.js +44 -0
- package/packtory/stages/publish-stage.js.map +1 -0
- package/packtory/stages/release-diff-stage.js +84 -0
- package/packtory/stages/release-diff-stage.js.map +1 -0
- package/published-package/published-package.d.ts +39 -0
- package/published-package/published-package.d.ts.map +1 -0
- package/published-package/published-package.js +11 -0
- package/published-package/published-package.js.map +1 -0
- package/readme.md +27 -12
- package/report/aggregator/artifact-entry-merger.js.map +1 -0
- package/report/aggregator/package-report-materialization.js +63 -0
- package/report/aggregator/package-report-materialization.js.map +1 -0
- package/report/aggregator/report-aggregator.js +36 -0
- package/report/aggregator/report-aggregator.js.map +1 -0
- package/report/{report-aggregator.js → aggregator/report-event-handlers.js} +8 -95
- package/report/aggregator/report-event-handlers.js.map +1 -0
- package/report/{report-aggregator.d.ts → aggregator/report-types.d.ts} +2 -2
- package/report/aggregator/report-types.d.ts.map +1 -0
- package/report/aggregator/report-types.js +4 -0
- package/report/aggregator/report-types.js.map +1 -0
- package/report/config-redactor.js.map +1 -1
- package/report/inspectors/inspect-artifact-sizes.js +34 -0
- package/report/inspectors/inspect-artifact-sizes.js.map +1 -0
- package/report/inspectors/inspect-linker-rewrites.js +15 -0
- package/report/inspectors/inspect-linker-rewrites.js.map +1 -0
- package/report/inspectors/inspect-package-json-provenance.js +16 -0
- package/report/inspectors/inspect-package-json-provenance.js.map +1 -0
- package/report/inspectors/inspect-scan-results.js +10 -0
- package/report/inspectors/inspect-scan-results.js.map +1 -0
- package/report/preview/preview-document-diff.d.ts +13 -0
- package/report/preview/preview-document-diff.d.ts.map +1 -0
- package/report/preview/preview-document-diff.js +29 -0
- package/report/preview/preview-document-diff.js.map +1 -0
- package/report/release-diff/file-hunks.js +10 -0
- package/report/release-diff/file-hunks.js.map +1 -0
- package/report/release-diff/file-set-diff.d.ts +49 -0
- package/report/release-diff/file-set-diff.d.ts.map +1 -0
- package/report/release-diff/file-set-diff.js +71 -0
- package/report/release-diff/file-set-diff.js.map +1 -0
- package/report/release-diff/release-version-transition.js +17 -0
- package/report/release-diff/release-version-transition.js.map +1 -0
- package/resource-resolver/bundle-resource-lookup.js +24 -0
- package/resource-resolver/bundle-resource-lookup.js.map +1 -0
- package/resource-resolver/content.js +8 -4
- package/resource-resolver/content.js.map +1 -1
- package/resource-resolver/dependency-resolution-walker.js +25 -0
- package/resource-resolver/dependency-resolution-walker.js.map +1 -0
- package/resource-resolver/resolved-bundle.d.ts +1 -0
- package/resource-resolver/resolved-bundle.d.ts.map +1 -1
- package/resource-resolver/resolved-bundle.js +4 -0
- package/resource-resolver/resolved-bundle.js.map +1 -0
- package/resource-resolver/resource-resolve-options.js.map +1 -1
- package/resource-resolver/resource-resolver.d.ts.map +1 -1
- package/resource-resolver/resource-resolver.js +22 -57
- package/resource-resolver/resource-resolver.js.map +1 -1
- package/sbom/sbom-canonicalizer.js +46 -0
- package/sbom/sbom-canonicalizer.js.map +1 -0
- package/sbom/sbom-file.d.ts +2 -2
- package/sbom/sbom-file.d.ts.map +1 -1
- package/sbom/sbom-file.js +2 -5
- package/sbom/sbom-file.js.map +1 -1
- package/tar/extract-tar.js +11 -8
- package/tar/extract-tar.js.map +1 -1
- package/tar/tarball-builder.d.ts +4 -0
- package/tar/tarball-builder.d.ts.map +1 -1
- package/tar/tarball-builder.js +24 -11
- package/tar/tarball-builder.js.map +1 -1
- package/vendor-materializer/vendor-entry.d.ts +1 -0
- package/vendor-materializer/vendor-entry.d.ts.map +1 -0
- package/vendor-materializer/vendor-entry.js +8 -0
- package/vendor-materializer/vendor-entry.js.map +1 -0
- package/vendor-materializer/vendor-materializer.d.ts +5 -0
- package/vendor-materializer/vendor-materializer.d.ts.map +1 -0
- package/vendor-materializer/vendor-materializer.js +232 -0
- package/vendor-materializer/vendor-materializer.js.map +1 -0
- package/version-manager/dependencies/bundle-dependency-grouping.js +23 -0
- package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -0
- package/version-manager/dependencies/dependency-groups.js +12 -0
- package/version-manager/dependencies/dependency-groups.js.map +1 -0
- package/version-manager/{versioned-bundle-dependencies.js → dependencies/external-dependency-classification.js} +4 -42
- package/version-manager/dependencies/external-dependency-classification.js.map +1 -0
- package/version-manager/dependencies/versioned-bundle-dependencies.js +9 -0
- package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -0
- package/version-manager/imports/hash-import-scanner.js +21 -0
- package/version-manager/imports/hash-import-scanner.js.map +1 -0
- package/version-manager/imports/imports-key-matcher.js +21 -0
- package/version-manager/imports/imports-key-matcher.js.map +1 -0
- package/version-manager/{versioned-bundle-imports.js → imports/versioned-bundle-imports.js} +3 -36
- package/version-manager/imports/versioned-bundle-imports.js.map +1 -0
- package/version-manager/manager.js +1 -1
- package/version-manager/manager.js.map +1 -1
- package/version-manager/manifest/builder.js +3 -5
- package/version-manager/manifest/builder.js.map +1 -1
- package/version-manager/manifest/serialize.js +2 -41
- package/version-manager/manifest/serialize.js.map +1 -1
- package/version-manager/optional-bundle-fields.js +9 -0
- package/version-manager/optional-bundle-fields.js.map +1 -0
- package/version-manager/representative-root.js +30 -0
- package/version-manager/representative-root.js.map +1 -0
- package/version-manager/specifier-classifier.js +14 -11
- package/version-manager/specifier-classifier.js.map +1 -1
- package/version-manager/versioned-bundle.d.ts +7 -23
- package/version-manager/versioned-bundle.d.ts.map +1 -1
- package/version-manager/versioned-bundle.js +7 -40
- package/version-manager/versioned-bundle.js.map +1 -1
- package/zip/zip-builder.d.ts +5 -0
- package/zip/zip-builder.d.ts.map +1 -0
- package/zip/zip-builder.js +80 -0
- package/zip/zip-builder.js.map +1 -0
- package/bundle-emitter/publish-settings-bridge.js +0 -133
- package/bundle-emitter/publish-settings-bridge.js.map +0 -1
- package/bundle-emitter/registry-client.d.ts +0 -9
- package/bundle-emitter/registry-client.d.ts.map +0 -1
- package/bundle-emitter/registry-client.js +0 -265
- package/bundle-emitter/registry-client.js.map +0 -1
- package/package-surface/modules.js +0 -319
- package/package-surface/modules.js.map +0 -1
- package/packtory/prepare-package-options.d.ts +0 -14
- package/packtory/prepare-package-options.d.ts.map +0 -1
- package/packtory/prepare-package-options.js +0 -128
- package/packtory/prepare-package-options.js.map +0 -1
- package/report/artifact-entry-merger.js.map +0 -1
- package/report/inspectors.js +0 -74
- package/report/inspectors.js.map +0 -1
- package/report/report-aggregator.d.ts.map +0 -1
- package/report/report-aggregator.js.map +0 -1
- package/version-manager/manifest/sort-values.js.map +0 -1
- package/version-manager/versioned-bundle-dependencies.js.map +0 -1
- package/version-manager/versioned-bundle-imports.d.ts +0 -4
- package/version-manager/versioned-bundle-imports.d.ts.map +0 -1
- package/version-manager/versioned-bundle-imports.js.map +0 -1
- /package/{version-manager/manifest → common}/sort-values.js +0 -0
- /package/report/{artifact-entry-merger.js → aggregator/artifact-entry-merger.js} +0 -0
|
@@ -1,54 +1,49 @@
|
|
|
1
1
|
import { Maybe } from 'true-myth/maybe';
|
|
2
|
-
import {
|
|
2
|
+
import { isCodeFile } from "../common/code-files.js";
|
|
3
3
|
import { createDependencyGraph } from "./dependency-graph.js";
|
|
4
|
-
function isNodeModulesPath(filePath) {
|
|
5
|
-
return filePath.includes('/node_modules/');
|
|
6
|
-
}
|
|
7
|
-
function isLocalPath(filePath) {
|
|
8
|
-
return !isNodeModulesPath(filePath);
|
|
9
|
-
}
|
|
10
|
-
function extractModuleName(nodeModulePath) {
|
|
11
|
-
const prefix = '/node_modules/';
|
|
12
|
-
const pattern = /\/node_modules\/(?:[^@]+?|(?:@.+?\/.+?))\//;
|
|
13
|
-
const result = pattern.exec(nodeModulePath);
|
|
14
|
-
if (result === null) {
|
|
15
|
-
throw new Error(`Couldn’t find node_modules package name for '${nodeModulePath}'`);
|
|
16
|
-
}
|
|
17
|
-
return result[0].slice(prefix.length, -1);
|
|
18
|
-
}
|
|
19
|
-
function determineLocalDependencies(dependencies) {
|
|
20
|
-
return dependencies.filter(isLocalPath);
|
|
21
|
-
}
|
|
22
|
-
function determineExternalDependencies(dependencies) {
|
|
23
|
-
const modulePaths = dependencies.filter(isNodeModulesPath);
|
|
24
|
-
const moduleNames = modulePaths.map(extractModuleName);
|
|
25
|
-
const uniqueModuleNames = unique(moduleNames);
|
|
26
|
-
return uniqueModuleNames;
|
|
27
|
-
}
|
|
28
4
|
export function createDependencyScanner(dependencyScannerDependencies) {
|
|
29
5
|
const { sourceMapFileLocator, typescriptProjectAnalyzer } = dependencyScannerDependencies;
|
|
30
|
-
async function getDependencyNodeData(project, sourceFilePath,
|
|
31
|
-
const sourceMapFilePath = options.includeSourceMapFiles
|
|
6
|
+
async function getDependencyNodeData(project, sourceFilePath, externalDependencies, options) {
|
|
7
|
+
const sourceMapFilePath = options.includeSourceMapFiles && isCodeFile(sourceFilePath)
|
|
32
8
|
? await sourceMapFileLocator.locate(sourceFilePath)
|
|
33
9
|
: Maybe.nothing();
|
|
34
|
-
const externalDependencies = determineExternalDependencies(referencedFilePaths);
|
|
35
10
|
return {
|
|
36
11
|
sourceMapFilePath,
|
|
37
12
|
externalDependencies,
|
|
38
13
|
project
|
|
39
14
|
};
|
|
40
15
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
16
|
+
function localReferencesOf(references) {
|
|
17
|
+
return references.filter((reference) => {
|
|
18
|
+
return reference.kind !== 'external-package';
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function externalDependenciesOf(references) {
|
|
22
|
+
return references.flatMap((reference) => {
|
|
23
|
+
return reference.kind === 'external-package' ? [reference.packageName] : [];
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function referencedModulesOf(project, reference) {
|
|
27
|
+
return reference.kind === 'local-code' ? project.getReferencedModules(reference.filePath) : [];
|
|
28
|
+
}
|
|
29
|
+
function projectFor(reference, project) {
|
|
30
|
+
return reference.kind === 'local-code' ? project : undefined;
|
|
31
|
+
}
|
|
32
|
+
async function scanDependenciesOfReference(project, reference, graph, options) {
|
|
33
|
+
const sourceFilePath = reference.filePath;
|
|
34
|
+
const referencedModules = referencedModulesOf(project, reference);
|
|
35
|
+
const localReferences = localReferencesOf(referencedModules);
|
|
36
|
+
const nodeData = await getDependencyNodeData(projectFor(reference, project), sourceFilePath, externalDependenciesOf(referencedModules), options);
|
|
37
|
+
graph.addDependency(sourceFilePath, {
|
|
38
|
+
...nodeData,
|
|
39
|
+
...(reference.kind === 'generated-manifest' ? { isGeneratedManifest: true } : {})
|
|
40
|
+
});
|
|
41
|
+
for (const localReference of localReferences) {
|
|
42
|
+
if (!graph.isKnown(localReference.filePath)) {
|
|
43
|
+
await scanDependenciesOfReference(project, localReference, graph, options);
|
|
49
44
|
}
|
|
50
|
-
if (!graph.hasConnection(sourceFilePath,
|
|
51
|
-
graph.connect(sourceFilePath,
|
|
45
|
+
if (!graph.hasConnection(sourceFilePath, localReference.filePath)) {
|
|
46
|
+
graph.connect(sourceFilePath, localReference.filePath);
|
|
52
47
|
}
|
|
53
48
|
}
|
|
54
49
|
}
|
|
@@ -65,7 +60,7 @@ export function createDependencyScanner(dependencyScannerDependencies) {
|
|
|
65
60
|
resolveDeclarationFiles: scanOptions.resolveDeclarationFiles,
|
|
66
61
|
mainPackageJson: scanOptions.mainPackageJson
|
|
67
62
|
});
|
|
68
|
-
await
|
|
63
|
+
await scanDependenciesOfReference(project, { kind: 'local-code', filePath: entryPointFile }, graph, scanOptions);
|
|
69
64
|
return graph;
|
|
70
65
|
}
|
|
71
66
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAsD,MAAM,uBAAuB,CAAC;AA0BlH,MAAM,UAAU,uBAAuB,CACnC,6BAAsE;IAEtE,MAAM,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,GAAG,6BAA6B,CAAC;IAO1F,KAAK,UAAU,qBAAqB,CAChC,OAAsC,EACtC,cAAsB,EACtB,oBAAuC,EACvC,OAA8B;QAE9B,MAAM,iBAAiB,GACnB,OAAO,CAAC,qBAAqB,IAAI,UAAU,CAAC,cAAc,CAAC;YACvD,CAAC,CAAC,MAAM,oBAAoB,CAAC,MAAM,CAAC,cAAc,CAAC;YACnD,CAAC,CAAC,KAAK,CAAC,OAAO,EAAU,CAAC;QAElC,OAAO;YACH,iBAAiB;YACjB,oBAAoB;YACpB,OAAO;SACV,CAAC;IACN,CAAC;IAED,SAAS,iBAAiB,CAAC,UAAsC;QAC7D,OAAO,UAAU,CA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3,"file":"source-file-references.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-file-references.ts"],"names":[],"mappings":"AAGA,OAAO,EAAM,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU"}
|
|
@@ -1,21 +1,120 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
1
2
|
import { isBuiltin } from 'node:module';
|
|
2
3
|
import { isDefined } from 'remeda';
|
|
3
4
|
import { ts } from 'ts-morph';
|
|
5
|
+
import { findPackageOwnedAssetFilePath } from "./package-owned-asset-file-path.js";
|
|
6
|
+
function isNodeModulesPath(filePath) {
|
|
7
|
+
return filePath.includes('/node_modules/');
|
|
8
|
+
}
|
|
9
|
+
function extractModuleName(nodeModulePath) {
|
|
10
|
+
const prefix = '/node_modules/';
|
|
11
|
+
const packagePath = nodeModulePath.slice(nodeModulePath.lastIndexOf(prefix) + prefix.length);
|
|
12
|
+
if (!packagePath.startsWith('@')) {
|
|
13
|
+
return packagePath.slice(0, `${packagePath}/`.indexOf('/'));
|
|
14
|
+
}
|
|
15
|
+
const [scope, name] = packagePath.split('/');
|
|
16
|
+
return `${scope}/${name}`;
|
|
17
|
+
}
|
|
18
|
+
function isRelativeOrAbsoluteSpecifier(specifier) {
|
|
19
|
+
return specifier.startsWith('./') || specifier.startsWith('../') || specifier.startsWith('/');
|
|
20
|
+
}
|
|
21
|
+
function packageNameFromSpecifier(specifier) {
|
|
22
|
+
if (specifier.startsWith('@')) {
|
|
23
|
+
const [scope, name] = specifier.split('/');
|
|
24
|
+
if (name === undefined) {
|
|
25
|
+
throw new Error(`Invalid package specifier "${specifier}"`);
|
|
26
|
+
}
|
|
27
|
+
return `${scope}/${name}`;
|
|
28
|
+
}
|
|
29
|
+
const separatorIndex = specifier.indexOf('/');
|
|
30
|
+
return separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);
|
|
31
|
+
}
|
|
32
|
+
function resolvePackageOwnedWasmFilePath(literal, containingSourceFile) {
|
|
33
|
+
const importValue = literal.getLiteralValue();
|
|
34
|
+
const packageName = packageNameFromSpecifier(importValue);
|
|
35
|
+
const moduleResolutionHost = containingSourceFile.getProject().getModuleResolutionHost();
|
|
36
|
+
const filePath = findPackageOwnedAssetFilePath(importValue, path.dirname(containingSourceFile.getFilePath()), (candidatePath) => {
|
|
37
|
+
return moduleResolutionHost.fileExists(candidatePath);
|
|
38
|
+
});
|
|
39
|
+
if (filePath !== undefined) {
|
|
40
|
+
return { filePath, packageName };
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
function resolveLocalWasmFilePath(literal, containingSourceFile) {
|
|
45
|
+
const importValue = literal.getLiteralValue();
|
|
46
|
+
const candidatePath = path.resolve(path.dirname(containingSourceFile.getFilePath()), importValue);
|
|
47
|
+
const moduleResolutionHost = containingSourceFile.getProject().getModuleResolutionHost();
|
|
48
|
+
return moduleResolutionHost.fileExists(candidatePath) ? candidatePath : undefined;
|
|
49
|
+
}
|
|
50
|
+
function classifyLocalReference(resolvedFilePath, packageJsonPath) {
|
|
51
|
+
if (path.resolve(resolvedFilePath) === path.resolve(packageJsonPath)) {
|
|
52
|
+
return { kind: 'generated-manifest', filePath: resolvedFilePath };
|
|
53
|
+
}
|
|
54
|
+
const extension = path.extname(resolvedFilePath);
|
|
55
|
+
if (extension === '.json' || extension === '.wasm') {
|
|
56
|
+
return { kind: 'local-asset', filePath: resolvedFilePath };
|
|
57
|
+
}
|
|
58
|
+
return { kind: 'local-code', filePath: resolvedFilePath };
|
|
59
|
+
}
|
|
60
|
+
function resolvedModuleForLiteral(literal, containingSourceFile) {
|
|
61
|
+
const project = containingSourceFile.getProject();
|
|
62
|
+
return ts.resolveModuleName(literal.getLiteralValue(), containingSourceFile.getFilePath(), project.getCompilerOptions(), project.getModuleResolutionHost()).resolvedModule;
|
|
63
|
+
}
|
|
4
64
|
export function resolveSourceFileForLiteral(literal, containingSourceFile) {
|
|
5
65
|
const project = containingSourceFile.getProject();
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
const resolvedFilePath =
|
|
66
|
+
const resolvedModule = resolvedModuleForLiteral(literal, containingSourceFile);
|
|
67
|
+
if (resolvedModule !== undefined) {
|
|
68
|
+
const resolvedFilePath = resolvedModule.resolvedFileName;
|
|
9
69
|
return project.getSourceFile(resolvedFilePath);
|
|
10
70
|
}
|
|
11
71
|
return undefined;
|
|
12
72
|
}
|
|
13
|
-
|
|
73
|
+
function resolvedModuleBasedReference(literal, containingSourceFile, packageJsonPath) {
|
|
74
|
+
const resolvedModule = resolvedModuleForLiteral(literal, containingSourceFile);
|
|
75
|
+
if (resolvedModule === undefined) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
const resolvedFilePath = resolvedModule.resolvedFileName;
|
|
79
|
+
if (isNodeModulesPath(resolvedFilePath)) {
|
|
80
|
+
return {
|
|
81
|
+
kind: 'external-package',
|
|
82
|
+
packageName: extractModuleName(resolvedFilePath)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return classifyLocalReference(resolvedFilePath, packageJsonPath);
|
|
86
|
+
}
|
|
87
|
+
function fallbackModuleReference(literal, containingSourceFile, packageJsonPath) {
|
|
88
|
+
const importValue = literal.getLiteralValue();
|
|
89
|
+
if (!importValue.endsWith('.wasm')) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
if (isRelativeOrAbsoluteSpecifier(importValue)) {
|
|
93
|
+
const wasmFilePath = resolveLocalWasmFilePath(literal, containingSourceFile);
|
|
94
|
+
return wasmFilePath === undefined ? undefined : classifyLocalReference(wasmFilePath, packageJsonPath);
|
|
95
|
+
}
|
|
96
|
+
const packageOwnedWasm = resolvePackageOwnedWasmFilePath(literal, containingSourceFile);
|
|
97
|
+
if (packageOwnedWasm === undefined) {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
kind: 'external-package',
|
|
102
|
+
packageName: packageOwnedWasm.packageName
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function resolveModuleReferenceForLiteral(literal, containingSourceFile, packageJsonPath) {
|
|
106
|
+
const directReference = resolvedModuleBasedReference(literal, containingSourceFile, packageJsonPath);
|
|
107
|
+
if (directReference !== undefined) {
|
|
108
|
+
return directReference;
|
|
109
|
+
}
|
|
110
|
+
return fallbackModuleReference(literal, containingSourceFile, packageJsonPath);
|
|
111
|
+
}
|
|
112
|
+
export function getReferencedModules(sourceFile, packageJsonPath) {
|
|
14
113
|
const importStringLiterals = sourceFile.getImportStringLiterals();
|
|
15
114
|
return importStringLiterals
|
|
16
115
|
.map((literal) => {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
116
|
+
const referencedModule = resolveModuleReferenceForLiteral(literal, sourceFile, packageJsonPath);
|
|
117
|
+
if (referencedModule === undefined) {
|
|
19
118
|
const importValue = literal.getLiteralValue();
|
|
20
119
|
if (isBuiltin(importValue)) {
|
|
21
120
|
return undefined;
|
|
@@ -23,7 +122,7 @@ export function getReferencedSourceFiles(sourceFile) {
|
|
|
23
122
|
const message = `Failed to resolve import "${importValue}" in file "${sourceFile.getFilePath()}"`;
|
|
24
123
|
throw new Error(message);
|
|
25
124
|
}
|
|
26
|
-
return
|
|
125
|
+
return referencedModule;
|
|
27
126
|
})
|
|
28
127
|
.filter(isDefined);
|
|
29
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-file-references.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-file-references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,EAAE,EAAuC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"source-file-references.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-file-references.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,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typescript-compiler-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,UAAU;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ModuleKind, ModuleResolutionKind } from 'ts-morph';
|
|
2
|
+
export function analyzationOptionsToCompilerOptions(options) {
|
|
3
|
+
const { resolveDeclarationFiles } = options;
|
|
4
|
+
const compilerOptions = {
|
|
5
|
+
moduleResolution: ModuleResolutionKind.Node16,
|
|
6
|
+
esModuleInterop: true,
|
|
7
|
+
maxNodeModuleJsDepth: 1,
|
|
8
|
+
noEmit: true,
|
|
9
|
+
allowJs: true,
|
|
10
|
+
resolveJsonModule: true,
|
|
11
|
+
noLib: true,
|
|
12
|
+
skipLibCheck: true,
|
|
13
|
+
module: ModuleKind.Node16,
|
|
14
|
+
resolvePackageJsonImports: true
|
|
15
|
+
};
|
|
16
|
+
if (!resolveDeclarationFiles) {
|
|
17
|
+
compilerOptions.types = [];
|
|
18
|
+
compilerOptions.typeRoots = [];
|
|
19
|
+
}
|
|
20
|
+
return compilerOptions;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=typescript-compiler-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-compiler-options.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-compiler-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAwB,MAAM,UAAU,CAAC;AAQlF,MAAM,UAAU,mCAAmC,CAAC,OAA2B;IAC3E,MAAM,EAAE,uBAAuB,EAAE,GAAG,OAAO,CAAC;IAE5C,MAAM,eAAe,GAAoB;QACrC,gBAAgB,EAAE,oBAAoB,CAAC,MAAM;QAC7C,eAAe,EAAE,IAAI;QACrB,oBAAoB,EAAE,CAAC;QACvB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,iBAAiB,EAAE,IAAI;QACvB,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,IAAI;QAClB,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,yBAAyB,EAAE,IAAI;KAClC,CAAC;IAEF,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC3B,eAAe,CAAC,KAAK,GAAG,EAAE,CAAC;QAC3B,eAAe,CAAC,SAAS,GAAG,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-file-host.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-file-host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript-file-host.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-file-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B"}
|
|
@@ -1,83 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
function isTypesRootFolder(directoryPath) {
|
|
9
|
-
return directoryPath.endsWith('/node_modules/@types') || directoryPath.includes('/node_modules/@types/');
|
|
10
|
-
}
|
|
11
|
-
const syncMethodNames = {
|
|
12
|
-
fileExists: 'fileExistsSync',
|
|
13
|
-
directoryExists: 'directoryExistsSync',
|
|
14
|
-
readFile: 'readFileSync'
|
|
15
|
-
};
|
|
16
|
-
function bindRequiredMethod(object, methodName, expectedResultDescription, validateResult) {
|
|
17
|
-
const method = Reflect.get(object, methodName);
|
|
18
|
-
if (typeof method !== 'function') {
|
|
19
|
-
throw new TypeError(`Expected ${methodName} to be a function`);
|
|
20
|
-
}
|
|
21
|
-
return (filePath) => {
|
|
22
|
-
const result = Reflect.apply(method, object, [filePath]);
|
|
23
|
-
if (!validateResult(result)) {
|
|
24
|
-
throw new TypeError(`Expected ${methodName} to return ${expectedResultDescription}`);
|
|
25
|
-
}
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function isBoolean(value) {
|
|
30
|
-
return typeof value === 'boolean';
|
|
31
|
-
}
|
|
32
|
-
function isString(value) {
|
|
33
|
-
return typeof value === 'string';
|
|
34
|
-
}
|
|
35
|
-
const packageJsonIndentationSpaces = 2;
|
|
36
|
-
function serializeMainPackageJson(mainPackageJson) {
|
|
37
|
-
return JSON.stringify(mainPackageJson, null, packageJsonIndentationSpaces);
|
|
38
|
-
}
|
|
39
|
-
function createVirtualPackageJsonHost(fileSystemHost, folder, mainPackageJson) {
|
|
40
|
-
const packageJsonPath = path.resolve(folder, 'package.json');
|
|
41
|
-
const serializedPackageJson = serializeMainPackageJson(mainPackageJson);
|
|
42
|
-
const fileExistsSync = bindRequiredMethod(fileSystemHost, syncMethodNames.fileExists, 'a boolean', isBoolean);
|
|
43
|
-
const readFileSync = bindRequiredMethod(fileSystemHost, syncMethodNames.readFile, 'a string', isString);
|
|
44
|
-
const virtualFileSystemHost = {
|
|
45
|
-
...fileSystemHost,
|
|
46
|
-
fileExists: async (filePath) => {
|
|
47
|
-
if (path.resolve(filePath) === packageJsonPath) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
return fileSystemHost.fileExists(filePath);
|
|
51
|
-
},
|
|
52
|
-
[syncMethodNames.fileExists]: (filePath) => {
|
|
53
|
-
if (path.resolve(filePath) === packageJsonPath) {
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
// eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
|
|
57
|
-
return fileExistsSync(filePath);
|
|
58
|
-
},
|
|
59
|
-
readFile: async (filePath, encoding) => {
|
|
60
|
-
if (path.resolve(filePath) === packageJsonPath) {
|
|
61
|
-
return serializedPackageJson;
|
|
62
|
-
}
|
|
63
|
-
return fileSystemHost.readFile(filePath, encoding);
|
|
64
|
-
},
|
|
65
|
-
[syncMethodNames.readFile]: (filePath) => {
|
|
66
|
-
if (path.resolve(filePath) === packageJsonPath) {
|
|
67
|
-
return serializedPackageJson;
|
|
68
|
-
}
|
|
69
|
-
// eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
|
|
70
|
-
return readFileSync(filePath);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
Object.setPrototypeOf(virtualFileSystemHost, fileSystemHost);
|
|
74
|
-
return virtualFileSystemHost;
|
|
75
|
-
}
|
|
76
|
-
export function createFileSystemAdapters(dependencies) {
|
|
77
|
-
const { fileSystemHost } = dependencies;
|
|
1
|
+
import { isBoolean } from 'remeda';
|
|
2
|
+
import { isDeclarationFile, isTypesRootFolder } from "./file-host-predicates.js";
|
|
3
|
+
import { bindRequiredMethod, syncMethodNames } from "./host-method-binding.js";
|
|
4
|
+
import { createNodeModulesManifestSynthesizingHost } from "./node-modules-manifest-synthesizer.js";
|
|
5
|
+
import { createVirtualPackageJsonHost } from "./virtual-package-json-host.js";
|
|
6
|
+
function createDeclarationFilteringHost(fileSystemHost) {
|
|
78
7
|
const fileExistsSync = bindRequiredMethod(fileSystemHost, syncMethodNames.fileExists, 'a boolean', isBoolean);
|
|
79
8
|
const directoryExistsSync = bindRequiredMethod(fileSystemHost, syncMethodNames.directoryExists, 'a boolean', isBoolean);
|
|
80
|
-
const
|
|
9
|
+
const filteringHost = {
|
|
81
10
|
...fileSystemHost,
|
|
82
11
|
fileExists: async (filePath) => {
|
|
83
12
|
if (isDeclarationFile(filePath)) {
|
|
@@ -106,10 +35,15 @@ export function createFileSystemAdapters(dependencies) {
|
|
|
106
35
|
return directoryExistsSync(directoryPath);
|
|
107
36
|
}
|
|
108
37
|
};
|
|
109
|
-
Object.setPrototypeOf(
|
|
38
|
+
Object.setPrototypeOf(filteringHost, fileSystemHost);
|
|
39
|
+
return filteringHost;
|
|
40
|
+
}
|
|
41
|
+
export function createFileSystemAdapters(dependencies) {
|
|
42
|
+
const { fileSystemHost } = dependencies;
|
|
43
|
+
const synthesizingHost = createNodeModulesManifestSynthesizingHost(fileSystemHost);
|
|
110
44
|
return {
|
|
111
|
-
fileSystemHostWithoutFilter:
|
|
112
|
-
fileSystemHostFilteringDeclarationFiles,
|
|
45
|
+
fileSystemHostWithoutFilter: synthesizingHost,
|
|
46
|
+
fileSystemHostFilteringDeclarationFiles: createDeclarationFilteringHost(synthesizingHost),
|
|
113
47
|
withVirtualPackageJson: createVirtualPackageJsonHost
|
|
114
48
|
};
|
|
115
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-file-host.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-file-host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript-file-host.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-file-host.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,yCAAyC,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAgB9E,SAAS,8BAA8B,CAAC,cAA8B;IAClE,MAAM,cAAc,GAAG,kBAAkB,CAAC,cAAc,EAAE,eAAe,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAC9G,MAAM,mBAAmB,GAAG,kBAAkB,CAC1C,cAAc,EACd,eAAe,CAAC,eAAe,EAC/B,WAAW,EACX,SAAS,CACZ,CAAC;IAEF,MAAM,aAAa,GAAmB;QAClC,GAAG,cAAc;QACjB,UAAU,EAAE,KAAK,EAAE,QAAgB,EAAoB,EAAE;YACrD,I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1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import type { Project as _Project, SourceFile } from 'ts-morph';
|
|
2
|
+
import type { ModuleReference } from './source-file-references.ts';
|
|
3
|
+
import { type AnalyzationOptions } from './typescript-compiler-options.ts';
|
|
3
4
|
import type { FileSystemAdapters } from './typescript-file-host.ts';
|
|
4
|
-
export {};
|
|
5
5
|
//# sourceMappingURL=typescript-project-analyzer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-project-analyzer.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-project-analyzer.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"typescript-project-analyzer.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-project-analyzer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,IAAI,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B;AAClE,OAAO,EAAuC,KAAK,kBAAkB,EAAE,MAAM,kCAAkC;AAC/G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B"}
|
|
@@ -1,32 +1,13 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import {
|
|
2
|
+
import { analyzationOptionsToCompilerOptions } from "./typescript-compiler-options.js";
|
|
3
3
|
export function getSourcePathFromSourceFile(sourceFile) {
|
|
4
|
-
|
|
5
|
-
return filePath;
|
|
6
|
-
}
|
|
7
|
-
function analyzationOptionsToCompilerOptions(options) {
|
|
8
|
-
const { resolveDeclarationFiles } = options;
|
|
9
|
-
const compilerOptions = {
|
|
10
|
-
moduleResolution: ModuleResolutionKind.Node16,
|
|
11
|
-
esModuleInterop: true,
|
|
12
|
-
maxNodeModuleJsDepth: 1,
|
|
13
|
-
noEmit: true,
|
|
14
|
-
allowJs: true,
|
|
15
|
-
noLib: true,
|
|
16
|
-
skipLibCheck: true,
|
|
17
|
-
module: ModuleKind.Node16,
|
|
18
|
-
resolvePackageJsonImports: true
|
|
19
|
-
};
|
|
20
|
-
if (!resolveDeclarationFiles) {
|
|
21
|
-
compilerOptions.types = [];
|
|
22
|
-
compilerOptions.typeRoots = [];
|
|
23
|
-
}
|
|
24
|
-
return compilerOptions;
|
|
4
|
+
return sourceFile.getFilePath();
|
|
25
5
|
}
|
|
26
6
|
export function createTypescriptProjectAnalyzer(dependencies) {
|
|
27
|
-
const { fileSystemAdapters, Project,
|
|
7
|
+
const { fileSystemAdapters, Project, getReferencedModules } = dependencies;
|
|
28
8
|
return {
|
|
29
9
|
analyzeProject(folder, options) {
|
|
10
|
+
const packageJsonPath = path.join(folder, 'package.json');
|
|
30
11
|
const project = new Project({
|
|
31
12
|
compilerOptions: analyzationOptionsToCompilerOptions(options),
|
|
32
13
|
fileSystem: fileSystemAdapters.withVirtualPackageJson(options.resolveDeclarationFiles
|
|
@@ -37,13 +18,12 @@ export function createTypescriptProjectAnalyzer(dependencies) {
|
|
|
37
18
|
const filesPattern = path.join(folder, `**/*${fileExtension}`);
|
|
38
19
|
project.addSourceFilesAtPaths([filesPattern]);
|
|
39
20
|
return {
|
|
40
|
-
|
|
21
|
+
getReferencedModules(containingSourceFilePath) {
|
|
41
22
|
const currentSourceFile = project.getSourceFile(containingSourceFilePath);
|
|
42
23
|
if (currentSourceFile === undefined) {
|
|
43
24
|
return [];
|
|
44
25
|
}
|
|
45
|
-
|
|
46
|
-
return referencedSourceFilePaths;
|
|
26
|
+
return getReferencedModules(currentSourceFile, packageJsonPath);
|
|
47
27
|
},
|
|
48
28
|
getProject() {
|
|
49
29
|
return project;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-project-analyzer.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-project-analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"typescript-project-analyzer.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AAE,CAAC;oBACd,CAAC;oBAED,OAAO,oBAAoB,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;gBACpE,CAAC;gBAED,UAAU;oBACN,OAAO,OAAO,CAAC;gBACnB,CAAC;aACJ,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { isBoolean, isString } from 'remeda';
|
|
3
|
+
import { bindRequiredMethod, syncMethodNames } from "./host-method-binding.js";
|
|
4
|
+
const packageJsonIndentationSpaces = 2;
|
|
5
|
+
function serializeMainPackageJson(mainPackageJson) {
|
|
6
|
+
return JSON.stringify(mainPackageJson, null, packageJsonIndentationSpaces);
|
|
7
|
+
}
|
|
8
|
+
export function createVirtualPackageJsonHost(fileSystemHost, folder, mainPackageJson) {
|
|
9
|
+
const packageJsonPath = path.resolve(folder, 'package.json');
|
|
10
|
+
const serializedPackageJson = serializeMainPackageJson(mainPackageJson);
|
|
11
|
+
const fileExistsSync = bindRequiredMethod(fileSystemHost, syncMethodNames.fileExists, 'a boolean', isBoolean);
|
|
12
|
+
const readFileSync = bindRequiredMethod(fileSystemHost, syncMethodNames.readFile, 'a string', isString);
|
|
13
|
+
const virtualFileSystemHost = {
|
|
14
|
+
...fileSystemHost,
|
|
15
|
+
fileExists: async (filePath) => {
|
|
16
|
+
if (path.resolve(filePath) === packageJsonPath) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
return fileSystemHost.fileExists(filePath);
|
|
20
|
+
},
|
|
21
|
+
[syncMethodNames.fileExists]: (filePath) => {
|
|
22
|
+
if (path.resolve(filePath) === packageJsonPath) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
// eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
|
|
26
|
+
return fileExistsSync(filePath);
|
|
27
|
+
},
|
|
28
|
+
readFile: async (filePath, encoding) => {
|
|
29
|
+
if (path.resolve(filePath) === packageJsonPath) {
|
|
30
|
+
return serializedPackageJson;
|
|
31
|
+
}
|
|
32
|
+
return fileSystemHost.readFile(filePath, encoding);
|
|
33
|
+
},
|
|
34
|
+
[syncMethodNames.readFile]: (filePath) => {
|
|
35
|
+
if (path.resolve(filePath) === packageJsonPath) {
|
|
36
|
+
return serializedPackageJson;
|
|
37
|
+
}
|
|
38
|
+
// eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
|
|
39
|
+
return readFileSync(filePath);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
Object.setPrototypeOf(virtualFileSystemHost, fileSystemHost);
|
|
43
|
+
return virtualFileSystemHost;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=virtual-package-json-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-package-json-host.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/virtual-package-json-host.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE/E,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC,SAAS,wBAAwB,CAAC,eAAgC;IAC9D,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,4BAA4B,CAAC,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,4BAA4B,CACxC,cAA8B,EAC9B,MAAc,EACd,eAAgC;IAEhC,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7D,MAAM,qBAAqB,GAAG,wBAAwB,CAAC,eAAe,CAAC,CAAC;IACxE,MAAM,cAAc,GAAG,kBAAkB,CAAC,cAAc,EAAE,eAAe,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAA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