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,3 +1,99 @@
|
|
|
1
|
-
import 'ts-morph';
|
|
2
|
-
import "../expression-unwrapping.js";
|
|
1
|
+
import { Node as TsMorphNode, SyntaxKind, VariableDeclarationKind } from 'ts-morph';
|
|
2
|
+
import { unwrapExpression } from "../expression-unwrapping.js";
|
|
3
|
+
function andOperator(left, right) {
|
|
4
|
+
return left && right;
|
|
5
|
+
}
|
|
6
|
+
function orOperator(left, right) {
|
|
7
|
+
return left || right;
|
|
8
|
+
}
|
|
9
|
+
function equalOperator(left, right) {
|
|
10
|
+
return left === right;
|
|
11
|
+
}
|
|
12
|
+
function notEqualOperator(left, right) {
|
|
13
|
+
return left !== right;
|
|
14
|
+
}
|
|
15
|
+
function literalBooleanValue(expression) {
|
|
16
|
+
if (expression.getKind() === SyntaxKind.TrueKeyword) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
return expression.getKind() === SyntaxKind.FalseKeyword ? false : undefined;
|
|
20
|
+
}
|
|
21
|
+
function logicalBooleanOperatorValue(kind, left, right) {
|
|
22
|
+
if (kind === SyntaxKind.AmpersandAmpersandToken) {
|
|
23
|
+
return andOperator(left, right);
|
|
24
|
+
}
|
|
25
|
+
if (kind === SyntaxKind.BarBarToken) {
|
|
26
|
+
return orOperator(left, right);
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
function equalityBooleanOperatorValue(kind, left, right) {
|
|
31
|
+
if (kind === SyntaxKind.EqualsEqualsEqualsToken) {
|
|
32
|
+
return equalOperator(left, right);
|
|
33
|
+
}
|
|
34
|
+
if (kind === SyntaxKind.ExclamationEqualsEqualsToken) {
|
|
35
|
+
return notEqualOperator(left, right);
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
function binaryBooleanOperatorValue(kind, left, right) {
|
|
40
|
+
return logicalBooleanOperatorValue(kind, left, right) ?? equalityBooleanOperatorValue(kind, left, right);
|
|
41
|
+
}
|
|
42
|
+
function identifierBooleanValue(expression, facts) {
|
|
43
|
+
return TsMorphNode.isIdentifier(expression) ? facts.get(expression.getText()) : undefined;
|
|
44
|
+
}
|
|
45
|
+
function binaryBooleanValue(expression, facts, evaluate) {
|
|
46
|
+
if (!TsMorphNode.isBinaryExpression(expression)) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const binary = expression.asKindOrThrow(SyntaxKind.BinaryExpression);
|
|
50
|
+
const left = evaluate(binary.getLeft(), facts);
|
|
51
|
+
const right = evaluate(binary.getRight(), facts);
|
|
52
|
+
if (left === undefined || right === undefined) {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
return binaryBooleanOperatorValue(binary.getOperatorToken().getKind(), left, right);
|
|
56
|
+
}
|
|
57
|
+
function prefixBooleanValue(expression, facts, evaluate) {
|
|
58
|
+
if (!TsMorphNode.isPrefixUnaryExpression(expression)) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
const operand = evaluate(expression.getOperand(), facts);
|
|
62
|
+
return operand !== undefined && expression.getOperatorToken() === SyntaxKind.ExclamationToken
|
|
63
|
+
? !operand
|
|
64
|
+
: undefined;
|
|
65
|
+
}
|
|
66
|
+
export function booleanValue(expression, facts) {
|
|
67
|
+
const unwrapped = unwrapExpression(expression);
|
|
68
|
+
return literalBooleanValue(unwrapped) ??
|
|
69
|
+
identifierBooleanValue(unwrapped, facts) ??
|
|
70
|
+
prefixBooleanValue(unwrapped, facts, booleanValue) ??
|
|
71
|
+
binaryBooleanValue(unwrapped, facts, booleanValue);
|
|
72
|
+
}
|
|
73
|
+
function collectBooleanFact(declaration, facts) {
|
|
74
|
+
const nameNode = declaration.getNameNode();
|
|
75
|
+
const initializer = declaration.getInitializer();
|
|
76
|
+
if (initializer === undefined || !TsMorphNode.isIdentifier(nameNode)) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const value = booleanValue(initializer, facts);
|
|
80
|
+
return value === undefined ? undefined : [nameNode.getText(), value];
|
|
81
|
+
}
|
|
82
|
+
function collectConstBooleanFacts(statement, facts) {
|
|
83
|
+
if (statement.getDeclarationKind() !== VariableDeclarationKind.Const) {
|
|
84
|
+
return facts;
|
|
85
|
+
}
|
|
86
|
+
const nextFacts = new Map(facts);
|
|
87
|
+
for (const declaration of statement.getDeclarations()) {
|
|
88
|
+
const fact = collectBooleanFact(declaration, nextFacts);
|
|
89
|
+
if (fact !== undefined) {
|
|
90
|
+
const [name, value] = fact;
|
|
91
|
+
nextFacts.set(name, value);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return nextFacts;
|
|
95
|
+
}
|
|
96
|
+
export function factsAfterStatement(statement, facts) {
|
|
97
|
+
return TsMorphNode.isVariableStatement(statement) ? collectConstBooleanFacts(statement, facts) : facts;
|
|
98
|
+
}
|
|
3
99
|
//# sourceMappingURL=boolean-facts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean-facts.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/boolean-facts.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"boolean-facts.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/boolean-facts.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,IAAI,WAAW,EACnB,UAAU,EACV,uBAAuB,EAK1B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAM/D,SAAS,WAAW,CAAC,IAAa,EAAE,KAAc;IAC9C,OAAO,IAAI,IAAI,KAAK,CAAC;AACzB,CAAC;AAED,SAAS,UAAU,CAAC,IAAa,EAAE,KAAc;IAC7C,OAAO,IAAI,IAAI,KAAK,CAAC;AACzB,CAAC;AAED,SAAS,aAAa,CAAC,IAAa,EAAE,KAAc;IAChD,OAAO,IAAI,KAAK,KAAK,CAAC;AAC1B,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAa,EAAE,KAAc;IACnD,OAAO,IAAI,KAAK,KAAK,CAAC;AAC1B,CAAC;AAED,SAAS,mBAAmB,CAAC,UAAsB;IAC/C,IAAI,UAAU,CAAC,OAAO,EAAE,KAAK,UAAU,CAAC,WAAW,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC;IAChB,CAAC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;IACzE,OAAO,WAAW,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3G,CAAC"}
|
|
@@ -1,4 +1,315 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import
|
|
3
|
-
import "
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { Node as TsMorphNode, SyntaxKind } from 'ts-morph';
|
|
3
|
+
import { packageTypeForResolvedFilePath, resolveTypescriptModuleFilePath } from "../../dependency-scanner/typescript-module-resolution.js";
|
|
4
|
+
import { unwrapExpression } from "../expression-unwrapping.js";
|
|
5
|
+
const noExportEntries = [];
|
|
6
|
+
function isProjectSummaryStore(value) {
|
|
7
|
+
return value instanceof Map;
|
|
8
|
+
}
|
|
9
|
+
function projectSummaryCache(project) {
|
|
10
|
+
const stored = Reflect.get(project, projectSummaryCache.name);
|
|
11
|
+
const cache = isProjectSummaryStore(stored) ? stored : new Map();
|
|
12
|
+
Reflect.set(project, projectSummaryCache.name, cache);
|
|
13
|
+
return cache;
|
|
14
|
+
}
|
|
15
|
+
function kindIsTextOrNumberReturnLeaf(kind) {
|
|
16
|
+
return kind === SyntaxKind.StringLiteral || kind === SyntaxKind.NumericLiteral;
|
|
17
|
+
}
|
|
18
|
+
function kindIsBooleanReturnLeaf(kind) {
|
|
19
|
+
return kind === SyntaxKind.TrueKeyword || kind === SyntaxKind.FalseKeyword;
|
|
20
|
+
}
|
|
21
|
+
function kindIsPureReturnLeaf(kind) {
|
|
22
|
+
return kindIsTextOrNumberReturnLeaf(kind) ||
|
|
23
|
+
kindIsBooleanReturnLeaf(kind) ||
|
|
24
|
+
kind === SyntaxKind.NullKeyword;
|
|
25
|
+
}
|
|
26
|
+
function arrowReturnExpressionFrom(functionLike) {
|
|
27
|
+
const body = functionLike.getBody();
|
|
28
|
+
return TsMorphNode.isExpression(body) ? body : undefined;
|
|
29
|
+
}
|
|
30
|
+
function blockFromFunctionLike(functionLike) {
|
|
31
|
+
return functionLike.getBody()?.asKind(SyntaxKind.Block);
|
|
32
|
+
}
|
|
33
|
+
function blockReturnExpressionFrom(functionLike) {
|
|
34
|
+
const body = blockFromFunctionLike(functionLike);
|
|
35
|
+
if (body === undefined) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const [statement] = body.getStatements();
|
|
39
|
+
return TsMorphNode.isReturnStatement(statement) ? statement.getExpression() : undefined;
|
|
40
|
+
}
|
|
41
|
+
function returnExpressionFrom(functionLike) {
|
|
42
|
+
if (TsMorphNode.isArrowFunction(functionLike)) {
|
|
43
|
+
return arrowReturnExpressionFrom(functionLike);
|
|
44
|
+
}
|
|
45
|
+
return blockReturnExpressionFrom(functionLike);
|
|
46
|
+
}
|
|
47
|
+
function expressionIsPureReturnStructure(expression) {
|
|
48
|
+
return TsMorphNode.isObjectLiteralExpression(expression) ||
|
|
49
|
+
TsMorphNode.isArrayLiteralExpression(expression) ||
|
|
50
|
+
TsMorphNode.isArrowFunction(expression) ||
|
|
51
|
+
TsMorphNode.isFunctionExpression(expression);
|
|
52
|
+
}
|
|
53
|
+
function expressionIsPureReturnValue(expression) {
|
|
54
|
+
const unwrapped = unwrapExpression(expression);
|
|
55
|
+
return kindIsPureReturnLeaf(unwrapped.getKind()) || expressionIsPureReturnStructure(unwrapped);
|
|
56
|
+
}
|
|
57
|
+
function functionLikeIsPureBuilder(functionLike) {
|
|
58
|
+
if (functionLike.getFullText().includes('@__NO_SIDE_EFFECTS__')) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
const expression = returnExpressionFrom(functionLike);
|
|
62
|
+
return expression !== undefined && expressionIsPureReturnValue(expression);
|
|
63
|
+
}
|
|
64
|
+
function callablePurity(functionLike) {
|
|
65
|
+
return functionLikeIsPureBuilder(functionLike) ? 'pure-callable' : 'unknown';
|
|
66
|
+
}
|
|
67
|
+
function propertyInitializerPurity(initializer) {
|
|
68
|
+
if (TsMorphNode.isFunctionExpression(initializer) || TsMorphNode.isArrowFunction(initializer)) {
|
|
69
|
+
return callablePurity(initializer);
|
|
70
|
+
}
|
|
71
|
+
return TsMorphNode.isObjectLiteralExpression(initializer) ? 'pure-object' : 'unknown';
|
|
72
|
+
}
|
|
73
|
+
function supportedObjectProperty(property) {
|
|
74
|
+
if (TsMorphNode.isMethodDeclaration(property) || TsMorphNode.isPropertyAssignment(property)) {
|
|
75
|
+
return property;
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
function propertyPurity(property) {
|
|
80
|
+
if (TsMorphNode.isMethodDeclaration(property)) {
|
|
81
|
+
return callablePurity(property);
|
|
82
|
+
}
|
|
83
|
+
return propertyInitializerPurity(property.getInitializerOrThrow());
|
|
84
|
+
}
|
|
85
|
+
function propertyName(property) {
|
|
86
|
+
const nameNode = property.getNameNode();
|
|
87
|
+
return TsMorphNode.isStringLiteral(nameNode) ? nameNode.getLiteralText() : property.getName();
|
|
88
|
+
}
|
|
89
|
+
function functionLikeReturnObjectEntries(exportName, functionLike, collectObjectEntries) {
|
|
90
|
+
const unwrapped = unwrapExpression(returnExpressionFrom(functionLike));
|
|
91
|
+
return TsMorphNode.isObjectLiteralExpression(unwrapped)
|
|
92
|
+
? collectObjectEntries(exportName, unwrapped, undefined)
|
|
93
|
+
: noExportEntries;
|
|
94
|
+
}
|
|
95
|
+
function methodReturnObjectEntries(propertyPath, property, collectObjectEntries) {
|
|
96
|
+
return TsMorphNode.isMethodDeclaration(property)
|
|
97
|
+
? functionLikeReturnObjectEntries(propertyPath, property, collectObjectEntries)
|
|
98
|
+
: noExportEntries;
|
|
99
|
+
}
|
|
100
|
+
function propertyAssignmentReturnObjectEntries(propertyPath, property, collectObjectEntries) {
|
|
101
|
+
if (!TsMorphNode.isPropertyAssignment(property)) {
|
|
102
|
+
return noExportEntries;
|
|
103
|
+
}
|
|
104
|
+
const initializer = property.getInitializerOrThrow();
|
|
105
|
+
return TsMorphNode.isFunctionExpression(initializer) || TsMorphNode.isArrowFunction(initializer)
|
|
106
|
+
? functionLikeReturnObjectEntries(propertyPath, initializer, collectObjectEntries)
|
|
107
|
+
: noExportEntries;
|
|
108
|
+
}
|
|
109
|
+
function objectPropertyExportEntries(exportName, property, collectObjectEntries) {
|
|
110
|
+
const supportedProperty = supportedObjectProperty(property);
|
|
111
|
+
if (supportedProperty === undefined) {
|
|
112
|
+
return noExportEntries;
|
|
113
|
+
}
|
|
114
|
+
const name = propertyName(supportedProperty);
|
|
115
|
+
const propertyPath = `${exportName}.${name}`;
|
|
116
|
+
return [
|
|
117
|
+
[propertyPath, propertyPurity(supportedProperty)],
|
|
118
|
+
...methodReturnObjectEntries(propertyPath, supportedProperty, collectObjectEntries),
|
|
119
|
+
...propertyAssignmentReturnObjectEntries(propertyPath, supportedProperty, collectObjectEntries)
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
function objectLiteralExportEntries(exportName, initializer, selfPurity) {
|
|
123
|
+
const entries = [];
|
|
124
|
+
for (const property of initializer.getProperties()) {
|
|
125
|
+
entries.push(...objectPropertyExportEntries(exportName, property, objectLiteralExportEntries));
|
|
126
|
+
}
|
|
127
|
+
if (selfPurity !== undefined) {
|
|
128
|
+
entries.push([exportName, selfPurity]);
|
|
129
|
+
}
|
|
130
|
+
return entries;
|
|
131
|
+
}
|
|
132
|
+
function variableExportEntries(declaration) {
|
|
133
|
+
const initializer = declaration.getInitializer();
|
|
134
|
+
const name = declaration.getName();
|
|
135
|
+
if (TsMorphNode.isObjectLiteralExpression(initializer)) {
|
|
136
|
+
return objectLiteralExportEntries(name, initializer, 'pure-object');
|
|
137
|
+
}
|
|
138
|
+
if (TsMorphNode.isFunctionExpression(initializer) || TsMorphNode.isArrowFunction(initializer)) {
|
|
139
|
+
return [
|
|
140
|
+
[name, callablePurity(initializer)],
|
|
141
|
+
...functionLikeReturnObjectEntries(name, initializer, objectLiteralExportEntries)
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
return noExportEntries;
|
|
145
|
+
}
|
|
146
|
+
function addVariableExport(declaration, context) {
|
|
147
|
+
for (const [name, purity] of variableExportEntries(declaration)) {
|
|
148
|
+
context.exportPurities.set(name, purity);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function mergeExports(context, prefix, source) {
|
|
152
|
+
for (const [key, value] of source) {
|
|
153
|
+
context.exportPurities.set(prefix === '' ? key : `${prefix}.${key}`, value);
|
|
154
|
+
}
|
|
155
|
+
if (prefix !== '') {
|
|
156
|
+
context.exportPurities.set(prefix, 'pure-object');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function packageTypeFor(filePath, containingSourceFile) {
|
|
160
|
+
return packageTypeForResolvedFilePath({ filePath, containingSourceFile });
|
|
161
|
+
}
|
|
162
|
+
function isExternalPurityRuntimeSource(filePath, containingSourceFile) {
|
|
163
|
+
const extension = path.extname(filePath);
|
|
164
|
+
return extension === '.mjs' || extension === '.js' && packageTypeFor(filePath, containingSourceFile) === 'module';
|
|
165
|
+
}
|
|
166
|
+
function resolvedModuleSourceFile(moduleSpecifier, containingSourceFile) {
|
|
167
|
+
const filePath = resolveTypescriptModuleFilePath({
|
|
168
|
+
moduleSpecifier,
|
|
169
|
+
containingSourceFile,
|
|
170
|
+
resolutionMode: 'runtime'
|
|
171
|
+
});
|
|
172
|
+
if (filePath === undefined || !isExternalPurityRuntimeSource(filePath, containingSourceFile)) {
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
const project = containingSourceFile.getProject();
|
|
176
|
+
return project.getSourceFile(filePath) ?? project.addSourceFileAtPathIfExists(filePath);
|
|
177
|
+
}
|
|
178
|
+
function resolvedModuleSummary(context, moduleSpecifier) {
|
|
179
|
+
const target = resolvedModuleSourceFile(moduleSpecifier, context.sourceFile);
|
|
180
|
+
return target === undefined ? undefined : context.buildSummary(target);
|
|
181
|
+
}
|
|
182
|
+
function sourceExportPrefix(sourceName) {
|
|
183
|
+
return `${sourceName}.`;
|
|
184
|
+
}
|
|
185
|
+
function importedNamespaceSources(sourceFile) {
|
|
186
|
+
const namespaces = new Map();
|
|
187
|
+
for (const declaration of sourceFile.getImportDeclarations()) {
|
|
188
|
+
const namespace = declaration.getNamespaceImport();
|
|
189
|
+
if (namespace !== undefined) {
|
|
190
|
+
namespaces.set(namespace.getText(), declaration.getModuleSpecifierValue());
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return namespaces;
|
|
194
|
+
}
|
|
195
|
+
function mergeNestedNamedExport(context, sourceName, exportedName, summary) {
|
|
196
|
+
const prefix = sourceExportPrefix(sourceName);
|
|
197
|
+
for (const [key, value] of summary.exports) {
|
|
198
|
+
if (key.startsWith(prefix)) {
|
|
199
|
+
context.exportPurities.set(`${exportedName}.${key.slice(prefix.length)}`, value);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function mergeNamedExport(context, namedExport, summary) {
|
|
204
|
+
const sourceName = namedExport.getName();
|
|
205
|
+
const exportedName = namedExport.getAliasNode()?.getText() ?? sourceName;
|
|
206
|
+
context.exportPurities.set(exportedName, summary.exports.get(sourceName) ?? 'unknown');
|
|
207
|
+
mergeNestedNamedExport(context, sourceName, exportedName, summary);
|
|
208
|
+
}
|
|
209
|
+
function mergeNamedExports(context, declaration, summary) {
|
|
210
|
+
for (const namedExport of declaration.getNamedExports()) {
|
|
211
|
+
mergeNamedExport(context, namedExport, summary);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function mergeModuleExportsByKind(context, declaration, summary) {
|
|
215
|
+
if (declaration.getNamedExports().length === 0) {
|
|
216
|
+
mergeExports(context, '', summary.exports);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
mergeNamedExports(context, declaration, summary);
|
|
220
|
+
}
|
|
221
|
+
function mergeModuleExportDeclaration(context, declaration, moduleSpecifier) {
|
|
222
|
+
const summary = resolvedModuleSummary(context, moduleSpecifier);
|
|
223
|
+
if (summary === undefined) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const namespaceExport = declaration.getNamespaceExport();
|
|
227
|
+
if (namespaceExport !== undefined) {
|
|
228
|
+
mergeExports(context, namespaceExport.getName(), summary.exports);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
mergeModuleExportsByKind(context, declaration, summary);
|
|
232
|
+
}
|
|
233
|
+
function mergeNamespaceReexport(context, namedExport, namespaceSource) {
|
|
234
|
+
const summary = resolvedModuleSummary(context, namespaceSource);
|
|
235
|
+
if (summary === undefined) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
const sourceName = namedExport.getName();
|
|
239
|
+
const exportedName = namedExport.getAliasNode()?.getText() ?? sourceName;
|
|
240
|
+
mergeExports(context, exportedName, summary.exports);
|
|
241
|
+
}
|
|
242
|
+
function mergeLocalExportDeclaration(context, declaration) {
|
|
243
|
+
for (const namedExport of declaration.getNamedExports()) {
|
|
244
|
+
const namespaceSource = context.namespaces.get(namedExport.getName());
|
|
245
|
+
if (namespaceSource !== undefined) {
|
|
246
|
+
mergeNamespaceReexport(context, namedExport, namespaceSource);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function mergeExportDeclaration(context, declaration) {
|
|
251
|
+
const moduleSpecifier = declaration.getModuleSpecifierValue();
|
|
252
|
+
if (moduleSpecifier !== undefined) {
|
|
253
|
+
mergeModuleExportDeclaration(context, declaration, moduleSpecifier);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
mergeLocalExportDeclaration(context, declaration);
|
|
257
|
+
}
|
|
258
|
+
function addFunctionExport(statement, context) {
|
|
259
|
+
if (!TsMorphNode.isFunctionDeclaration(statement) || !statement.isExported()) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const name = statement.getName();
|
|
263
|
+
if (name !== undefined) {
|
|
264
|
+
context.exportPurities.set(name, callablePurity(statement));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function addVariableStatementExports(statement, context) {
|
|
268
|
+
if (!TsMorphNode.isVariableStatement(statement) || !statement.isExported()) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
for (const declaration of statement.getDeclarations()) {
|
|
272
|
+
addVariableExport(declaration, context);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function mergeStatementExports(context, statement) {
|
|
276
|
+
addFunctionExport(statement, context);
|
|
277
|
+
addVariableStatementExports(statement, context);
|
|
278
|
+
if (TsMorphNode.isExportDeclaration(statement)) {
|
|
279
|
+
mergeExportDeclaration(context, statement);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function summaryContext(sourceFile, exportPurities, buildSummary) {
|
|
283
|
+
return {
|
|
284
|
+
sourceFile,
|
|
285
|
+
namespaces: importedNamespaceSources(sourceFile),
|
|
286
|
+
exportPurities,
|
|
287
|
+
buildSummary
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function createExternalPuritySummary(sourceFile, cache, buildSummary) {
|
|
291
|
+
const exportPurities = new Map();
|
|
292
|
+
const summary = { exports: exportPurities };
|
|
293
|
+
cache.set(sourceFile.getFilePath(), summary);
|
|
294
|
+
const context = summaryContext(sourceFile, exportPurities, buildSummary);
|
|
295
|
+
for (const statement of sourceFile.getStatements()) {
|
|
296
|
+
mergeStatementExports(context, statement);
|
|
297
|
+
}
|
|
298
|
+
return summary;
|
|
299
|
+
}
|
|
300
|
+
function buildExternalPuritySummary(sourceFile) {
|
|
301
|
+
const cache = projectSummaryCache(sourceFile.getProject());
|
|
302
|
+
const cached = cache.get(sourceFile.getFilePath());
|
|
303
|
+
return cached ?? createExternalPuritySummary(sourceFile, cache, buildExternalPuritySummary);
|
|
304
|
+
}
|
|
305
|
+
function exportKey(origin) {
|
|
306
|
+
return origin.path.join('.');
|
|
307
|
+
}
|
|
308
|
+
export function exportPurityForOrigin(origin, containingSourceFile) {
|
|
309
|
+
const sourceFile = resolvedModuleSourceFile(origin.from, containingSourceFile);
|
|
310
|
+
if (sourceFile === undefined) {
|
|
311
|
+
return 'unknown';
|
|
312
|
+
}
|
|
313
|
+
return buildExternalPuritySummary(sourceFile).exports.get(exportKey(origin)) ?? 'unknown';
|
|
314
|
+
}
|
|
4
315
|
//# sourceMappingURL=external-purity-summary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-purity-summary.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/external-purity-summary.ts"],"names":[],"mappings":"AAAA,OAiBO,UAAU,CAAC;AAElB,OAAiC,6BAA6B,CAAC;AAC/D,OAAwC,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"external-purity-summary.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/external-purity-summary.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACH,IAAI,IAAI,WAAW,EACnB,UAAU,EAeb,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,8BAA8B,EAC9B,+BAA+B,EAClC,MAAM,0DAA0D,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAoC/D,MAAM,eAAe,GAAiC,EAAE,CAAC;AAEzD,SAAS,qBAAqB,CAAC,KAAc;IACzC,OAAO,KAAK,YAAY,GAAG,CAAC;AAChC,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAgB;IACzC,MAAM,MAAM,GAAY,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACvE,MAAM,KAAK,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,EAAiC,CAAC;IAChG,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtD,OAAO,KAAK,CAAC;AACjB,CAAC;AA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AAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IACzE,KAAK,MAAM,SAAS,IAAI,UAAU,CAAC,aAAa,EAAE,EAAE,CAAC;QACjD,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,SAAS,0BAA0B,CAAC,UAAsB;IACtD,MAAM,KAAK,GAAG,mBAAmB,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;IACnD,OAAO,MAAM,IAAI,2BAA2B,CAAC,UAAU,EAAE,KAAK,EAAE,0BAA0B,CAAC,CAAC;AAChG,CAAC;AAED,SAAS,SAAS,CAAC,MAAgC;IAC/C,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,qBAAqB,CACjC,MAAgC,EAChC,oBAAgC;IAEhC,MAAM,UAAU,GAAG,wBAAwB,CAAC,MAAM,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAC/E,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,0BAA0B,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,SAAS,CAAC;AAC9F,CAAC"}
|
|
@@ -1,4 +1,40 @@
|
|
|
1
|
-
import 'ts-morph';
|
|
2
|
-
import "../imported-expression-origin.js";
|
|
3
|
-
import "./external-purity-summary.js";
|
|
1
|
+
import { Node as TsMorphNode } from 'ts-morph';
|
|
2
|
+
import { arePureCallArguments, resolveImportedExpressionPath } from "../imported-expression-origin.js";
|
|
3
|
+
import { exportPurityForOrigin } from "./external-purity-summary.js";
|
|
4
|
+
function originForPureCall(expression, recurse, resolveOrigin) {
|
|
5
|
+
const origin = resolveOrigin(expression.getExpression(), recurse);
|
|
6
|
+
if (origin === undefined || !arePureCallArguments(expression.getArguments(), recurse)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return exportPurityForOrigin(origin, expression.getSourceFile()) === 'pure-callable'
|
|
10
|
+
? origin
|
|
11
|
+
: undefined;
|
|
12
|
+
}
|
|
13
|
+
function fluentOriginForCall(expression, recurse, resolveOrigin) {
|
|
14
|
+
if (!TsMorphNode.isCallExpression(expression)) {
|
|
15
|
+
return resolveImportedExpressionPath(expression);
|
|
16
|
+
}
|
|
17
|
+
return originForPureCall(expression, recurse, resolveOrigin);
|
|
18
|
+
}
|
|
19
|
+
function appendOriginPath(origin, segment) {
|
|
20
|
+
return origin === undefined
|
|
21
|
+
? undefined
|
|
22
|
+
: { from: origin.from, path: [...origin.path, segment] };
|
|
23
|
+
}
|
|
24
|
+
function propertyAccessOrigin(expression, recurse, resolveOrigin) {
|
|
25
|
+
if (!TsMorphNode.isPropertyAccessExpression(expression)) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return appendOriginPath(fluentOriginForCall(expression.getExpression(), recurse, resolveOrigin), expression.getName());
|
|
29
|
+
}
|
|
30
|
+
function externalCalleeOrigin(expression, recurse) {
|
|
31
|
+
const directOrigin = resolveImportedExpressionPath(expression);
|
|
32
|
+
if (directOrigin !== undefined) {
|
|
33
|
+
return directOrigin;
|
|
34
|
+
}
|
|
35
|
+
return propertyAccessOrigin(expression, recurse, externalCalleeOrigin);
|
|
36
|
+
}
|
|
37
|
+
export function externalCallIsPure(expression, recurse) {
|
|
38
|
+
return originForPureCall(expression, recurse, externalCalleeOrigin) !== undefined;
|
|
39
|
+
}
|
|
4
40
|
//# sourceMappingURL=external-purity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-purity.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/external-purity.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"external-purity.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/external-purity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,WAAW,EAAwC,MAAM,UAAU,CAAC;AACrF,OAAO,EACH,oBAAoB,EACpB,6BAA6B,EAGhC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAOrE,SAAS,iBAAiB,CACtB,UAA0B,EAC1B,OAAgC,EAChC,aAA6B;IAE7B,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;IAClE,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,YAAY,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC;QACpF,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,aAAa,EAAE,CAAC,KAAK,eAAe;QAChF,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,SAAS,CAAC;AACpB,CAAC;AAED,SAAS,mBAAmB,CACxB,UAAsB,EACtB,OAAgC,EAChC,aAA6B;IAE7B,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5C,OAAO,6BAA6B,CAAC,UAAU,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,iBAAiB,CAAC,UAAU,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,gBAAgB,CACrB,MAA4C,EAC5C,OAAe;IAEf,OAAO,MAAM,KAAK,SAAS;QACvB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAE,GAAG,MAAM,CAAC,IAAI,EAAE,OAAO,CAAE,EAAE,CAAC;AACnE,CAAC;AAED,SAAS,oBAAoB,CACzB,UAAsB,EACtB,OAAgC,EAChC,aAA6B;IAE7B,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,UAAU,CAAC,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,gBAAgB,CACnB,mBAAmB,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,aAAa,CAAC,EACvE,UAAU,CAAC,OAAO,EAAE,CACvB,CAAC;AACN,CAAC;AAED,SAAS,oBAAoB,CACzB,UAAsB,EACtB,OAAgC;IAEhC,MAAM,YAAY,GAAG,6BAA6B,CAAC,UAAU,CAAC,CAAC;IAC/D,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,YAAY,CAAC;IACxB,CAAC;IACD,OAAO,oBAAoB,CAAC,UAAU,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,kBAAkB,CAC9B,UAA0B,EAC1B,OAAgC;IAEhC,OAAO,iBAAiB,CAAC,UAAU,EAAE,OAAO,EAAE,oBAAoB,CAAC,KAAK,SAAS,CAAC;AACtF,CAAC"}
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
import "../side-effect-classifier.js";
|
|
2
|
-
import "./runtime-code.js";
|
|
1
|
+
import { classifySideEffects } from "../side-effect-classifier.js";
|
|
2
|
+
import { isDeclarationCodeTargetPath, isRuntimeCodeTargetPath } from "./runtime-code.js";
|
|
3
|
+
function moduleKindForTargetPath(targetFilePath) {
|
|
4
|
+
if (isDeclarationCodeTargetPath(targetFilePath)) {
|
|
5
|
+
return 'declaration';
|
|
6
|
+
}
|
|
7
|
+
if (isRuntimeCodeTargetPath(targetFilePath)) {
|
|
8
|
+
return 'runtime';
|
|
9
|
+
}
|
|
10
|
+
if (targetFilePath.endsWith('.map')) {
|
|
11
|
+
return 'source-map';
|
|
12
|
+
}
|
|
13
|
+
return targetFilePath.includes('.') ? 'asset' : 'other';
|
|
14
|
+
}
|
|
15
|
+
export function buildModuleAnalysis(input) {
|
|
16
|
+
return {
|
|
17
|
+
inputFilePath: input.inputFilePath,
|
|
18
|
+
targetFilePath: input.targetFilePath,
|
|
19
|
+
kind: moduleKindForTargetPath(input.targetFilePath),
|
|
20
|
+
declarations: input.bindings.map(function (binding) {
|
|
21
|
+
return { name: binding.name, exported: binding.isExported };
|
|
22
|
+
}),
|
|
23
|
+
effects: input.sourceFile === undefined
|
|
24
|
+
? []
|
|
25
|
+
: classifySideEffects(input.sourceFile, input.deadCodeElimination)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
3
28
|
//# sourceMappingURL=module-analysis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-analysis.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/module-analysis.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"module-analysis.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/module-analysis.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAyBzF,SAAS,uBAAuB,CAAC,cAAsB;IACnD,IAAI,2BAA2B,CAAC,cAAc,CAAC,EAAE,CAAC;QAC9C,OAAO,aAAa,CAAC;IACzB,CAAC;IACD,IAAI,uBAAuB,CAAC,cAAc,CAAC,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO,YAAY,CAAC;IACxB,CAAC;IACD,OAAO,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAA0B;IAC1D,OAAO;QACH,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,IAAI,EAAE,uBAAuB,CAAC,KAAK,CAAC,cAAc,CAAC;QACnD,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,OAAO;YAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;QAChE,CAAC,CAAC;QACF,OAAO,EAAE,KAAK,CAAC,UAAU,KAAK,SAAS;YACnC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,mBAAmB,CAAC;KACzE,CAAC;AACN,CAAC"}
|
|
@@ -1,2 +1,92 @@
|
|
|
1
|
-
import "./runtime-code.js";
|
|
1
|
+
import { isDeclarationCodeTargetPath, isRuntimeCodeTargetPath } from "./runtime-code.js";
|
|
2
|
+
function rootTargetFilePaths(bundle) {
|
|
3
|
+
const paths = new Set();
|
|
4
|
+
for (const root of Object.values(bundle.roots)) {
|
|
5
|
+
paths.add(root.js.targetFilePath);
|
|
6
|
+
if (root.declarationFile !== undefined) {
|
|
7
|
+
paths.add(root.declarationFile.targetFilePath);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return paths;
|
|
11
|
+
}
|
|
12
|
+
function resourceHasSurvivingRuntime(resource) {
|
|
13
|
+
return resource.analysis.sideEffectStatements.length > 0 || resource.analysis.survivingBindings.size > 0;
|
|
14
|
+
}
|
|
15
|
+
function shouldSeedResource(resource, rootPaths) {
|
|
16
|
+
const { targetFilePath } = resource.fileDescription;
|
|
17
|
+
return (rootPaths.has(targetFilePath) ||
|
|
18
|
+
resource.isExplicitlyIncluded ||
|
|
19
|
+
!isRuntimeCodeTargetPath(targetFilePath) && !isDeclarationCodeTargetPath(targetFilePath) ||
|
|
20
|
+
resourceHasSurvivingRuntime(resource));
|
|
21
|
+
}
|
|
22
|
+
function indexResourcesByTargetPath(contents) {
|
|
23
|
+
return new Map(contents.map(function (resource) {
|
|
24
|
+
return [resource.fileDescription.targetFilePath, resource];
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
function retentionSeeds(contents, rootPaths) {
|
|
28
|
+
return contents
|
|
29
|
+
.filter(function (resource) {
|
|
30
|
+
return shouldSeedResource(resource, rootPaths);
|
|
31
|
+
})
|
|
32
|
+
.map(function (resource) {
|
|
33
|
+
return resource.fileDescription.targetFilePath;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function retainedTargetPaths(bundle, contents) {
|
|
37
|
+
const rootPaths = rootTargetFilePaths(bundle);
|
|
38
|
+
const resourcesByTargetPath = indexResourcesByTargetPath(contents);
|
|
39
|
+
const pending = Array.from(retentionSeeds(contents, rootPaths));
|
|
40
|
+
const retained = new Set();
|
|
41
|
+
function retain(targetFilePath) {
|
|
42
|
+
const resource = resourcesByTargetPath.get(targetFilePath);
|
|
43
|
+
if (resource !== undefined && !retained.has(targetFilePath)) {
|
|
44
|
+
retained.add(targetFilePath);
|
|
45
|
+
pending.push(...resource.directDependencies);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
for (const targetFilePath of pending) {
|
|
49
|
+
retain(targetFilePath);
|
|
50
|
+
}
|
|
51
|
+
return retained;
|
|
52
|
+
}
|
|
53
|
+
function isPrunedResource(resource, retained) {
|
|
54
|
+
return !retained.has(resource.fileDescription.targetFilePath);
|
|
55
|
+
}
|
|
56
|
+
function prunedMapTargetPaths(contents, retained) {
|
|
57
|
+
return new Set(contents
|
|
58
|
+
.filter(function (resource) {
|
|
59
|
+
return isPrunedResource(resource, retained);
|
|
60
|
+
})
|
|
61
|
+
.map(function (resource) {
|
|
62
|
+
return `${resource.fileDescription.targetFilePath}.map`;
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
export function pruneContents(bundle, contents, transformationsEnabled, trace) {
|
|
66
|
+
if (!transformationsEnabled) {
|
|
67
|
+
return contents;
|
|
68
|
+
}
|
|
69
|
+
const retained = retainedTargetPaths(bundle, contents);
|
|
70
|
+
const prunedMapTargets = prunedMapTargetPaths(contents, retained);
|
|
71
|
+
return contents.filter(function (resource) {
|
|
72
|
+
if (resource.isExplicitlyIncluded) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
const keep = retained.has(resource.fileDescription.targetFilePath) &&
|
|
76
|
+
!prunedMapTargets.has(resource.fileDescription.targetFilePath);
|
|
77
|
+
if (!keep && trace !== undefined) {
|
|
78
|
+
const pruneKind = retained.has(resource.fileDescription.targetFilePath)
|
|
79
|
+
? 'paired-map-of-pruned-resource'
|
|
80
|
+
: 'unreachable-resource';
|
|
81
|
+
trace.collector.record({
|
|
82
|
+
type: 'file-pruned',
|
|
83
|
+
bundleName: bundle.name,
|
|
84
|
+
inputFilePath: resource.fileDescription.inputFilePath,
|
|
85
|
+
targetFilePath: resource.fileDescription.targetFilePath,
|
|
86
|
+
pruneKind
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return keep;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
2
92
|
//# sourceMappingURL=resource-retention.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-retention.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/resource-retention.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"resource-retention.js","sourceRoot":"","sources":["../../../../../source/dead-code-eliminator/liveness/resource-retention.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEzF,SAAS,mBAAmB,CAAC,MAAqC;IAC9D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,C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