packtory 0.0.96 → 0.0.98
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.js +37 -4
- package/artifacts/artifacts-builder.js.map +1 -1
- package/artifacts/content-collection.js +59 -2
- package/artifacts/content-collection.js.map +1 -1
- package/artifacts/folder-writer.js +25 -2
- package/artifacts/folder-writer.js.map +1 -1
- package/bundle-emitter/emitter.js +137 -6
- package/bundle-emitter/emitter.js.map +1 -1
- package/bundle-emitter/extract-package-tarball.js +13 -2
- package/bundle-emitter/extract-package-tarball.js.map +1 -1
- package/bundle-emitter/fetch-published-artifacts.js +19 -2
- package/bundle-emitter/fetch-published-artifacts.js.map +1 -1
- package/bundle-emitter/publication-outcome.js +5 -0
- package/bundle-emitter/publication-outcome.js.map +1 -1
- package/bundle-emitter/publish-error/auto-mode-error-matching.js +28 -2
- package/bundle-emitter/publish-error/auto-mode-error-matching.js.map +1 -1
- package/bundle-emitter/publish-error/error-shape-helpers.js +9 -0
- package/bundle-emitter/publish-error/error-shape-helpers.js.map +1 -1
- package/bundle-emitter/publish-error/file-mode-error-matching.js +33 -2
- package/bundle-emitter/publish-error/file-mode-error-matching.js.map +1 -1
- package/bundle-emitter/publish-error/publish-error-messages.js +24 -0
- package/bundle-emitter/publish-error/publish-error-messages.js.map +1 -1
- package/bundle-emitter/registry/metadata-auth-retry.js +24 -1
- package/bundle-emitter/registry/metadata-auth-retry.js.map +1 -1
- package/bundle-emitter/registry/oidc-token-exchange.js +68 -3
- package/bundle-emitter/registry/oidc-token-exchange.js.map +1 -1
- package/bundle-emitter/registry/package-metadata-fetcher.js +210 -7
- package/bundle-emitter/registry/package-metadata-fetcher.js.map +1 -1
- package/bundle-emitter/registry/publish-settings-bridge.js +34 -3
- package/bundle-emitter/registry/publish-settings-bridge.js.map +1 -1
- package/bundle-emitter/registry/registry-auth-config.js +106 -0
- package/bundle-emitter/registry/registry-auth-config.js.map +1 -1
- package/bundle-emitter/registry/registry-client.js +74 -4
- package/bundle-emitter/registry/registry-client.js.map +1 -1
- package/bundle-emitter/registry/registry-package-path.js +3 -0
- package/bundle-emitter/registry/registry-package-path.js.map +1 -1
- package/bundle-emitter/registry/registry-response-schemas.js +50 -2
- package/bundle-emitter/registry/registry-response-schemas.js.map +1 -1
- package/bundle-emitter/registry/tarball-integrity.js +31 -1
- package/bundle-emitter/registry/tarball-integrity.js.map +1 -1
- package/bundle-emitter/registry/validate-tarball-host.js +26 -1
- package/bundle-emitter/registry/validate-tarball-host.js.map +1 -1
- package/bundle-emitter/release-artifact-canonicalizer.js +31 -5
- package/bundle-emitter/release-artifact-canonicalizer.js.map +1 -1
- package/checks/check-runner.js +8 -0
- package/checks/check-runner.js.map +1 -1
- package/checks/rule.js +12 -2
- package/checks/rule.js.map +1 -1
- package/checks/rules/duplicate-detection.js +23 -1
- package/checks/rules/duplicate-detection.js.map +1 -1
- package/checks/rules/duplicate-messages.js +22 -0
- package/checks/rules/duplicate-messages.js.map +1 -1
- package/checks/rules/file-ownership.js +15 -0
- package/checks/rules/file-ownership.js.map +1 -1
- package/checks/rules/max-bundle-size.js +55 -1
- package/checks/rules/max-bundle-size.js.map +1 -1
- package/checks/rules/no-dev-dependency-imports.js +51 -1
- package/checks/rules/no-dev-dependency-imports.js.map +1 -1
- package/checks/rules/no-duplicated-files.js +53 -3
- package/checks/rules/no-duplicated-files.js.map +1 -1
- package/checks/rules/no-side-effects.js +50 -1
- package/checks/rules/no-side-effects.js.map +1 -1
- package/checks/rules/no-unexposed-executables.js +43 -2
- package/checks/rules/no-unexposed-executables.js.map +1 -1
- package/checks/rules/no-unused-bundle-dependencies.js +30 -2
- package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
- package/checks/rules/registry.js +22 -9
- package/checks/rules/registry.js.map +1 -1
- package/checks/rules/required-files.js +41 -3
- package/checks/rules/required-files.js.map +1 -1
- package/checks/rules/type-script-declaration-integrity.js +81 -3
- package/checks/rules/type-script-declaration-integrity.js.map +1 -1
- package/checks/rules/type-script-declaration-paths.js +55 -1
- package/checks/rules/type-script-declaration-paths.js.map +1 -1
- package/checks/rules/type-script-declaration-project.js +202 -3
- package/checks/rules/type-script-declaration-project.js.map +1 -1
- package/checks/rules/type-script-declaration-reachability.js +38 -2
- package/checks/rules/type-script-declaration-reachability.js.map +1 -1
- package/checks/rules/type-script-declaration-roots.js +29 -0
- package/checks/rules/type-script-declaration-roots.js.map +1 -1
- package/checks/rules/type-script-integrity.js +72 -2
- package/checks/rules/type-script-integrity.js.map +1 -1
- package/checks/rules/type-script-package-resolution.js +42 -1
- package/checks/rules/type-script-package-resolution.js.map +1 -1
- package/checks/rules/type-script-resolution-summary.js +53 -0
- package/checks/rules/type-script-resolution-summary.js.map +1 -1
- package/checks/rules/unique-target-paths.js +34 -2
- package/checks/rules/unique-target-paths.js.map +1 -1
- package/common/bundled-dependency-groups.js +27 -0
- package/common/bundled-dependency-groups.js.map +1 -1
- package/common/code-files.js +28 -0
- package/common/code-files.js.map +1 -1
- package/common/declaration-companion-paths.js +24 -0
- package/common/declaration-companion-paths.js.map +1 -1
- package/common/package-name-map.js +7 -0
- package/common/package-name-map.js.map +1 -1
- package/common/stable-json.js +42 -2
- package/common/stable-json.js.map +1 -1
- package/common/worklist.js +22 -0
- package/common/worklist.js.map +1 -1
- package/config/additional-files.js +6 -2
- package/config/additional-files.js.map +1 -1
- package/config/additional-package-json-attributes-schema.js +6 -2
- package/config/additional-package-json-attributes-schema.js.map +1 -1
- package/config/automatic-versioning-settings.js +6 -2
- package/config/automatic-versioning-settings.js.map +1 -1
- package/config/changelog-settings.js +120 -3
- package/config/changelog-settings.js.map +1 -1
- package/config/common-package-settings-schemas.js +19 -3
- package/config/common-package-settings-schemas.js.map +1 -1
- package/config/config.js +3 -1
- package/config/config.js.map +1 -1
- package/config/cross-package-validation.js +17 -0
- package/config/cross-package-validation.js.map +1 -1
- package/config/dead-code-elimination-settings.js +36 -2
- package/config/dead-code-elimination-settings.js.map +1 -1
- package/config/dependency-existence-validation.js +19 -1
- package/config/dependency-existence-validation.js.map +1 -1
- package/config/dependency-policy.js +5 -2
- package/config/dependency-policy.js.map +1 -1
- package/config/main-package-json-schema.js +11 -2
- package/config/main-package-json-schema.js.map +1 -1
- package/config/manual-versioning-settings.d.ts +12 -0
- package/config/manual-versioning-settings.d.ts.map +1 -1
- package/config/manual-versioning-settings.js +29 -2
- package/config/manual-versioning-settings.js.map +1 -1
- package/config/optional-package-settings-schema.js +16 -7
- package/config/optional-package-settings-schema.js.map +1 -1
- package/config/package-config.js +2 -1
- package/config/package-config.js.map +1 -1
- package/config/package-graph-builder.js +14 -2
- package/config/package-graph-builder.js.map +1 -1
- package/config/package-interface.js +25 -2
- package/config/package-interface.js.map +1 -1
- package/config/package-json.d.ts.map +1 -1
- package/config/package-json.js +16 -0
- package/config/package-json.js.map +1 -1
- package/config/packtory-config-without-registry-schema.js +6 -0
- package/config/packtory-config-without-registry-schema.js.map +1 -1
- package/config/per-package-settings-schema.js +22 -6
- package/config/per-package-settings-schema.js.map +1 -1
- package/config/pre-graph-validation.js +20 -5
- package/config/pre-graph-validation.js.map +1 -1
- package/config/publish-settings.js +25 -3
- package/config/publish-settings.js.map +1 -1
- package/config/publish-settings.report.js +17 -1
- package/config/publish-settings.report.js.map +1 -1
- package/config/registry-settings.js +40 -2
- package/config/registry-settings.js.map +1 -1
- package/config/registry-settings.report.js +46 -0
- package/config/registry-settings.report.js.map +1 -1
- package/config/root-config-validation.js +141 -0
- package/config/root-config-validation.js.map +1 -1
- package/config/root.js +6 -2
- package/config/root.js.map +1 -1
- package/config/sbom-settings.js +4 -1
- package/config/sbom-settings.js.map +1 -1
- package/config/settings-validation.js +28 -0
- package/config/settings-validation.js.map +1 -1
- package/config/versioning-settings.js +10 -3
- package/config/versioning-settings.js.map +1 -1
- package/dead-code-eliminator/analyzed-bundle.js +7 -0
- package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
- package/dead-code-eliminator/artifact-module-reference-contract.js +27 -0
- package/dead-code-eliminator/artifact-module-reference-contract.js.map +1 -0
- package/dead-code-eliminator/bundle-analysis.js +38 -5
- package/dead-code-eliminator/bundle-analysis.js.map +1 -1
- package/dead-code-eliminator/class-purity.js +48 -2
- package/dead-code-eliminator/class-purity.js.map +1 -1
- package/dead-code-eliminator/code-file-analyzer.js +68 -4
- package/dead-code-eliminator/code-file-analyzer.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/bundle-index.js +10 -0
- package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +22 -3
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/import-export-walker.js +164 -3
- package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/seed-store.js +10 -0
- package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -1
- package/dead-code-eliminator/dependency-metadata.js +172 -2
- package/dead-code-eliminator/dependency-metadata.js.map +1 -1
- package/dead-code-eliminator/elimination-emitter.js +52 -0
- package/dead-code-eliminator/elimination-emitter.js.map +1 -1
- package/dead-code-eliminator/eliminator.js +22 -4
- package/dead-code-eliminator/eliminator.js.map +1 -1
- package/dead-code-eliminator/expression-unwrapping.js +16 -1
- package/dead-code-eliminator/expression-unwrapping.js.map +1 -1
- package/dead-code-eliminator/imported-expression-origin.js +101 -2
- package/dead-code-eliminator/imported-expression-origin.js.map +1 -1
- package/dead-code-eliminator/liveness/asset-side-effects.js +9 -1
- package/dead-code-eliminator/liveness/asset-side-effects.js.map +1 -1
- package/dead-code-eliminator/liveness/boolean-facts.js +98 -2
- package/dead-code-eliminator/liveness/boolean-facts.js.map +1 -1
- package/dead-code-eliminator/liveness/external-purity-summary.js +314 -3
- package/dead-code-eliminator/liveness/external-purity-summary.js.map +1 -1
- package/dead-code-eliminator/liveness/external-purity.js +39 -3
- package/dead-code-eliminator/liveness/external-purity.js.map +1 -1
- package/dead-code-eliminator/liveness/module-analysis.js +27 -2
- package/dead-code-eliminator/liveness/module-analysis.js.map +1 -1
- package/dead-code-eliminator/liveness/resource-retention.js +91 -1
- package/dead-code-eliminator/liveness/resource-retention.js.map +1 -1
- package/dead-code-eliminator/liveness/runtime-code.js +15 -1
- package/dead-code-eliminator/liveness/runtime-code.js.map +1 -1
- package/dead-code-eliminator/load-bundle.js +86 -5
- package/dead-code-eliminator/load-bundle.js.map +1 -1
- package/dead-code-eliminator/pure-expression.js +178 -5
- package/dead-code-eliminator/pure-expression.js.map +1 -1
- package/dead-code-eliminator/reachability/bfs-closure.js +53 -0
- package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -1
- package/dead-code-eliminator/reachability/binding-extractor.js +100 -2
- package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
- package/dead-code-eliminator/reachability/binding-id.js +106 -1
- package/dead-code-eliminator/reachability/binding-id.js.map +1 -1
- package/dead-code-eliminator/reachability/identifier-target-collector.js +96 -1
- package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -1
- package/dead-code-eliminator/reachability/impure-statements.js +11 -2
- package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
- package/dead-code-eliminator/reachability/local-seed-gathering.js +91 -4
- package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -1
- package/dead-code-eliminator/reachability/reachability.js +70 -4
- package/dead-code-eliminator/reachability/reachability.js.map +1 -1
- package/dead-code-eliminator/side-effect-classifier.js +39 -4
- package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
- package/dead-code-eliminator/side-effects-field.js +23 -1
- package/dead-code-eliminator/side-effects-field.js.map +1 -1
- package/dead-code-eliminator/source-map-recomposition.js +29 -2
- package/dead-code-eliminator/source-map-recomposition.js.map +1 -1
- package/dead-code-eliminator/statement-classifiers.js +94 -4
- package/dead-code-eliminator/statement-classifiers.js.map +1 -1
- package/dead-code-eliminator/syntax-kind-sets.js +16 -0
- package/dead-code-eliminator/syntax-kind-sets.js.map +1 -1
- package/dead-code-eliminator/transform/atom-translator.js +57 -2
- package/dead-code-eliminator/transform/atom-translator.js.map +1 -1
- package/dead-code-eliminator/transform/declaration-removal.js +183 -5
- package/dead-code-eliminator/transform/declaration-removal.js.map +1 -1
- package/dead-code-eliminator/transform/declaration-remover.js +17 -2
- package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
- package/dead-code-eliminator/transform/line-index.js +20 -0
- package/dead-code-eliminator/transform/line-index.js.map +1 -1
- package/dead-code-eliminator/transform/named-declaration-kinds.js +3 -0
- package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -1
- package/dead-code-eliminator/transform/source-map-composer.js +84 -3
- package/dead-code-eliminator/transform/source-map-composer.js.map +1 -1
- package/dead-code-eliminator/variable-declaration-bindings.js +25 -1
- package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -1
- package/dependency-scanner/dependency-graph.js +77 -3
- package/dependency-scanner/dependency-graph.js.map +1 -1
- package/dependency-scanner/external-dependencies.js +55 -1
- package/dependency-scanner/external-dependencies.js.map +1 -1
- package/dependency-scanner/file-host-predicates.js +9 -0
- package/dependency-scanner/file-host-predicates.js.map +1 -1
- package/dependency-scanner/host-method-binding.js +18 -0
- package/dependency-scanner/host-method-binding.js.map +1 -1
- package/dependency-scanner/injected-dynamic-imports.js +232 -1
- package/dependency-scanner/injected-dynamic-imports.js.map +1 -1
- package/dependency-scanner/node-modules-manifest-synthesizer.js +52 -4
- package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -1
- package/dependency-scanner/package-owned-asset-file-path.js +9 -1
- package/dependency-scanner/package-owned-asset-file-path.js.map +1 -1
- package/dependency-scanner/scanner.js +109 -4
- package/dependency-scanner/scanner.js.map +1 -1
- package/dependency-scanner/source-file-references.js +171 -6
- package/dependency-scanner/source-file-references.js.map +1 -1
- package/dependency-scanner/source-map-file-locator.js +66 -2
- package/dependency-scanner/source-map-file-locator.js.map +1 -1
- package/dependency-scanner/typescript-compiler-options.js +21 -1
- package/dependency-scanner/typescript-compiler-options.js.map +1 -1
- package/dependency-scanner/typescript-file-host.js +49 -5
- package/dependency-scanner/typescript-file-host.js.map +1 -1
- package/dependency-scanner/typescript-module-resolution.js +214 -0
- package/dependency-scanner/typescript-module-resolution.js.map +1 -0
- package/dependency-scanner/typescript-project-analyzer.js +32 -3
- package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
- package/dependency-scanner/virtual-package-json-host.js +45 -4
- package/dependency-scanner/virtual-package-json-host.js.map +1 -1
- package/directed-graph/graph.js +240 -1
- package/directed-graph/graph.js.map +1 -1
- package/file-manager/compare.js +23 -2
- package/file-manager/compare.js.map +1 -1
- package/file-manager/equal.js +5 -0
- package/file-manager/equal.js.map +1 -1
- package/file-manager/file-description.js +3 -0
- package/file-manager/file-description.js.map +1 -1
- package/file-manager/permissions.js +28 -1
- package/file-manager/permissions.js.map +1 -1
- package/git/current-git-head.js +24 -0
- package/git/current-git-head.js.map +1 -1
- package/git/git-command.js +49 -1
- package/git/git-command.js.map +1 -1
- package/linker/linked-bundle.js +5 -0
- package/linker/linked-bundle.js.map +1 -1
- package/linker/linker.js +51 -5
- package/linker/linker.js.map +1 -1
- package/linker/replacement-lookup.js +297 -8
- package/linker/replacement-lookup.js.map +1 -1
- package/linker/resource-graph.js +65 -2
- package/linker/resource-graph.js.map +1 -1
- package/linker/source-modifier/import-paths.js +80 -3
- package/linker/source-modifier/import-paths.js.map +1 -1
- package/linker/substitute-bundles.js +166 -3
- package/linker/substitute-bundles.js.map +1 -1
- package/linker/substituted-resource-graph.js +111 -2
- package/linker/substituted-resource-graph.js.map +1 -1
- package/npm-oidc-id-token-resolver.js +82 -0
- package/npm-oidc-id-token-resolver.js.map +1 -1
- package/pack-emitter/pack-emitter.js +27 -0
- package/pack-emitter/pack-emitter.js.map +1 -1
- package/package-surface/bin-field.js +8 -2
- package/package-surface/bin-field.js.map +1 -1
- package/package-surface/explicit-bin.js +24 -2
- package/package-surface/explicit-bin.js.map +1 -1
- package/package-surface/explicit-exports.js +26 -3
- package/package-surface/explicit-exports.js.map +1 -1
- package/package-surface/export-map.js +9 -2
- package/package-surface/export-map.js.map +1 -1
- package/package-surface/implicit-bin.js +25 -1
- package/package-surface/implicit-bin.js.map +1 -1
- package/package-surface/implicit-exports.js +10 -3
- package/package-surface/implicit-exports.js.map +1 -1
- package/package-surface/implicit-root-exports.js +13 -2
- package/package-surface/implicit-root-exports.js.map +1 -1
- package/package-surface/package-json-export.js +9 -0
- package/package-surface/package-json-export.js.map +1 -1
- package/package-surface/package-shape.js +10 -1
- package/package-surface/package-shape.js.map +1 -1
- package/package-surface/package-surface-index.js +165 -3
- package/package-surface/package-surface-index.js.map +1 -1
- package/package-surface/public-module-usage.js +46 -3
- package/package-surface/public-module-usage.js.map +1 -1
- package/package-surface/public-specifiers.js +7 -1
- package/package-surface/public-specifiers.js.map +1 -1
- package/package-surface/root-registry.js +26 -0
- package/package-surface/root-registry.js.map +1 -1
- package/package-surface/specifier-syntax.js +4 -0
- package/package-surface/specifier-syntax.js.map +1 -1
- package/package-surface/substitution-exports.js +101 -3
- package/package-surface/substitution-exports.js.map +1 -1
- package/package-surface/surface.js +12 -0
- package/package-surface/surface.js.map +1 -1
- package/package.json +2 -2
- package/packages/package-processor.composition.js +161 -34
- package/packages/package-processor.composition.js.map +1 -1
- package/packtory/map-config.js +35 -4
- package/packtory/map-config.js.map +1 -1
- package/packtory/normalize-paths.js +25 -1
- package/packtory/normalize-paths.js.map +1 -1
- package/packtory/options/bundle-dependency-resolution.js +17 -1
- package/packtory/options/bundle-dependency-resolution.js.map +1 -1
- package/packtory/options/dead-code-elimination-resolution.js +10 -1
- package/packtory/options/dead-code-elimination-resolution.js.map +1 -1
- package/packtory/options/prepare-package-options.js +46 -5
- package/packtory/options/prepare-package-options.js.map +1 -1
- package/packtory/options/required-value-helpers.js +17 -0
- package/packtory/options/required-value-helpers.js.map +1 -1
- package/packtory/options/setting-resolvers.js +47 -3
- package/packtory/options/setting-resolvers.js.map +1 -1
- package/packtory/options/surface-resolution.js +15 -2
- package/packtory/options/surface-resolution.js.map +1 -1
- package/packtory/options/version-provider-context.js +24 -2
- package/packtory/options/version-provider-context.js.map +1 -1
- package/packtory/options/version-trigger.js +39 -2
- package/packtory/options/version-trigger.js.map +1 -1
- package/packtory/pack-output-preflight.js +60 -3
- package/packtory/pack-output-preflight.js.map +1 -1
- package/packtory/package-processor-build.js +97 -3
- package/packtory/package-processor-build.js.map +1 -1
- package/packtory/package-processor-publish.js +297 -6
- package/packtory/package-processor-publish.js.map +1 -1
- package/packtory/package-processor.js +10 -2
- package/packtory/package-processor.js.map +1 -1
- package/packtory/packtory-pack.js +298 -10
- package/packtory/packtory-pack.js.map +1 -1
- package/packtory/packtory-package-dependencies.js +116 -2
- package/packtory/packtory-package-dependencies.js.map +1 -1
- package/packtory/packtory-package-inspection.js +26 -5
- package/packtory/packtory-package-inspection.js.map +1 -1
- package/packtory/packtory-package-side-effects.js +64 -3
- package/packtory/packtory-package-side-effects.js.map +1 -1
- package/packtory/packtory-package-tree.js +43 -4
- package/packtory/packtory-package-tree.js.map +1 -1
- package/packtory/packtory-publish.js +17 -4
- package/packtory/packtory-publish.js.map +1 -1
- package/packtory/packtory-release-analysis.js +64 -6
- package/packtory/packtory-release-analysis.js.map +1 -1
- package/packtory/packtory-release-diff.js +48 -5
- package/packtory/packtory-release-diff.js.map +1 -1
- package/packtory/packtory-release-plan.js +87 -6
- package/packtory/packtory-release-plan.js.map +1 -1
- package/packtory/packtory-resolve.js +16 -5
- package/packtory/packtory-resolve.js.map +1 -1
- package/packtory/packtory.js +242 -13
- package/packtory/packtory.js.map +1 -1
- package/packtory/publish-failure-mapping.js +6 -0
- package/packtory/publish-failure-mapping.js.map +1 -1
- package/packtory/publish-target-preflight.js +25 -3
- package/packtory/publish-target-preflight.js.map +1 -1
- package/packtory/published-release-state.js +11 -0
- package/packtory/published-release-state.js.map +1 -1
- package/packtory/release-analysis.js +153 -5
- package/packtory/release-analysis.js.map +1 -1
- package/packtory/release-diff-failure-mapping.js +6 -0
- package/packtory/release-diff-failure-mapping.js.map +1 -1
- package/packtory/release-plan.js +135 -7
- package/packtory/release-plan.js.map +1 -1
- package/packtory/report-attachment.js +35 -2
- package/packtory/report-attachment.js.map +1 -1
- package/packtory/resolved-package.js +97 -3
- package/packtory/resolved-package.js.map +1 -1
- package/packtory/scheduler.js +99 -1
- package/packtory/scheduler.js.map +1 -1
- package/packtory/stages/package-analysis-stage.js +50 -2
- package/packtory/stages/package-analysis-stage.js.map +1 -1
- package/packtory/stages/package-resolution-stage.js +80 -5
- package/packtory/stages/package-resolution-stage.js.map +1 -1
- package/packtory/stages/publish-stage.js +125 -4
- package/packtory/stages/publish-stage.js.map +1 -1
- package/packtory/stages/release-diff-stage.js +84 -5
- package/packtory/stages/release-diff-stage.js.map +1 -1
- package/progress/progress-broadcaster.js +45 -0
- package/progress/progress-broadcaster.js.map +1 -1
- package/published-package/published-package.js +12 -1
- package/published-package/published-package.js.map +1 -1
- package/report/aggregator/artifact-entry-merger.js +20 -0
- package/report/aggregator/artifact-entry-merger.js.map +1 -1
- package/report/aggregator/package-report-materialization.js +75 -2
- package/report/aggregator/package-report-materialization.js.map +1 -1
- package/report/aggregator/report-aggregator.js +37 -2
- package/report/aggregator/report-aggregator.js.map +1 -1
- package/report/aggregator/report-event-handlers.js +141 -2
- package/report/aggregator/report-event-handlers.js.map +1 -1
- package/report/aggregator/report-types.js +3 -0
- package/report/aggregator/report-types.js.map +1 -1
- package/report/config-redactor.js +29 -3
- package/report/config-redactor.js.map +1 -1
- package/report/decorators.js +85 -0
- package/report/decorators.js.map +1 -1
- package/report/inspectors/inspect-artifact-sizes.js +34 -1
- package/report/inspectors/inspect-artifact-sizes.js.map +1 -1
- package/report/inspectors/inspect-linker-rewrites.js +14 -1
- package/report/inspectors/inspect-linker-rewrites.js.map +1 -1
- package/report/inspectors/inspect-package-json-provenance.js +15 -0
- package/report/inspectors/inspect-package-json-provenance.js.map +1 -1
- package/report/inspectors/inspect-scan-results.js +15 -0
- package/report/inspectors/inspect-scan-results.js.map +1 -1
- package/report/release-diff/release-version-transition.js +18 -0
- package/report/release-diff/release-version-transition.js.map +1 -1
- package/resource-resolver/bundle-resource-lookup.js +25 -0
- package/resource-resolver/bundle-resource-lookup.js.map +1 -1
- package/resource-resolver/content.js +136 -4
- package/resource-resolver/content.js.map +1 -1
- package/resource-resolver/dependency-resolution-walker.js +73 -2
- package/resource-resolver/dependency-resolution-walker.js.map +1 -1
- package/resource-resolver/resolved-bundle.js +3 -0
- package/resource-resolver/resolved-bundle.js.map +1 -1
- package/resource-resolver/resource-resolve-options.js +13 -1
- package/resource-resolver/resource-resolve-options.js.map +1 -1
- package/resource-resolver/resource-resolver.js +128 -6
- package/resource-resolver/resource-resolver.js.map +1 -1
- package/sbom/extract-license.js +11 -1
- package/sbom/extract-license.js.map +1 -1
- package/sbom/license-resolver.js +23 -2
- package/sbom/license-resolver.js.map +1 -1
- package/sbom/sbom-builder.js +57 -2
- package/sbom/sbom-builder.js.map +1 -1
- package/sbom/sbom-canonicalizer.js +45 -3
- package/sbom/sbom-canonicalizer.js.map +1 -1
- package/sbom/sbom-file.js +54 -5
- package/sbom/sbom-file.js.map +1 -1
- package/sbom/sbom-serializer.js +14 -1
- package/sbom/sbom-serializer.js.map +1 -1
- package/sbom/tool-version.js +49 -1
- package/sbom/tool-version.js.map +1 -1
- package/sbom.cdx.json +10 -10
- package/tar/extract-tar.js +83 -3
- package/tar/extract-tar.js.map +1 -1
- package/tar/gzipped-pack.js +20 -0
- package/tar/gzipped-pack.js.map +1 -1
- package/tar/tarball-builder.js +44 -4
- package/tar/tarball-builder.js.map +1 -1
- package/vendor-materializer/vendor-entry.js +20 -1
- package/vendor-materializer/vendor-entry.js.map +1 -1
- package/vendor-materializer/vendor-materializer.js +240 -8
- package/vendor-materializer/vendor-materializer.js.map +1 -1
- package/version-manager/dependencies/bundle-dependency-grouping.js +32 -2
- package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -1
- package/version-manager/dependencies/dependency-groups.js +11 -1
- package/version-manager/dependencies/dependency-groups.js.map +1 -1
- package/version-manager/dependencies/external-dependency-classification.js +82 -3
- package/version-manager/dependencies/external-dependency-classification.js.map +1 -1
- package/version-manager/dependencies/versioned-bundle-dependencies.js +8 -3
- package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -1
- package/version-manager/imports/hash-import-scanner.js +20 -2
- package/version-manager/imports/hash-import-scanner.js.map +1 -1
- package/version-manager/imports/imports-key-matcher.js +22 -0
- package/version-manager/imports/imports-key-matcher.js.map +1 -1
- package/version-manager/imports/versioned-bundle-imports.js +44 -2
- package/version-manager/imports/versioned-bundle-imports.js.map +1 -1
- package/version-manager/manager.js +46 -6
- package/version-manager/manager.js.map +1 -1
- package/version-manager/manifest/builder.js +51 -1
- package/version-manager/manifest/builder.js.map +1 -1
- package/version-manager/manifest/serialize.js +8 -1
- package/version-manager/manifest/serialize.js.map +1 -1
- package/version-manager/optional-bundle-fields.js +5 -1
- package/version-manager/optional-bundle-fields.js.map +1 -1
- package/version-manager/representative-root.js +9 -1
- package/version-manager/representative-root.js.map +1 -1
- package/version-manager/specifier-classifier.js +42 -2
- package/version-manager/specifier-classifier.js.map +1 -1
- package/version-manager/specifier-errors.js +58 -0
- package/version-manager/specifier-errors.js.map +1 -1
- package/version-manager/versioned-bundle.js +31 -6
- package/version-manager/versioned-bundle.js.map +1 -1
- package/zip/zip-builder.js +81 -2
- package/zip/zip-builder.js.map +1 -1
- package/dead-code-eliminator/liveness/external-module-resolution.js +0 -3
- package/dead-code-eliminator/liveness/external-module-resolution.js.map +0 -1
|
@@ -1,7 +1,172 @@
|
|
|
1
|
-
import 'node:path';
|
|
2
|
-
import 'node:module';
|
|
3
|
-
import 'common-tags';
|
|
4
|
-
import 'ts-morph';
|
|
5
|
-
import "./injected-dynamic-imports.js";
|
|
6
|
-
import "./package-owned-asset-file-path.js";
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { isBuiltin } from 'node:module';
|
|
3
|
+
import { oneLine } from 'common-tags';
|
|
4
|
+
import { SyntaxKind } from 'ts-morph';
|
|
5
|
+
import { getInjectedDynamicImportLiterals } from "./injected-dynamic-imports.js";
|
|
6
|
+
import { findPackageOwnedAssetFilePath } from "./package-owned-asset-file-path.js";
|
|
7
|
+
import { resolveTypescriptModuleFilePath } from "./typescript-module-resolution.js";
|
|
8
|
+
export const moduleReferenceKind = {
|
|
9
|
+
externalPackage: 'external-package',
|
|
10
|
+
generatedManifest: 'generated-manifest',
|
|
11
|
+
localAsset: 'local-asset',
|
|
12
|
+
localCode: 'local-code'
|
|
13
|
+
};
|
|
14
|
+
function hashImportPrefix() {
|
|
15
|
+
return '#';
|
|
16
|
+
}
|
|
17
|
+
function typesDependenciesFolderPath() {
|
|
18
|
+
return `${path.sep}node_modules${path.sep}@types${path.sep}`;
|
|
19
|
+
}
|
|
20
|
+
function isRelativeOrAbsoluteSpecifier(specifier) {
|
|
21
|
+
return specifier.startsWith('.') || path.isAbsolute(specifier);
|
|
22
|
+
}
|
|
23
|
+
function isHashSpecifier(specifier) {
|
|
24
|
+
return specifier.startsWith(hashImportPrefix());
|
|
25
|
+
}
|
|
26
|
+
const scopedPackageSegmentCount = 2;
|
|
27
|
+
function packageNameFromSpecifier(specifier) {
|
|
28
|
+
if (specifier.startsWith('@')) {
|
|
29
|
+
const [scope, name] = specifier.split('/', scopedPackageSegmentCount);
|
|
30
|
+
if (name === undefined) {
|
|
31
|
+
throw new Error(`Invalid package specifier "${specifier}"`);
|
|
32
|
+
}
|
|
33
|
+
return `${scope}/${name}`;
|
|
34
|
+
}
|
|
35
|
+
const separatorIndex = specifier.indexOf('/');
|
|
36
|
+
return separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);
|
|
37
|
+
}
|
|
38
|
+
function typesPackageNameFromResolvedPath(resolvedFilePath) {
|
|
39
|
+
const normalizedPath = path.normalize(resolvedFilePath);
|
|
40
|
+
const folderPath = typesDependenciesFolderPath();
|
|
41
|
+
const folderIndex = normalizedPath.lastIndexOf(folderPath);
|
|
42
|
+
if (folderIndex === -1) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const relativePath = normalizedPath.slice(folderIndex + folderPath.length);
|
|
46
|
+
const [packageName] = relativePath.split(path.sep);
|
|
47
|
+
return `@types/${packageName}`;
|
|
48
|
+
}
|
|
49
|
+
function externalPackageNameForResolvedImport(importValue, resolvedFilePath, containingSourceFile) {
|
|
50
|
+
if (containingSourceFile.getFilePath().endsWith('.d.ts')) {
|
|
51
|
+
return typesPackageNameFromResolvedPath(resolvedFilePath) ?? packageNameFromSpecifier(importValue);
|
|
52
|
+
}
|
|
53
|
+
return packageNameFromSpecifier(importValue);
|
|
54
|
+
}
|
|
55
|
+
function isLocalAssetReference(filePath) {
|
|
56
|
+
const extension = path.extname(filePath);
|
|
57
|
+
return extension === '.json' || extension === '.wasm';
|
|
58
|
+
}
|
|
59
|
+
function referenceSpecifiers(importValue) {
|
|
60
|
+
return {
|
|
61
|
+
sourceSpecifier: importValue,
|
|
62
|
+
emittedSpecifier: importValue
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function classifyLocalReference(resolvedFilePath, packageJsonPath, importValue) {
|
|
66
|
+
const specifiers = referenceSpecifiers(importValue);
|
|
67
|
+
if (path.resolve(resolvedFilePath) === path.resolve(packageJsonPath)) {
|
|
68
|
+
return { kind: moduleReferenceKind.generatedManifest, filePath: resolvedFilePath, ...specifiers };
|
|
69
|
+
}
|
|
70
|
+
if (isLocalAssetReference(resolvedFilePath)) {
|
|
71
|
+
return { kind: moduleReferenceKind.localAsset, filePath: resolvedFilePath, ...specifiers };
|
|
72
|
+
}
|
|
73
|
+
return { kind: moduleReferenceKind.localCode, filePath: resolvedFilePath, ...specifiers };
|
|
74
|
+
}
|
|
75
|
+
function resolveWasmReference(importValue, containingSourceFile, packageJsonPath) {
|
|
76
|
+
if (isRelativeOrAbsoluteSpecifier(importValue)) {
|
|
77
|
+
const moduleResolutionHost = containingSourceFile.getProject().getModuleResolutionHost();
|
|
78
|
+
const candidatePath = path.resolve(path.dirname(containingSourceFile.getFilePath()), importValue);
|
|
79
|
+
return moduleResolutionHost.fileExists(candidatePath)
|
|
80
|
+
? classifyLocalReference(candidatePath, packageJsonPath, importValue)
|
|
81
|
+
: undefined;
|
|
82
|
+
}
|
|
83
|
+
packageNameFromSpecifier(importValue);
|
|
84
|
+
const moduleResolutionHost = containingSourceFile.getProject().getModuleResolutionHost();
|
|
85
|
+
const resolvedFilePath = findPackageOwnedAssetFilePath(importValue, path.dirname(containingSourceFile.getFilePath()), function (candidatePath) {
|
|
86
|
+
return moduleResolutionHost.fileExists(candidatePath);
|
|
87
|
+
});
|
|
88
|
+
if (resolvedFilePath === undefined) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
kind: moduleReferenceKind.externalPackage,
|
|
93
|
+
packageName: packageNameFromSpecifier(importValue),
|
|
94
|
+
...referenceSpecifiers(importValue)
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function resolveModuleReferenceForImport(importValue, containingSourceFile, packageJsonPath) {
|
|
98
|
+
const resolvedFilePath = resolveTypescriptModuleFilePath({
|
|
99
|
+
moduleSpecifier: importValue,
|
|
100
|
+
containingSourceFile,
|
|
101
|
+
resolutionMode: 'type'
|
|
102
|
+
});
|
|
103
|
+
if (resolvedFilePath !== undefined) {
|
|
104
|
+
if (!isRelativeOrAbsoluteSpecifier(importValue) && !isHashSpecifier(importValue)) {
|
|
105
|
+
return {
|
|
106
|
+
kind: moduleReferenceKind.externalPackage,
|
|
107
|
+
packageName: externalPackageNameForResolvedImport(importValue, resolvedFilePath, containingSourceFile),
|
|
108
|
+
...referenceSpecifiers(importValue)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return classifyLocalReference(resolvedFilePath, packageJsonPath, importValue);
|
|
112
|
+
}
|
|
113
|
+
return importValue.endsWith('.wasm')
|
|
114
|
+
? resolveWasmReference(importValue, containingSourceFile, packageJsonPath)
|
|
115
|
+
: undefined;
|
|
116
|
+
}
|
|
117
|
+
function invalidImportMetaResolveUsage(sourceFile) {
|
|
118
|
+
return new Error(oneLine `Invalid import.meta.resolve() usage in file "${sourceFile.getFilePath()}":
|
|
119
|
+
only a single static string literal argument is supported`);
|
|
120
|
+
}
|
|
121
|
+
function isImportMetaResolveCallee(callee) {
|
|
122
|
+
const metaProperty = callee.getExpression().asKind(SyntaxKind.MetaProperty);
|
|
123
|
+
return metaProperty?.getKeywordToken() === SyntaxKind.ImportKeyword && callee.getNameNode().getText() === 'resolve';
|
|
124
|
+
}
|
|
125
|
+
function collectImportMetaResolveLiteral(callExpression, sourceFile) {
|
|
126
|
+
const callee = callExpression.getExpression().asKind(SyntaxKind.PropertyAccessExpression);
|
|
127
|
+
if (callee === undefined || !isImportMetaResolveCallee(callee)) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
const [first, second] = callExpression.getArguments();
|
|
131
|
+
if (first === undefined || second !== undefined) {
|
|
132
|
+
throw invalidImportMetaResolveUsage(sourceFile);
|
|
133
|
+
}
|
|
134
|
+
const literal = first.asKind(SyntaxKind.StringLiteral);
|
|
135
|
+
if (literal === undefined) {
|
|
136
|
+
throw invalidImportMetaResolveUsage(sourceFile);
|
|
137
|
+
}
|
|
138
|
+
return literal;
|
|
139
|
+
}
|
|
140
|
+
function getImportMetaResolveLiterals(sourceFile) {
|
|
141
|
+
const literals = [];
|
|
142
|
+
for (const callExpression of sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)) {
|
|
143
|
+
const literal = collectImportMetaResolveLiteral(callExpression, sourceFile);
|
|
144
|
+
if (literal !== undefined) {
|
|
145
|
+
literals.push(literal);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return literals;
|
|
149
|
+
}
|
|
150
|
+
export function getModuleReferenceLiterals(sourceFile) {
|
|
151
|
+
return [
|
|
152
|
+
...sourceFile.getImportStringLiterals(),
|
|
153
|
+
...getImportMetaResolveLiterals(sourceFile),
|
|
154
|
+
...getInjectedDynamicImportLiterals(sourceFile)
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
export function getReferencedModules(sourceFile, packageJsonPath) {
|
|
158
|
+
const referencedModules = [];
|
|
159
|
+
const allLiterals = getModuleReferenceLiterals(sourceFile);
|
|
160
|
+
for (const literal of allLiterals) {
|
|
161
|
+
const importValue = literal.getLiteralValue();
|
|
162
|
+
const referencedModule = resolveModuleReferenceForImport(importValue, sourceFile, packageJsonPath);
|
|
163
|
+
if (referencedModule !== undefined) {
|
|
164
|
+
referencedModules.push(referencedModule);
|
|
165
|
+
}
|
|
166
|
+
else if (!isBuiltin(importValue)) {
|
|
167
|
+
throw new Error(`Failed to resolve import "${importValue}" in file "${sourceFile.getFilePath()}"`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return referencedModules;
|
|
171
|
+
}
|
|
7
172
|
//# sourceMappingURL=source-file-references.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-file-references.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-file-references.ts"],"names":[],"mappings":"AAAA,
|
|
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,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EACH,UAAU,EAKb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,MAAM,CAAC,MAAM,mBAA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C;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,UAAgC;IACvE,OAAO;QACH,GAAG,UAAU,CAAC,uBAAuB,EAAE;QACvC,GAAG,4BAA4B,CAAC,UAAU,CAAC;QAC3C,GAAG,gCAAgC,CAAC,UAAU,CAAC;KAClD,CAAC;AACN,CAAC;AAED,MAAM,UAAU,oBAAoB,CAChC,UAAgC,EAChC,eAAuB;IAEvB,MAAM,iBAAiB,GAAsB,EAAE,CAAC;IAChD,MAAM,WAAW,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAE3D,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE,CAAC;QAChC,MAAM,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;QAC9C,MAAM,gBAAgB,GAAG,+BAA+B,CAAC,WAAW,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;QAEnG,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACjC,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7C,CAAC;aAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,6BAA6B,WAAW,cAAc,UAAU,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACvG,CAAC;IACL,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC7B,CAAC"}
|
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
import 'node:path';
|
|
2
|
-
import 'true-myth';
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { Maybe } from 'true-myth';
|
|
3
|
+
function sourceMappingUrlPrefix() {
|
|
4
|
+
return '//# sourceMappingURL=';
|
|
5
|
+
}
|
|
6
|
+
function getSourceMappingUrl(fileContent) {
|
|
7
|
+
const prefix = sourceMappingUrlPrefix();
|
|
8
|
+
for (const line of fileContent.split('\n')) {
|
|
9
|
+
if (line.startsWith(prefix)) {
|
|
10
|
+
const sourceMappingUrl = line.slice(prefix.length);
|
|
11
|
+
return sourceMappingUrl;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
function isUrlLike(filePath) {
|
|
17
|
+
return /^[a-z][\d+.a-z-]*:/iu.test(filePath);
|
|
18
|
+
}
|
|
19
|
+
function isRelativeMapFilePath(filePath) {
|
|
20
|
+
if (path.posix.isAbsolute(filePath) || path.win32.isAbsolute(filePath)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (isUrlLike(filePath) || filePath.includes('?') || filePath.includes('#')) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return path.extname(filePath) === '.map';
|
|
27
|
+
}
|
|
28
|
+
function isInFolder(folder, candidate) {
|
|
29
|
+
const relativePath = path.relative(folder, candidate);
|
|
30
|
+
return relativePath.length > 0 && !relativePath.startsWith('..') && !path.isAbsolute(relativePath);
|
|
31
|
+
}
|
|
32
|
+
function resolveSourceMapFile(sourceFile, sourcesFolder, sourceMappingUrl) {
|
|
33
|
+
if (!isRelativeMapFilePath(sourceMappingUrl)) {
|
|
34
|
+
return Maybe.nothing();
|
|
35
|
+
}
|
|
36
|
+
const sourceMapFile = path.resolve(path.dirname(sourceFile), sourceMappingUrl);
|
|
37
|
+
return isInFolder(path.resolve(sourcesFolder), sourceMapFile) ? Maybe.just(sourceMapFile) : Maybe.nothing();
|
|
38
|
+
}
|
|
39
|
+
export function createSourceMapFileLocator(dependencies) {
|
|
40
|
+
const { fileManager } = dependencies;
|
|
41
|
+
async function isReadableSourceMap(sourcesFolder, sourceMapFile) {
|
|
42
|
+
const { isReadable } = await fileManager.checkReadability(sourceMapFile);
|
|
43
|
+
if (!isReadable) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
const realSourcesFolder = await fileManager.getRealPath(sourcesFolder);
|
|
47
|
+
const realSourceMapFile = await fileManager.getRealPath(sourceMapFile);
|
|
48
|
+
return isInFolder(realSourcesFolder, realSourceMapFile);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
async locate(sourceFile, sourcesFolder) {
|
|
52
|
+
const fileContent = await fileManager.readFile(sourceFile);
|
|
53
|
+
const sourceMappingUrl = getSourceMappingUrl(fileContent);
|
|
54
|
+
if (sourceMappingUrl === undefined) {
|
|
55
|
+
return Maybe.nothing();
|
|
56
|
+
}
|
|
57
|
+
const sourceMapFile = resolveSourceMapFile(sourceFile, sourcesFolder, sourceMappingUrl);
|
|
58
|
+
if (sourceMapFile.isNothing) {
|
|
59
|
+
return Maybe.nothing();
|
|
60
|
+
}
|
|
61
|
+
return await isReadableSourceMap(sourcesFolder, sourceMapFile.value)
|
|
62
|
+
? Maybe.just(sourceMapFile.value)
|
|
63
|
+
: Maybe.nothing();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
3
67
|
//# sourceMappingURL=source-map-file-locator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-map-file-locator.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-map-file-locator.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"source-map-file-locator.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-map-file-locator.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAWlC,SAAS,sBAAsB;IAC3B,OAAO,uBAAuB,CAAC;AACnC,CAAC;AAED,SAAS,mBAAmB,CAAC,WAAmB;IAC5C,MAAM,MAAM,GAAG,sBAAsB,EAAE,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAA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E,aAAa,CAAC,KAAK,CAAC;gBAChE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;gBACjC,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
import 'ts-morph';
|
|
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
|
+
}
|
|
2
22
|
//# sourceMappingURL=typescript-compiler-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-compiler-options.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-compiler-options.ts"],"names":[],"mappings":"AAAA,
|
|
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,6 +1,50 @@
|
|
|
1
|
-
import 'remeda';
|
|
2
|
-
import "./file-host-predicates.js";
|
|
3
|
-
import "./host-method-binding.js";
|
|
4
|
-
import "./node-modules-manifest-synthesizer.js";
|
|
5
|
-
import "./virtual-package-json-host.js";
|
|
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) {
|
|
7
|
+
const fileExistsSync = bindRequiredMethod(fileSystemHost, syncMethodNames.fileExists, 'a boolean', isBoolean);
|
|
8
|
+
const directoryExistsSync = bindRequiredMethod(fileSystemHost, syncMethodNames.directoryExists, 'a boolean', isBoolean);
|
|
9
|
+
const filteringHost = {
|
|
10
|
+
...fileSystemHost,
|
|
11
|
+
async fileExists(filePath) {
|
|
12
|
+
if (isDeclarationFile(filePath)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return fileSystemHost.fileExists(filePath);
|
|
16
|
+
},
|
|
17
|
+
[syncMethodNames.fileExists](filePath) {
|
|
18
|
+
if (isDeclarationFile(filePath)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
// eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
|
|
22
|
+
return fileExistsSync(filePath);
|
|
23
|
+
},
|
|
24
|
+
async directoryExists(directoryPath) {
|
|
25
|
+
if (isTypesRootFolder(directoryPath)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return fileSystemHost.directoryExists(directoryPath);
|
|
29
|
+
},
|
|
30
|
+
[syncMethodNames.directoryExists](directoryPath) {
|
|
31
|
+
if (isTypesRootFolder(directoryPath)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
// eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
|
|
35
|
+
return directoryExistsSync(directoryPath);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.setPrototypeOf(filteringHost, fileSystemHost);
|
|
39
|
+
return filteringHost;
|
|
40
|
+
}
|
|
41
|
+
export function createFileSystemAdapters(dependencies) {
|
|
42
|
+
const { fileSystemHost } = dependencies;
|
|
43
|
+
const synthesizingHost = createNodeModulesManifestSynthesizingHost(fileSystemHost);
|
|
44
|
+
return {
|
|
45
|
+
fileSystemHostWithoutFilter: synthesizingHost,
|
|
46
|
+
fileSystemHostFilteringDeclarationFiles: createDeclarationFilteringHost(synthesizingHost),
|
|
47
|
+
withVirtualPackageJson: createVirtualPackageJsonHost
|
|
48
|
+
};
|
|
49
|
+
}
|
|
6
50
|
//# sourceMappingURL=typescript-file-host.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-file-host.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-file-host.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"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;QACzD,CAAC;QACD,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,aAAqB;YACnD,IAAI,iBAAiB,CAAC,aAAa,CAAC,EAAE,CAAC;gBACnC,OAAO,KAAK,CAAC;YACjB,CAAC;YAED,wGAAwG;YACxG,OAAO,mBAAmB,CAAC,aAAa,CAAC,CAAC;QAC9C,CAAC;KACJ,CAAC;IACF,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IACrD,OAAO,aAAa,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,YAA4C;IACjF,MAAM,EAAE,cAAc,EAAE,GAAG,YAAY,CAAC;IACxC,MAAM,gBAAgB,GAAG,yCAAyC,CAAC,cAAc,CAAC,CAAC;IACnF,OAAO;QACH,2BAA2B,EAAE,gBAAgB;QAC7C,uCAAuC,EAAE,8BAA8B,CAAC,gBAAgB,CAAC;QACzF,sBAAsB,EAAE,4BAA4B;KACvD,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { ts } from 'ts-morph';
|
|
3
|
+
function isRelativeOrAbsoluteSpecifier(specifier) {
|
|
4
|
+
return specifier.startsWith('.') || path.isAbsolute(specifier);
|
|
5
|
+
}
|
|
6
|
+
function scopedPackageSpecifierFrom(specifier) {
|
|
7
|
+
const [scope, name, ...rest] = specifier.split('/');
|
|
8
|
+
if (name === undefined) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
packageName: `${scope}/${name}`,
|
|
13
|
+
subpath: rest.length === 0 ? '.' : `./${rest.join('/')}`
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function unscopedPackageSpecifierFrom(specifier) {
|
|
17
|
+
const [packageName = specifier, ...rest] = specifier.split('/');
|
|
18
|
+
return {
|
|
19
|
+
packageName,
|
|
20
|
+
subpath: rest.length === 0 ? '.' : `./${rest.join('/')}`
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function packageSpecifierFrom(specifier) {
|
|
24
|
+
if (isRelativeOrAbsoluteSpecifier(specifier) || specifier.startsWith('#')) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
return specifier.startsWith('@') ? scopedPackageSpecifierFrom(specifier) : unscopedPackageSpecifierFrom(specifier);
|
|
28
|
+
}
|
|
29
|
+
function hostFileExists(sourceFile, filePath) {
|
|
30
|
+
return sourceFile.getProject().getModuleResolutionHost().fileExists(filePath);
|
|
31
|
+
}
|
|
32
|
+
function hostReadFile(sourceFile, filePath) {
|
|
33
|
+
return sourceFile.getProject().getModuleResolutionHost().readFile(filePath);
|
|
34
|
+
}
|
|
35
|
+
function ancestorFolderPaths(startPath) {
|
|
36
|
+
const start = path.resolve(startPath);
|
|
37
|
+
const { root } = path.parse(start);
|
|
38
|
+
const directorySegments = path
|
|
39
|
+
.relative(root, start)
|
|
40
|
+
.split(path.sep);
|
|
41
|
+
return Array.from({ length: directorySegments.length + 1 }, function (_unusedValue, ancestorOffset) {
|
|
42
|
+
return path.join(root, ...directorySegments.slice(0, directorySegments.length - ancestorOffset));
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function packageLookupDirectories(containingSourceFile) {
|
|
46
|
+
return ancestorFolderPaths(path.dirname(containingSourceFile.getFilePath()));
|
|
47
|
+
}
|
|
48
|
+
function packageRootPath(specifier, containingSourceFile) {
|
|
49
|
+
for (const directory of packageLookupDirectories(containingSourceFile)) {
|
|
50
|
+
const packageRoot = path.join(directory, 'node_modules', specifier.packageName);
|
|
51
|
+
if (hostFileExists(containingSourceFile, path.join(packageRoot, 'package.json'))) {
|
|
52
|
+
return packageRoot;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
function isRecord(value) {
|
|
58
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
59
|
+
}
|
|
60
|
+
function stringProperty(record, key) {
|
|
61
|
+
const value = record[key];
|
|
62
|
+
return typeof value === 'string' ? value : undefined;
|
|
63
|
+
}
|
|
64
|
+
function parseJsonObject(content) {
|
|
65
|
+
let parsed = null;
|
|
66
|
+
try {
|
|
67
|
+
parsed = JSON.parse(content);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
}
|
|
71
|
+
return parsed;
|
|
72
|
+
}
|
|
73
|
+
function parsePackageManifest(content) {
|
|
74
|
+
const parsed = parseJsonObject(content);
|
|
75
|
+
return isRecord(parsed) ? parsed : undefined;
|
|
76
|
+
}
|
|
77
|
+
function readPackageManifest(packageRoot, containingSourceFile) {
|
|
78
|
+
const filePath = path.join(packageRoot, 'package.json');
|
|
79
|
+
const parsed = parsePackageManifest(String(hostReadFile(containingSourceFile, filePath)));
|
|
80
|
+
if (parsed === undefined) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
type: stringProperty(parsed, 'type'),
|
|
85
|
+
exports: parsed.exports,
|
|
86
|
+
main: stringProperty(parsed, 'main')
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function packageManifestPathsFor(filePath) {
|
|
90
|
+
return ancestorFolderPaths(path.dirname(filePath)).map(function (folderPath) {
|
|
91
|
+
return path.join(folderPath, 'package.json');
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export function packageTypeForResolvedFilePath(input) {
|
|
95
|
+
const { containingSourceFile, filePath } = input;
|
|
96
|
+
for (const packageJsonPath of packageManifestPathsFor(filePath)) {
|
|
97
|
+
if (hostFileExists(containingSourceFile, packageJsonPath)) {
|
|
98
|
+
const manifest = parsePackageManifest(String(hostReadFile(containingSourceFile, packageJsonPath)));
|
|
99
|
+
return manifest === undefined ? undefined : stringProperty(manifest, 'type');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
function targetFromConditionArray(value, resolveTarget) {
|
|
105
|
+
if (!Array.isArray(value)) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
for (const entry of value) {
|
|
109
|
+
const target = resolveTarget(entry);
|
|
110
|
+
if (target !== undefined) {
|
|
111
|
+
return target;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
function targetFromConditionRecord(value, resolveTarget) {
|
|
117
|
+
if (!isRecord(value)) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
return resolveTarget(value.import) ?? resolveTarget(value.default);
|
|
121
|
+
}
|
|
122
|
+
function targetFromCondition(value) {
|
|
123
|
+
if (typeof value === 'string') {
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
return targetFromConditionArray(value, targetFromCondition) ??
|
|
127
|
+
targetFromConditionRecord(value, targetFromCondition);
|
|
128
|
+
}
|
|
129
|
+
function targetFromRootExports(exportsValue) {
|
|
130
|
+
if (typeof exportsValue === 'string' || Array.isArray(exportsValue)) {
|
|
131
|
+
return targetFromCondition(exportsValue);
|
|
132
|
+
}
|
|
133
|
+
if (!isRecord(exportsValue)) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
const rootTarget = exportsValue['.'];
|
|
137
|
+
return targetFromCondition(rootTarget === undefined ? exportsValue : rootTarget);
|
|
138
|
+
}
|
|
139
|
+
function targetFromSubpathExports(exportsValue, subpath) {
|
|
140
|
+
return isRecord(exportsValue) ? targetFromCondition(exportsValue[subpath]) : undefined;
|
|
141
|
+
}
|
|
142
|
+
function targetFromExports(exportsValue, subpath) {
|
|
143
|
+
return subpath === '.'
|
|
144
|
+
? targetFromRootExports(exportsValue)
|
|
145
|
+
: targetFromSubpathExports(exportsValue, subpath);
|
|
146
|
+
}
|
|
147
|
+
function manifestFallbackTarget(manifest) {
|
|
148
|
+
return manifest.type === 'module' ? manifest.main : undefined;
|
|
149
|
+
}
|
|
150
|
+
function targetPathInsidePackage(packageRoot, target) {
|
|
151
|
+
const resolved = path.resolve(packageRoot, target);
|
|
152
|
+
return resolved.startsWith(`${path.resolve(packageRoot)}${path.sep}`) ? resolved : undefined;
|
|
153
|
+
}
|
|
154
|
+
function runtimePackageFilePath(packageRoot, manifest, specifier) {
|
|
155
|
+
const target = targetFromExports(manifest.exports, specifier.subpath) ?? manifestFallbackTarget(manifest);
|
|
156
|
+
return target === undefined ? undefined : targetPathInsidePackage(packageRoot, target);
|
|
157
|
+
}
|
|
158
|
+
function runtimePackageResolution(moduleSpecifier, containingSourceFile) {
|
|
159
|
+
const specifier = packageSpecifierFrom(moduleSpecifier);
|
|
160
|
+
if (specifier === undefined) {
|
|
161
|
+
return { filePath: undefined, canUseTypeFallback: true };
|
|
162
|
+
}
|
|
163
|
+
const packageRoot = packageRootPath(specifier, containingSourceFile);
|
|
164
|
+
if (packageRoot === undefined) {
|
|
165
|
+
return { filePath: undefined, canUseTypeFallback: true };
|
|
166
|
+
}
|
|
167
|
+
const manifest = readPackageManifest(packageRoot, containingSourceFile);
|
|
168
|
+
return {
|
|
169
|
+
filePath: manifest === undefined ? undefined : runtimePackageFilePath(packageRoot, manifest, specifier),
|
|
170
|
+
canUseTypeFallback: false
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function runtimeRelativeResolution(moduleSpecifier, containingSourceFile) {
|
|
174
|
+
if (!isRelativeOrAbsoluteSpecifier(moduleSpecifier)) {
|
|
175
|
+
return { filePath: undefined, canUseTypeFallback: true };
|
|
176
|
+
}
|
|
177
|
+
const resolved = path.resolve(path.dirname(containingSourceFile.getFilePath()), moduleSpecifier);
|
|
178
|
+
const candidates = path.extname(resolved) === ''
|
|
179
|
+
? [resolved, `${resolved}.mjs`, `${resolved}.js`]
|
|
180
|
+
: [resolved];
|
|
181
|
+
return {
|
|
182
|
+
filePath: candidates.find(function (candidate) {
|
|
183
|
+
return hostFileExists(containingSourceFile, candidate);
|
|
184
|
+
}),
|
|
185
|
+
canUseTypeFallback: false
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function typeResolution(moduleSpecifier, containingSourceFile) {
|
|
189
|
+
const project = containingSourceFile.getProject();
|
|
190
|
+
return ts
|
|
191
|
+
.resolveModuleName(moduleSpecifier, containingSourceFile.getFilePath(), project.getCompilerOptions(), project.getModuleResolutionHost())
|
|
192
|
+
.resolvedModule
|
|
193
|
+
?.resolvedFileName;
|
|
194
|
+
}
|
|
195
|
+
export function resolveTypescriptModuleFilePath(input) {
|
|
196
|
+
const { containingSourceFile, moduleSpecifier, resolutionMode } = input;
|
|
197
|
+
const resolutionByMode = new Map([
|
|
198
|
+
['type', function () {
|
|
199
|
+
return typeResolution(moduleSpecifier, containingSourceFile);
|
|
200
|
+
}],
|
|
201
|
+
['runtime', function () {
|
|
202
|
+
const relativeResolution = runtimeRelativeResolution(moduleSpecifier, containingSourceFile);
|
|
203
|
+
const packageResolution = runtimePackageResolution(moduleSpecifier, containingSourceFile);
|
|
204
|
+
return relativeResolution.filePath ??
|
|
205
|
+
packageResolution.filePath ??
|
|
206
|
+
(relativeResolution.canUseTypeFallback && packageResolution.canUseTypeFallback
|
|
207
|
+
? typeResolution(moduleSpecifier, containingSourceFile)
|
|
208
|
+
: undefined);
|
|
209
|
+
}]
|
|
210
|
+
]);
|
|
211
|
+
const resolve = resolutionByMode.get(resolutionMode);
|
|
212
|
+
return resolve === undefined ? undefined : resolve();
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=typescript-module-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-module-resolution.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-module-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAmB,MAAM,UAAU,CAAC;AA+B/C,SAAS,6BAA6B,CAAC,SAAiB;IACpD,OAAO,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAA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B,CAAC,WAAW,EAAE,EAClC,OAAO,CAAC,kBAAkB,EAAE,EAC5B,OAAO,CAAC,uBAAuB,EAAE,CACpC;SACA,cAAc;QACf,EAAE,gBAAgB,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC3C,KAAyC;IAEzC,MAAM,EAAE,oBAAoB,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACxE,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAmC;QAC/D,CAAE,MAAM,EAAE;gBACN,OAAO,cAAc,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC;YACjE,CAAC,CAAE;QACH,CAAE,SAAS,EAAE;gBACT,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC;gBAC5F,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC;gBAC1F,OAAO,kBAAkB,CAAC,QAAQ;oBAC9B,iBAAiB,CAAC,QAAQ;oBAC1B,CAAC,kBAAkB,CAAC,kBAAkB,IAAI,iBAAiB,CAAC,kBAAkB;wBAC1E,CAAC,CAAC,cAAc,CAAC,eAAe,EAAE,oBAAoB,CAAC;wBACvD,CAAC,CAAC,SAAS,CAAC,CAAC;YACzB,CAAC,CAAE;KACN,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,gBAAgB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACrD,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -1,4 +1,33 @@
|
|
|
1
|
-
import 'node:path';
|
|
2
|
-
import "../common/package-layout.js";
|
|
3
|
-
import "./typescript-compiler-options.js";
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { packageManifestPathIn } from "../common/package-layout.js";
|
|
3
|
+
import { analyzationOptionsToCompilerOptions } from "./typescript-compiler-options.js";
|
|
4
|
+
export function createTypescriptProjectAnalyzer(dependencies) {
|
|
5
|
+
const { fileSystemAdapters, Project, getReferencedModules } = dependencies;
|
|
6
|
+
return {
|
|
7
|
+
analyzeProject(folder, options) {
|
|
8
|
+
const packageJsonPath = packageManifestPathIn(folder);
|
|
9
|
+
const project = new Project({
|
|
10
|
+
compilerOptions: analyzationOptionsToCompilerOptions(options),
|
|
11
|
+
fileSystem: fileSystemAdapters.withVirtualPackageJson(options.resolveDeclarationFiles
|
|
12
|
+
? fileSystemAdapters.fileSystemHostWithoutFilter
|
|
13
|
+
: fileSystemAdapters.fileSystemHostFilteringDeclarationFiles, folder, options.mainPackageJson)
|
|
14
|
+
});
|
|
15
|
+
const fileExtension = options.resolveDeclarationFiles ? '.d.ts' : '.js';
|
|
16
|
+
const filesPattern = path.join(folder, `**/*${fileExtension}`);
|
|
17
|
+
project.addSourceFilesAtPaths([filesPattern]);
|
|
18
|
+
return {
|
|
19
|
+
getReferencedModules(containingInputFilePath) {
|
|
20
|
+
const currentSourceFile = project.getSourceFile(containingInputFilePath);
|
|
21
|
+
if (currentSourceFile === undefined) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
return getReferencedModules(currentSourceFile, packageJsonPath);
|
|
25
|
+
},
|
|
26
|
+
getProject() {
|
|
27
|
+
return project;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
4
33
|
//# sourceMappingURL=typescript-project-analyzer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-project-analyzer.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-project-analyzer.ts"],"names":[],"mappings":"AAAA,
|
|
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;AAE7B,OAAO,EAAE,q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