packtory 0.0.91 → 0.0.92
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 +4 -37
- package/artifacts/artifacts-builder.js.map +1 -1
- package/artifacts/content-collection.js +2 -59
- package/artifacts/content-collection.js.map +1 -1
- package/artifacts/folder-writer.js +2 -25
- package/artifacts/folder-writer.js.map +1 -1
- package/bundle-emitter/emitter.d.ts +0 -8
- package/bundle-emitter/emitter.d.ts.map +1 -1
- package/bundle-emitter/emitter.js +6 -106
- package/bundle-emitter/emitter.js.map +1 -1
- package/bundle-emitter/extract-package-tarball.js +2 -13
- package/bundle-emitter/extract-package-tarball.js.map +1 -1
- package/bundle-emitter/fetch-published-artifacts.js +2 -16
- package/bundle-emitter/fetch-published-artifacts.js.map +1 -1
- package/bundle-emitter/publication-outcome.d.ts +0 -3
- package/bundle-emitter/publication-outcome.d.ts.map +1 -1
- package/bundle-emitter/publication-outcome.js +0 -5
- package/bundle-emitter/publication-outcome.js.map +1 -1
- package/bundle-emitter/publish-error/auto-mode-error-matching.js +2 -28
- package/bundle-emitter/publish-error/auto-mode-error-matching.js.map +1 -1
- package/bundle-emitter/publish-error/error-shape-helpers.js +0 -9
- package/bundle-emitter/publish-error/error-shape-helpers.js.map +1 -1
- package/bundle-emitter/publish-error/file-mode-error-matching.js +2 -33
- package/bundle-emitter/publish-error/file-mode-error-matching.js.map +1 -1
- package/bundle-emitter/publish-error/publish-error-messages.js +0 -24
- package/bundle-emitter/publish-error/publish-error-messages.js.map +1 -1
- package/bundle-emitter/registry/metadata-auth-retry.js +1 -24
- package/bundle-emitter/registry/metadata-auth-retry.js.map +1 -1
- package/bundle-emitter/registry/oidc-token-exchange.js +3 -68
- package/bundle-emitter/registry/oidc-token-exchange.js.map +1 -1
- package/bundle-emitter/registry/package-metadata-fetcher.d.ts +0 -13
- package/bundle-emitter/registry/package-metadata-fetcher.d.ts.map +1 -1
- package/bundle-emitter/registry/package-metadata-fetcher.js +7 -186
- package/bundle-emitter/registry/package-metadata-fetcher.js.map +1 -1
- package/bundle-emitter/registry/publish-settings-bridge.js +3 -34
- package/bundle-emitter/registry/publish-settings-bridge.js.map +1 -1
- package/bundle-emitter/registry/registry-auth-config.js +0 -106
- package/bundle-emitter/registry/registry-auth-config.js.map +1 -1
- package/bundle-emitter/registry/registry-client.d.ts +1 -13
- package/bundle-emitter/registry/registry-client.d.ts.map +1 -1
- package/bundle-emitter/registry/registry-client.js +4 -71
- package/bundle-emitter/registry/registry-client.js.map +1 -1
- package/bundle-emitter/registry/registry-package-path.js +0 -3
- package/bundle-emitter/registry/registry-package-path.js.map +1 -1
- package/bundle-emitter/registry/registry-response-schemas.js +2 -50
- package/bundle-emitter/registry/registry-response-schemas.js.map +1 -1
- package/bundle-emitter/registry/tarball-integrity.d.ts +0 -1
- package/bundle-emitter/registry/tarball-integrity.d.ts.map +1 -1
- package/bundle-emitter/registry/tarball-integrity.js +1 -31
- package/bundle-emitter/registry/tarball-integrity.js.map +1 -1
- package/bundle-emitter/registry/validate-tarball-host.js +1 -26
- package/bundle-emitter/registry/validate-tarball-host.js.map +1 -1
- package/bundle-emitter/release-artifact-canonicalizer.js +5 -31
- package/bundle-emitter/release-artifact-canonicalizer.js.map +1 -1
- package/checks/check-runner.js +0 -8
- package/checks/check-runner.js.map +1 -1
- package/checks/rule.js +2 -12
- package/checks/rule.js.map +1 -1
- package/checks/rules/duplicate-detection.js +1 -23
- package/checks/rules/duplicate-detection.js.map +1 -1
- package/checks/rules/duplicate-messages.js +0 -22
- package/checks/rules/duplicate-messages.js.map +1 -1
- package/checks/rules/file-ownership.js +0 -15
- package/checks/rules/file-ownership.js.map +1 -1
- package/checks/rules/max-bundle-size.js +1 -55
- package/checks/rules/max-bundle-size.js.map +1 -1
- package/checks/rules/no-dev-dependency-imports.js +1 -51
- package/checks/rules/no-dev-dependency-imports.js.map +1 -1
- package/checks/rules/no-duplicated-files.js +3 -53
- package/checks/rules/no-duplicated-files.js.map +1 -1
- package/checks/rules/no-side-effects.js +1 -50
- package/checks/rules/no-side-effects.js.map +1 -1
- package/checks/rules/no-unexposed-executables.js +2 -43
- package/checks/rules/no-unexposed-executables.js.map +1 -1
- package/checks/rules/no-unused-bundle-dependencies.js +2 -30
- package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
- package/checks/rules/registry.js +9 -22
- package/checks/rules/registry.js.map +1 -1
- package/checks/rules/required-files.js +3 -41
- package/checks/rules/required-files.js.map +1 -1
- package/checks/rules/type-script-declaration-integrity.js +3 -81
- package/checks/rules/type-script-declaration-integrity.js.map +1 -1
- package/checks/rules/type-script-declaration-paths.js +1 -55
- package/checks/rules/type-script-declaration-paths.js.map +1 -1
- package/checks/rules/type-script-declaration-project.js +3 -202
- package/checks/rules/type-script-declaration-project.js.map +1 -1
- package/checks/rules/type-script-declaration-reachability.js +2 -38
- package/checks/rules/type-script-declaration-reachability.js.map +1 -1
- package/checks/rules/type-script-declaration-roots.js +0 -29
- package/checks/rules/type-script-declaration-roots.js.map +1 -1
- package/checks/rules/type-script-integrity.js +2 -72
- package/checks/rules/type-script-integrity.js.map +1 -1
- package/checks/rules/type-script-package-resolution.js +1 -42
- package/checks/rules/type-script-package-resolution.js.map +1 -1
- package/checks/rules/type-script-resolution-summary.js +0 -53
- package/checks/rules/type-script-resolution-summary.js.map +1 -1
- package/checks/rules/unique-target-paths.js +2 -34
- package/checks/rules/unique-target-paths.js.map +1 -1
- package/common/bundled-dependency-groups.js +0 -27
- package/common/bundled-dependency-groups.js.map +1 -1
- package/common/code-files.js +0 -28
- package/common/code-files.js.map +1 -1
- package/common/declaration-companion-paths.js +0 -24
- package/common/declaration-companion-paths.js.map +1 -1
- package/common/package-name-map.js +0 -7
- package/common/package-name-map.js.map +1 -1
- package/common/stable-json.js +2 -42
- package/common/stable-json.js.map +1 -1
- package/common/worklist.js +0 -22
- package/common/worklist.js.map +1 -1
- package/config/additional-files.js +2 -6
- package/config/additional-files.js.map +1 -1
- package/config/additional-package-json-attributes-schema.js +2 -6
- package/config/additional-package-json-attributes-schema.js.map +1 -1
- package/config/automatic-versioning-settings.js +2 -6
- package/config/automatic-versioning-settings.js.map +1 -1
- package/config/changelog-settings.d.ts +0 -44
- package/config/changelog-settings.d.ts.map +1 -1
- package/config/changelog-settings.js +3 -120
- package/config/changelog-settings.js.map +1 -1
- package/config/common-package-settings-schemas.js +3 -19
- package/config/common-package-settings-schemas.js.map +1 -1
- package/config/config.d.ts +1 -6
- package/config/config.d.ts.map +1 -1
- package/config/config.js +1 -3
- package/config/config.js.map +1 -1
- package/config/cross-package-validation.js +0 -17
- package/config/cross-package-validation.js.map +1 -1
- package/config/dead-code-elimination-settings.d.ts +0 -1
- package/config/dead-code-elimination-settings.d.ts.map +1 -1
- package/config/dead-code-elimination-settings.js +2 -36
- package/config/dead-code-elimination-settings.js.map +1 -1
- package/config/dependency-existence-validation.js +1 -19
- package/config/dependency-existence-validation.js.map +1 -1
- package/config/dependency-policy.js +2 -5
- package/config/dependency-policy.js.map +1 -1
- package/config/main-package-json-schema.js +2 -13
- package/config/main-package-json-schema.js.map +1 -1
- package/config/manual-versioning-settings.d.ts +0 -12
- package/config/manual-versioning-settings.d.ts.map +1 -1
- package/config/manual-versioning-settings.js +2 -29
- package/config/manual-versioning-settings.js.map +1 -1
- package/config/optional-package-settings-schema.js +7 -16
- package/config/optional-package-settings-schema.js.map +1 -1
- package/config/package-config.d.ts +0 -4
- package/config/package-config.d.ts.map +1 -1
- package/config/package-config.js +1 -2
- package/config/package-config.js.map +1 -1
- package/config/package-graph-builder.js +2 -14
- package/config/package-graph-builder.js.map +1 -1
- package/config/package-interface.js +2 -25
- package/config/package-interface.js.map +1 -1
- package/config/package-json.d.ts +0 -2
- package/config/package-json.d.ts.map +1 -1
- package/config/package-json.js +0 -16
- package/config/package-json.js.map +1 -1
- package/config/packtory-config-without-registry-schema.js +0 -6
- package/config/packtory-config-without-registry-schema.js.map +1 -1
- package/config/per-package-settings-schema.js +6 -22
- package/config/per-package-settings-schema.js.map +1 -1
- package/config/pre-graph-validation.js +5 -20
- package/config/pre-graph-validation.js.map +1 -1
- package/config/publish-settings.d.ts +0 -3
- package/config/publish-settings.d.ts.map +1 -1
- package/config/publish-settings.js +3 -25
- package/config/publish-settings.js.map +1 -1
- package/config/publish-settings.report.js +1 -17
- package/config/publish-settings.report.js.map +1 -1
- package/config/registry-settings.d.ts +0 -41
- package/config/registry-settings.d.ts.map +1 -1
- package/config/registry-settings.js +2 -40
- package/config/registry-settings.js.map +1 -1
- package/config/registry-settings.report.js +0 -46
- package/config/registry-settings.report.js.map +1 -1
- package/config/root-config-validation.js +0 -141
- package/config/root-config-validation.js.map +1 -1
- package/config/root.js +2 -6
- package/config/root.js.map +1 -1
- package/config/sbom-settings.js +1 -4
- package/config/sbom-settings.js.map +1 -1
- package/config/settings-validation.js +0 -28
- package/config/settings-validation.js.map +1 -1
- package/config/versioning-settings.d.ts +1 -18
- package/config/versioning-settings.d.ts.map +1 -1
- package/config/versioning-settings.js +3 -10
- package/config/versioning-settings.js.map +1 -1
- package/dead-code-eliminator/analyzed-bundle.d.ts +0 -11
- package/dead-code-eliminator/analyzed-bundle.d.ts.map +1 -1
- package/dead-code-eliminator/analyzed-bundle.js +0 -7
- package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
- package/dead-code-eliminator/class-purity.js +2 -48
- package/dead-code-eliminator/class-purity.js.map +1 -1
- package/dead-code-eliminator/code-file-analyzer.js +4 -62
- package/dead-code-eliminator/code-file-analyzer.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/bundle-index.js +1 -27
- package/dead-code-eliminator/cross-bundle/bundle-index.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +3 -18
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/import-export-walker.js +4 -75
- package/dead-code-eliminator/cross-bundle/import-export-walker.js.map +1 -1
- package/dead-code-eliminator/cross-bundle/seed-store.js +1 -22
- package/dead-code-eliminator/cross-bundle/seed-store.js.map +1 -1
- package/dead-code-eliminator/dependency-metadata.js +3 -205
- package/dead-code-eliminator/dependency-metadata.js.map +1 -1
- package/dead-code-eliminator/elimination-emitter.js +0 -52
- package/dead-code-eliminator/elimination-emitter.js.map +1 -1
- package/dead-code-eliminator/eliminator.js +8 -64
- package/dead-code-eliminator/eliminator.js.map +1 -1
- package/dead-code-eliminator/expression-unwrapping.js +1 -16
- package/dead-code-eliminator/expression-unwrapping.js.map +1 -1
- package/dead-code-eliminator/imported-expression-origin.js +2 -101
- package/dead-code-eliminator/imported-expression-origin.js.map +1 -1
- package/dead-code-eliminator/liveness/asset-side-effects.js +1 -9
- package/dead-code-eliminator/liveness/asset-side-effects.js.map +1 -1
- package/dead-code-eliminator/liveness/boolean-facts.js +2 -98
- package/dead-code-eliminator/liveness/boolean-facts.js.map +1 -1
- package/dead-code-eliminator/liveness/external-module-resolution.js +2 -172
- package/dead-code-eliminator/liveness/external-module-resolution.js.map +1 -1
- package/dead-code-eliminator/liveness/external-purity-summary.js +3 -294
- package/dead-code-eliminator/liveness/external-purity-summary.js.map +1 -1
- package/dead-code-eliminator/liveness/external-purity.js +3 -39
- package/dead-code-eliminator/liveness/external-purity.js.map +1 -1
- package/dead-code-eliminator/liveness/module-analysis.js +2 -27
- package/dead-code-eliminator/liveness/module-analysis.js.map +1 -1
- package/dead-code-eliminator/liveness/resource-retention.js +1 -78
- package/dead-code-eliminator/liveness/resource-retention.js.map +1 -1
- package/dead-code-eliminator/liveness/runtime-code.js +1 -15
- package/dead-code-eliminator/liveness/runtime-code.js.map +1 -1
- package/dead-code-eliminator/load-bundle.js +5 -70
- package/dead-code-eliminator/load-bundle.js.map +1 -1
- package/dead-code-eliminator/pure-expression.js +5 -178
- package/dead-code-eliminator/pure-expression.js.map +1 -1
- package/dead-code-eliminator/reachability/bfs-closure.js +0 -50
- package/dead-code-eliminator/reachability/bfs-closure.js.map +1 -1
- package/dead-code-eliminator/reachability/binding-extractor.js +2 -100
- package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
- package/dead-code-eliminator/reachability/binding-id.js +0 -32
- package/dead-code-eliminator/reachability/binding-id.js.map +1 -1
- package/dead-code-eliminator/reachability/identifier-target-collector.js +1 -39
- package/dead-code-eliminator/reachability/identifier-target-collector.js.map +1 -1
- package/dead-code-eliminator/reachability/impure-statements.js +2 -11
- package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
- package/dead-code-eliminator/reachability/local-seed-gathering.js +4 -43
- package/dead-code-eliminator/reachability/local-seed-gathering.js.map +1 -1
- package/dead-code-eliminator/reachability/reachability.js +4 -38
- package/dead-code-eliminator/reachability/reachability.js.map +1 -1
- package/dead-code-eliminator/side-effect-classifier.js +4 -39
- package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
- package/dead-code-eliminator/side-effects-field.js +1 -23
- package/dead-code-eliminator/side-effects-field.js.map +1 -1
- package/dead-code-eliminator/source-map-recomposition.js +2 -29
- package/dead-code-eliminator/source-map-recomposition.js.map +1 -1
- package/dead-code-eliminator/statement-classifiers.js +4 -94
- package/dead-code-eliminator/statement-classifiers.js.map +1 -1
- package/dead-code-eliminator/syntax-kind-sets.js +0 -16
- package/dead-code-eliminator/syntax-kind-sets.js.map +1 -1
- package/dead-code-eliminator/transform/atom-translator.d.ts +0 -8
- package/dead-code-eliminator/transform/atom-translator.d.ts.map +1 -1
- package/dead-code-eliminator/transform/atom-translator.js +2 -57
- package/dead-code-eliminator/transform/atom-translator.js.map +1 -1
- package/dead-code-eliminator/transform/declaration-removal.js +4 -135
- package/dead-code-eliminator/transform/declaration-removal.js.map +1 -1
- package/dead-code-eliminator/transform/declaration-remover.js +2 -17
- package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
- package/dead-code-eliminator/transform/line-index.d.ts +0 -7
- package/dead-code-eliminator/transform/line-index.d.ts.map +1 -1
- package/dead-code-eliminator/transform/line-index.js +0 -20
- package/dead-code-eliminator/transform/line-index.js.map +1 -1
- package/dead-code-eliminator/transform/named-declaration-kinds.js +0 -3
- package/dead-code-eliminator/transform/named-declaration-kinds.js.map +1 -1
- package/dead-code-eliminator/transform/source-map-composer.js +3 -84
- package/dead-code-eliminator/transform/source-map-composer.js.map +1 -1
- package/dead-code-eliminator/variable-declaration-bindings.js +1 -25
- package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -1
- package/dependency-scanner/dependency-graph.js +3 -74
- package/dependency-scanner/dependency-graph.js.map +1 -1
- package/dependency-scanner/external-dependencies.d.ts +0 -9
- package/dependency-scanner/external-dependencies.d.ts.map +1 -1
- package/dependency-scanner/external-dependencies.js +1 -55
- package/dependency-scanner/external-dependencies.js.map +1 -1
- package/dependency-scanner/file-host-predicates.js +0 -9
- package/dependency-scanner/file-host-predicates.js.map +1 -1
- package/dependency-scanner/host-method-binding.js +0 -18
- package/dependency-scanner/host-method-binding.js.map +1 -1
- package/dependency-scanner/injected-dynamic-imports.js +1 -232
- package/dependency-scanner/injected-dynamic-imports.js.map +1 -1
- package/dependency-scanner/node-modules-manifest-synthesizer.js +4 -52
- package/dependency-scanner/node-modules-manifest-synthesizer.js.map +1 -1
- package/dependency-scanner/package-owned-asset-file-path.js +1 -9
- package/dependency-scanner/package-owned-asset-file-path.js.map +1 -1
- package/dependency-scanner/scanner.js +4 -102
- package/dependency-scanner/scanner.js.map +1 -1
- package/dependency-scanner/source-file-references.js +6 -174
- package/dependency-scanner/source-file-references.js.map +1 -1
- package/dependency-scanner/source-map-file-locator.js +2 -66
- package/dependency-scanner/source-map-file-locator.js.map +1 -1
- package/dependency-scanner/typescript-compiler-options.js +1 -21
- package/dependency-scanner/typescript-compiler-options.js.map +1 -1
- package/dependency-scanner/typescript-file-host.js +5 -49
- package/dependency-scanner/typescript-file-host.js.map +1 -1
- package/dependency-scanner/typescript-project-analyzer.js +3 -35
- package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
- package/dependency-scanner/virtual-package-json-host.js +4 -45
- package/dependency-scanner/virtual-package-json-host.js.map +1 -1
- package/directed-graph/graph.d.ts +0 -1
- package/directed-graph/graph.d.ts.map +1 -1
- package/directed-graph/graph.js +1 -240
- package/directed-graph/graph.js.map +1 -1
- package/file-manager/compare.js +2 -23
- package/file-manager/compare.js.map +1 -1
- package/file-manager/equal.js +0 -5
- package/file-manager/equal.js.map +1 -1
- package/file-manager/file-description.d.ts +0 -1
- package/file-manager/file-description.d.ts.map +1 -1
- package/file-manager/file-description.js +0 -3
- package/file-manager/file-description.js.map +1 -1
- package/file-manager/permissions.js +1 -28
- package/file-manager/permissions.js.map +1 -1
- package/git/current-git-head.js +0 -24
- package/git/current-git-head.js.map +1 -1
- package/git/git-command.js +1 -49
- package/git/git-command.js.map +1 -1
- package/linker/linked-bundle.d.ts +0 -8
- package/linker/linked-bundle.d.ts.map +1 -1
- package/linker/linked-bundle.js +0 -5
- package/linker/linked-bundle.js.map +1 -1
- package/linker/linker.js +5 -51
- package/linker/linker.js.map +1 -1
- package/linker/replacement-lookup.js +8 -295
- package/linker/replacement-lookup.js.map +1 -1
- package/linker/resource-graph.js +2 -44
- package/linker/resource-graph.js.map +1 -1
- package/linker/source-modifier/import-paths.js +3 -76
- package/linker/source-modifier/import-paths.js.map +1 -1
- package/linker/substitute-bundles.js +3 -140
- package/linker/substitute-bundles.js.map +1 -1
- package/linker/substituted-resource-graph.js +2 -99
- package/linker/substituted-resource-graph.js.map +1 -1
- package/npm-oidc-id-token-resolver.js +0 -82
- package/npm-oidc-id-token-resolver.js.map +1 -1
- package/pack-emitter/pack-emitter.d.ts +0 -20
- package/pack-emitter/pack-emitter.d.ts.map +1 -1
- package/pack-emitter/pack-emitter.js +0 -27
- package/pack-emitter/pack-emitter.js.map +1 -1
- package/package-surface/bin-field.js +2 -8
- package/package-surface/bin-field.js.map +1 -1
- package/package-surface/explicit-bin.js +2 -24
- package/package-surface/explicit-bin.js.map +1 -1
- package/package-surface/explicit-exports.js +3 -26
- package/package-surface/explicit-exports.js.map +1 -1
- package/package-surface/export-map.js +2 -9
- package/package-surface/export-map.js.map +1 -1
- package/package-surface/implicit-bin.js +1 -25
- package/package-surface/implicit-bin.js.map +1 -1
- package/package-surface/implicit-exports.js +3 -10
- package/package-surface/implicit-exports.js.map +1 -1
- package/package-surface/implicit-root-exports.js +2 -13
- package/package-surface/implicit-root-exports.js.map +1 -1
- package/package-surface/package-json-export.js +0 -9
- package/package-surface/package-json-export.js.map +1 -1
- package/package-surface/package-shape.js +1 -10
- package/package-surface/package-shape.js.map +1 -1
- package/package-surface/package-surface-index.js +3 -165
- package/package-surface/package-surface-index.js.map +1 -1
- package/package-surface/public-module-usage.js +3 -46
- package/package-surface/public-module-usage.js.map +1 -1
- package/package-surface/public-specifiers.js +1 -7
- package/package-surface/public-specifiers.js.map +1 -1
- package/package-surface/root-registry.js +0 -26
- package/package-surface/root-registry.js.map +1 -1
- package/package-surface/specifier-syntax.js +0 -4
- package/package-surface/specifier-syntax.js.map +1 -1
- package/package-surface/substitution-exports.js +3 -101
- package/package-surface/substitution-exports.js.map +1 -1
- package/package-surface/surface.d.ts +0 -2
- package/package-surface/surface.d.ts.map +1 -1
- package/package-surface/surface.js +0 -12
- package/package-surface/surface.js.map +1 -1
- package/package.json +1 -1
- package/packages/package-processor.composition.d.ts +0 -22
- package/packages/package-processor.composition.d.ts.map +1 -1
- package/packages/package-processor.composition.js +34 -160
- package/packages/package-processor.composition.js.map +1 -1
- package/packtory/map-config.d.ts +3 -22
- package/packtory/map-config.d.ts.map +1 -1
- package/packtory/map-config.js +4 -35
- package/packtory/map-config.js.map +1 -1
- package/packtory/normalize-paths.js +1 -25
- package/packtory/normalize-paths.js.map +1 -1
- package/packtory/options/bundle-dependency-resolution.js +1 -17
- package/packtory/options/bundle-dependency-resolution.js.map +1 -1
- package/packtory/options/dead-code-elimination-resolution.js +1 -10
- package/packtory/options/dead-code-elimination-resolution.js.map +1 -1
- package/packtory/options/prepare-package-options.d.ts +0 -14
- package/packtory/options/prepare-package-options.d.ts.map +1 -1
- package/packtory/options/prepare-package-options.js +5 -46
- package/packtory/options/prepare-package-options.js.map +1 -1
- package/packtory/options/required-value-helpers.js +0 -17
- package/packtory/options/required-value-helpers.js.map +1 -1
- package/packtory/options/setting-resolvers.d.ts +0 -18
- package/packtory/options/setting-resolvers.d.ts.map +1 -1
- package/packtory/options/setting-resolvers.js +3 -47
- package/packtory/options/setting-resolvers.js.map +1 -1
- package/packtory/options/surface-resolution.js +2 -15
- package/packtory/options/surface-resolution.js.map +1 -1
- package/packtory/options/version-provider-context.js +2 -24
- package/packtory/options/version-provider-context.js.map +1 -1
- package/packtory/options/version-trigger.js +2 -39
- package/packtory/options/version-trigger.js.map +1 -1
- package/packtory/pack-output-preflight.js +3 -60
- package/packtory/pack-output-preflight.js.map +1 -1
- package/packtory/package-processor-build.js +3 -97
- package/packtory/package-processor-build.js.map +1 -1
- package/packtory/package-processor-publish.d.ts +0 -13
- package/packtory/package-processor-publish.d.ts.map +1 -1
- package/packtory/package-processor-publish.js +5 -293
- package/packtory/package-processor-publish.js.map +1 -1
- package/packtory/package-processor.d.ts +1 -34
- package/packtory/package-processor.d.ts.map +1 -1
- package/packtory/package-processor.js +2 -10
- package/packtory/package-processor.js.map +1 -1
- package/packtory/packtory-pack.js +10 -298
- package/packtory/packtory-pack.js.map +1 -1
- package/packtory/packtory-package-dependencies.js +7 -135
- package/packtory/packtory-package-dependencies.js.map +1 -1
- package/packtory/packtory-package-tree.js +4 -43
- package/packtory/packtory-package-tree.js.map +1 -1
- package/packtory/packtory-publish.js +4 -17
- package/packtory/packtory-publish.js.map +1 -1
- package/packtory/packtory-release-analysis.js +6 -64
- package/packtory/packtory-release-analysis.js.map +1 -1
- package/packtory/packtory-release-diff.js +5 -48
- package/packtory/packtory-release-diff.js.map +1 -1
- package/packtory/packtory-release-plan.js +6 -87
- package/packtory/packtory-release-plan.js.map +1 -1
- package/packtory/packtory-resolve.js +5 -16
- package/packtory/packtory-resolve.js.map +1 -1
- package/packtory/packtory.d.ts +1 -28
- package/packtory/packtory.d.ts.map +1 -1
- package/packtory/packtory.js +12 -225
- package/packtory/packtory.js.map +1 -1
- package/packtory/publish-failure-mapping.js +0 -6
- package/packtory/publish-failure-mapping.js.map +1 -1
- package/packtory/published-release-state.d.ts +0 -19
- package/packtory/published-release-state.d.ts.map +1 -1
- package/packtory/published-release-state.js +0 -11
- package/packtory/published-release-state.js.map +1 -1
- package/packtory/release-analysis.js +5 -153
- package/packtory/release-analysis.js.map +1 -1
- package/packtory/release-diff-failure-mapping.js +0 -6
- package/packtory/release-diff-failure-mapping.js.map +1 -1
- package/packtory/release-plan.js +7 -135
- package/packtory/release-plan.js.map +1 -1
- package/packtory/report-attachment.js +2 -35
- package/packtory/report-attachment.js.map +1 -1
- package/packtory/resolved-package.d.ts +0 -11
- package/packtory/resolved-package.d.ts.map +1 -1
- package/packtory/resolved-package.js +3 -97
- package/packtory/resolved-package.js.map +1 -1
- package/packtory/scheduler.d.ts +0 -47
- package/packtory/scheduler.d.ts.map +1 -1
- package/packtory/scheduler.js +1 -99
- package/packtory/scheduler.js.map +1 -1
- package/packtory/stages/package-analysis-stage.js +2 -50
- package/packtory/stages/package-analysis-stage.js.map +1 -1
- package/packtory/stages/package-resolution-stage.js +5 -80
- package/packtory/stages/package-resolution-stage.js.map +1 -1
- package/packtory/stages/publish-stage.js +3 -54
- package/packtory/stages/publish-stage.js.map +1 -1
- package/packtory/stages/release-diff-stage.js +5 -84
- package/packtory/stages/release-diff-stage.js.map +1 -1
- package/progress/progress-broadcaster.d.ts +0 -1
- package/progress/progress-broadcaster.d.ts.map +1 -1
- package/progress/progress-broadcaster.js +0 -45
- package/progress/progress-broadcaster.js.map +1 -1
- package/published-package/published-package.d.ts +0 -2
- package/published-package/published-package.d.ts.map +1 -1
- package/published-package/published-package.js +1 -12
- package/published-package/published-package.js.map +1 -1
- package/report/aggregator/artifact-entry-merger.js +0 -20
- package/report/aggregator/artifact-entry-merger.js.map +1 -1
- package/report/aggregator/package-report-materialization.js +2 -75
- package/report/aggregator/package-report-materialization.js.map +1 -1
- package/report/aggregator/report-aggregator.js +2 -37
- package/report/aggregator/report-aggregator.js.map +1 -1
- package/report/aggregator/report-event-handlers.js +2 -141
- package/report/aggregator/report-event-handlers.js.map +1 -1
- package/report/aggregator/report-types.d.ts +0 -21
- package/report/aggregator/report-types.d.ts.map +1 -1
- package/report/aggregator/report-types.js +0 -3
- package/report/aggregator/report-types.js.map +1 -1
- package/report/config-redactor.js +3 -29
- package/report/config-redactor.js.map +1 -1
- package/report/decorators.js +0 -76
- package/report/decorators.js.map +1 -1
- package/report/inspectors/inspect-artifact-sizes.js +1 -34
- package/report/inspectors/inspect-artifact-sizes.js.map +1 -1
- package/report/inspectors/inspect-linker-rewrites.js +1 -14
- package/report/inspectors/inspect-linker-rewrites.js.map +1 -1
- package/report/inspectors/inspect-package-json-provenance.js +0 -15
- package/report/inspectors/inspect-package-json-provenance.js.map +1 -1
- package/report/inspectors/inspect-scan-results.js +0 -15
- package/report/inspectors/inspect-scan-results.js.map +1 -1
- package/report/release-diff/release-version-transition.js +0 -18
- package/report/release-diff/release-version-transition.js.map +1 -1
- package/resource-resolver/bundle-resource-lookup.js +0 -25
- package/resource-resolver/bundle-resource-lookup.js.map +1 -1
- package/resource-resolver/content.js +3 -81
- package/resource-resolver/content.js.map +1 -1
- package/resource-resolver/dependency-resolution-walker.js +2 -73
- package/resource-resolver/dependency-resolution-walker.js.map +1 -1
- package/resource-resolver/resolved-bundle.d.ts +0 -17
- package/resource-resolver/resolved-bundle.d.ts.map +1 -1
- package/resource-resolver/resolved-bundle.js +0 -3
- package/resource-resolver/resolved-bundle.js.map +1 -1
- package/resource-resolver/resource-resolve-options.d.ts +0 -5
- package/resource-resolver/resource-resolve-options.d.ts.map +1 -1
- package/resource-resolver/resource-resolve-options.js +1 -13
- package/resource-resolver/resource-resolve-options.js.map +1 -1
- package/resource-resolver/resource-resolver.js +5 -83
- package/resource-resolver/resource-resolver.js.map +1 -1
- package/sbom/extract-license.js +1 -11
- package/sbom/extract-license.js.map +1 -1
- package/sbom/license-resolver.js +2 -23
- package/sbom/license-resolver.js.map +1 -1
- package/sbom/sbom-builder.js +2 -57
- package/sbom/sbom-builder.js.map +1 -1
- package/sbom/sbom-canonicalizer.js +3 -45
- package/sbom/sbom-canonicalizer.js.map +1 -1
- package/sbom/sbom-file.d.ts +0 -10
- package/sbom/sbom-file.d.ts.map +1 -1
- package/sbom/sbom-file.js +5 -54
- package/sbom/sbom-file.js.map +1 -1
- package/sbom/sbom-serializer.js +1 -14
- package/sbom/sbom-serializer.js.map +1 -1
- package/sbom/tool-version.js +1 -49
- package/sbom/tool-version.js.map +1 -1
- package/sbom.cdx.json +5 -5
- package/tar/extract-tar.js +3 -83
- package/tar/extract-tar.js.map +1 -1
- package/tar/gzipped-pack.js +0 -20
- package/tar/gzipped-pack.js.map +1 -1
- package/tar/tarball-builder.js +4 -44
- package/tar/tarball-builder.js.map +1 -1
- package/vendor-materializer/vendor-entry.js +1 -20
- package/vendor-materializer/vendor-entry.js.map +1 -1
- package/vendor-materializer/vendor-materializer.js +8 -240
- package/vendor-materializer/vendor-materializer.js.map +1 -1
- package/version-manager/dependencies/bundle-dependency-grouping.js +2 -32
- package/version-manager/dependencies/bundle-dependency-grouping.js.map +1 -1
- package/version-manager/dependencies/dependency-groups.js +1 -11
- package/version-manager/dependencies/dependency-groups.js.map +1 -1
- package/version-manager/dependencies/external-dependency-classification.js +3 -82
- package/version-manager/dependencies/external-dependency-classification.js.map +1 -1
- package/version-manager/dependencies/versioned-bundle-dependencies.js +3 -8
- package/version-manager/dependencies/versioned-bundle-dependencies.js.map +1 -1
- package/version-manager/imports/hash-import-scanner.js +2 -20
- package/version-manager/imports/hash-import-scanner.js.map +1 -1
- package/version-manager/imports/imports-key-matcher.js +0 -22
- package/version-manager/imports/imports-key-matcher.js.map +1 -1
- package/version-manager/imports/versioned-bundle-imports.js +2 -44
- package/version-manager/imports/versioned-bundle-imports.js.map +1 -1
- package/version-manager/manager.d.ts +0 -5
- package/version-manager/manager.d.ts.map +1 -1
- package/version-manager/manager.js +6 -46
- package/version-manager/manager.js.map +1 -1
- package/version-manager/manifest/builder.js +1 -51
- package/version-manager/manifest/builder.js.map +1 -1
- package/version-manager/manifest/serialize.js +1 -8
- package/version-manager/manifest/serialize.js.map +1 -1
- package/version-manager/optional-bundle-fields.js +1 -5
- package/version-manager/optional-bundle-fields.js.map +1 -1
- package/version-manager/representative-root.js +1 -9
- package/version-manager/representative-root.js.map +1 -1
- package/version-manager/specifier-classifier.js +2 -42
- package/version-manager/specifier-classifier.js.map +1 -1
- package/version-manager/specifier-errors.js +0 -58
- package/version-manager/specifier-errors.js.map +1 -1
- package/version-manager/versioned-bundle.d.ts +1 -3
- package/version-manager/versioned-bundle.d.ts.map +1 -1
- package/version-manager/versioned-bundle.js +6 -31
- package/version-manager/versioned-bundle.js.map +1 -1
- package/zip/zip-builder.js +2 -81
- package/zip/zip-builder.js.map +1 -1
- package/artifacts/artifacts-builder.d.ts +0 -28
- package/artifacts/artifacts-builder.d.ts.map +0 -1
- package/bundle-emitter/registry/registry-auth-config.d.ts +0 -17
- package/bundle-emitter/registry/registry-auth-config.d.ts.map +0 -1
- package/checks/check-runner.d.ts +0 -18
- package/checks/check-runner.d.ts.map +0 -1
- package/checks/rule.d.ts +0 -42
- package/checks/rule.d.ts.map +0 -1
- package/checks/rules/max-bundle-size.d.ts +0 -13
- package/checks/rules/max-bundle-size.d.ts.map +0 -1
- package/checks/rules/no-dev-dependency-imports.d.ts +0 -11
- package/checks/rules/no-dev-dependency-imports.d.ts.map +0 -1
- package/checks/rules/no-duplicated-files.d.ts +0 -11
- package/checks/rules/no-duplicated-files.d.ts.map +0 -1
- package/checks/rules/no-side-effects.d.ts +0 -15
- package/checks/rules/no-side-effects.d.ts.map +0 -1
- package/checks/rules/no-unexposed-executables.d.ts +0 -8
- package/checks/rules/no-unexposed-executables.d.ts.map +0 -1
- package/checks/rules/no-unused-bundle-dependencies.d.ts +0 -8
- package/checks/rules/no-unused-bundle-dependencies.d.ts.map +0 -1
- package/checks/rules/registry.d.ts +0 -23
- package/checks/rules/registry.d.ts.map +0 -1
- package/checks/rules/required-files.d.ts +0 -15
- package/checks/rules/required-files.d.ts.map +0 -1
- package/checks/rules/type-script-declaration-integrity.d.ts +0 -9
- package/checks/rules/type-script-declaration-integrity.d.ts.map +0 -1
- package/checks/rules/type-script-declaration-project.d.ts +0 -29
- package/checks/rules/type-script-declaration-project.d.ts.map +0 -1
- package/checks/rules/type-script-integrity.d.ts +0 -24
- package/checks/rules/type-script-integrity.d.ts.map +0 -1
- package/checks/rules/type-script-package-resolution.d.ts +0 -29
- package/checks/rules/type-script-package-resolution.d.ts.map +0 -1
- package/checks/rules/unique-target-paths.d.ts +0 -8
- package/checks/rules/unique-target-paths.d.ts.map +0 -1
- package/dependency-scanner/dependency-graph.d.ts +0 -38
- package/dependency-scanner/dependency-graph.d.ts.map +0 -1
- package/dependency-scanner/scanner.d.ts +0 -20
- package/dependency-scanner/scanner.d.ts.map +0 -1
- package/dependency-scanner/source-file-references.d.ts +0 -30
- package/dependency-scanner/source-file-references.d.ts.map +0 -1
- package/dependency-scanner/source-map-file-locator.d.ts +0 -10
- package/dependency-scanner/source-map-file-locator.d.ts.map +0 -1
- package/dependency-scanner/typescript-compiler-options.d.ts +0 -8
- package/dependency-scanner/typescript-compiler-options.d.ts.map +0 -1
- package/dependency-scanner/typescript-file-host.d.ts +0 -12
- package/dependency-scanner/typescript-file-host.d.ts.map +0 -1
- package/dependency-scanner/typescript-project-analyzer.d.ts +0 -19
- package/dependency-scanner/typescript-project-analyzer.d.ts.map +0 -1
- package/git/current-git-head.d.ts +0 -12
- package/git/current-git-head.d.ts.map +0 -1
- package/linker/linker.d.ts +0 -13
- package/linker/linker.d.ts.map +0 -1
- package/resource-resolver/resource-resolver.d.ts +0 -15
- package/resource-resolver/resource-resolver.d.ts.map +0 -1
- package/sbom/license-resolver.d.ts +0 -14
- package/sbom/license-resolver.d.ts.map +0 -1
- package/sbom/sbom-serializer.d.ts +0 -8
- package/sbom/sbom-serializer.d.ts.map +0 -1
- package/tar/tarball-builder.d.ts +0 -14
- package/tar/tarball-builder.d.ts.map +0 -1
- package/vendor-materializer/vendor-entry.d.ts +0 -12
- package/vendor-materializer/vendor-entry.d.ts.map +0 -1
- package/vendor-materializer/vendor-materializer.d.ts +0 -55
- package/vendor-materializer/vendor-materializer.d.ts.map +0 -1
- package/zip/zip-builder.d.ts +0 -22
- package/zip/zip-builder.d.ts.map +0 -1
package/linker/linker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker.js","sourceRoot":"","sources":["../../../../source/linker/linker.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"linker.js","sourceRoot":"","sources":["../../../../source/linker/linker.ts"],"names":[],"mappings":"AAAA,OAA4D,yCAAyC,CAAC;AACtG,OAA+C,0CAA0C,CAAC;AAC1F,OAAuC,yBAAyB,CAAC;AAEjE,OAA8C,qBAAqB,CAAC;AACpE,OAA+B,yBAAyB,CAAC"}
|
|
@@ -1,296 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
export function ownsSourcePath(file, bundle) {
|
|
10
|
-
return bundle.contents.some(function (content) {
|
|
11
|
-
return content.fileDescription.sourceFilePath === file;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
function needsImportReplacement(file) {
|
|
15
|
-
return !file.endsWith('.map');
|
|
16
|
-
}
|
|
17
|
-
function isDefined(value) {
|
|
18
|
-
return value !== undefined;
|
|
19
|
-
}
|
|
20
|
-
function createContentLookup(bundle) {
|
|
21
|
-
const contentBySourcePath = new Map();
|
|
22
|
-
const sourcePathByTargetPath = new Map();
|
|
23
|
-
for (const content of bundle.contents) {
|
|
24
|
-
contentBySourcePath.set(content.fileDescription.sourceFilePath, content);
|
|
25
|
-
sourcePathByTargetPath.set(content.fileDescription.targetFilePath, content.fileDescription.sourceFilePath);
|
|
26
|
-
}
|
|
27
|
-
return { contentBySourcePath, sourcePathByTargetPath };
|
|
28
|
-
}
|
|
29
|
-
function exportDeclaration(statement) {
|
|
30
|
-
if (!typescript.isExportDeclaration(statement)) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
return statement;
|
|
34
|
-
}
|
|
35
|
-
function moduleSpecifierText(statement) {
|
|
36
|
-
const { moduleSpecifier } = statement;
|
|
37
|
-
if (moduleSpecifier === undefined) {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
if (!typescript.isStringLiteral(moduleSpecifier) || !moduleSpecifier.text.startsWith('.')) {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
return moduleSpecifier.text;
|
|
44
|
-
}
|
|
45
|
-
function exportDeclarations(content) {
|
|
46
|
-
const sourceFile = typescript.createSourceFile(content, content, typescript.ScriptTarget.Latest);
|
|
47
|
-
return sourceFile
|
|
48
|
-
.statements
|
|
49
|
-
.map(exportDeclaration)
|
|
50
|
-
.filter(isDefined);
|
|
51
|
-
}
|
|
52
|
-
function exportedTargetPath(currentTargetFilePath, specifier) {
|
|
53
|
-
return path.posix.normalize(path.posix.join(path.posix.dirname(currentTargetFilePath), specifier));
|
|
54
|
-
}
|
|
55
|
-
function exportedSourceFilePaths(lookup, currentTargetFilePath, specifier) {
|
|
56
|
-
const targetPath = exportedTargetPath(currentTargetFilePath, specifier);
|
|
57
|
-
const sourceFilePaths = [];
|
|
58
|
-
for (const candidate of [targetPath, ...declarationCompanionCandidates(targetPath)]) {
|
|
59
|
-
for (const [targetFilePath, sourceFilePath] of lookup.sourcePathByTargetPath) {
|
|
60
|
-
if (targetFilePath === candidate) {
|
|
61
|
-
sourceFilePaths.push(sourceFilePath);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return sourceFilePaths;
|
|
66
|
-
}
|
|
67
|
-
function namedExports(declaration) {
|
|
68
|
-
const { exportClause } = declaration;
|
|
69
|
-
if (exportClause === undefined || !typescript.isNamedExports(exportClause)) {
|
|
70
|
-
return [];
|
|
71
|
-
}
|
|
72
|
-
return Array.from(exportClause.elements);
|
|
73
|
-
}
|
|
74
|
-
function isExportStar(declaration) {
|
|
75
|
-
return declaration.exportClause === undefined;
|
|
76
|
-
}
|
|
77
|
-
function declarationSourceFilePaths(lookup, currentTargetFilePath, declaration) {
|
|
78
|
-
return exportedSourceFilePaths(lookup, currentTargetFilePath, moduleSpecifierText(declaration) ?? '');
|
|
79
|
-
}
|
|
80
|
-
const pathClosureDependencies = {
|
|
81
|
-
visitedHas(visited, value) {
|
|
82
|
-
return visited.has(value);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
function exportStateValue(value, property) {
|
|
86
|
-
return Reflect.get(new Object(value), property);
|
|
87
|
-
}
|
|
88
|
-
function sourceFilePathForState(state) {
|
|
89
|
-
return state.sourceFilePath;
|
|
90
|
-
}
|
|
91
|
-
const exportClosureDependencies = {
|
|
92
|
-
visitedHas(visited, value) {
|
|
93
|
-
return Array.from(visited).some(function (state) {
|
|
94
|
-
return exportStateValue(state, 'sourceFilePath') === exportStateValue(value, 'sourceFilePath') &&
|
|
95
|
-
exportStateValue(state, 'exportName') === exportStateValue(value, 'exportName');
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
function exportedStateNames(lookup, state) {
|
|
100
|
-
const content = lookup.contentBySourcePath.get(sourceFilePathForState(state));
|
|
101
|
-
if (content === undefined) {
|
|
102
|
-
return Array.from(new Set());
|
|
103
|
-
}
|
|
104
|
-
return exportDeclarations(content.fileDescription.content).flatMap(function (declaration) {
|
|
105
|
-
const sourceFilePaths = declarationSourceFilePaths(lookup, content.fileDescription.targetFilePath, declaration);
|
|
106
|
-
const exportStarStates = sourceFilePaths
|
|
107
|
-
.filter(function () {
|
|
108
|
-
return state.exportName !== 'default' && isExportStar(declaration);
|
|
109
|
-
})
|
|
110
|
-
.map(function (nextSourceFilePath) {
|
|
111
|
-
return { sourceFilePath: nextSourceFilePath, exportName: state.exportName };
|
|
112
|
-
});
|
|
113
|
-
const namedExportStates = namedExports(declaration)
|
|
114
|
-
.filter(function (namedExport) {
|
|
115
|
-
return namedExport.name.text === state.exportName;
|
|
116
|
-
})
|
|
117
|
-
.flatMap(function (namedExport) {
|
|
118
|
-
const sourceExportName = namedExport.propertyName?.text ?? namedExport.name.text;
|
|
119
|
-
return sourceFilePaths.map(function (nextSourceFilePath) {
|
|
120
|
-
return { sourceFilePath: nextSourceFilePath, exportName: sourceExportName };
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
return [...exportStarStates, ...namedExportStates];
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function publicModuleCanExport(rootSourceFilePathsForModule, lookup, request, exportName) {
|
|
127
|
-
const closure = bfsClosure(rootSourceFilePathsForModule.map(function (sourceFilePath) {
|
|
128
|
-
return { sourceFilePath, exportName };
|
|
129
|
-
}), function (state) {
|
|
130
|
-
return exportedStateNames(lookup, state);
|
|
131
|
-
}, new Set(), { dependencies: exportClosureDependencies, maximumNodeCount: lookup.contentBySourcePath.size });
|
|
132
|
-
return Array.from(closure).some(function (state) {
|
|
133
|
-
return sourceFilePathForState(state) === request.sourceFilePath;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
function publicModuleReachesSourceFile(rootSourceFilePathsForModule, lookup, request) {
|
|
137
|
-
const closure = bfsClosure(rootSourceFilePathsForModule, function (sourceFilePath) {
|
|
138
|
-
const content = lookup.contentBySourcePath.get(sourceFilePath);
|
|
139
|
-
return content === undefined
|
|
140
|
-
? new Array()
|
|
141
|
-
: exportDeclarations(content.fileDescription.content).flatMap(function (declaration) {
|
|
142
|
-
return declarationSourceFilePaths(lookup, content.fileDescription.targetFilePath, declaration);
|
|
143
|
-
});
|
|
144
|
-
}, new Set(), { dependencies: pathClosureDependencies, maximumNodeCount: lookup.contentBySourcePath.size });
|
|
145
|
-
return closure.has(request.sourceFilePath);
|
|
146
|
-
}
|
|
147
|
-
function publicModuleCanSatisfyRequest(rootSourceFilePathsForModule, lookup, request) {
|
|
148
|
-
if (request.requiredExportNames.size === 0 && !request.requiresNamespaceExport) {
|
|
149
|
-
return publicModuleReachesSourceFile(rootSourceFilePathsForModule, lookup, request);
|
|
150
|
-
}
|
|
151
|
-
for (const exportName of request.requiredExportNames) {
|
|
152
|
-
if (!publicModuleCanExport(rootSourceFilePathsForModule, lookup, request, exportName)) {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
if (!request.requiresNamespaceExport) {
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
return publicModuleCanExport(rootSourceFilePathsForModule, lookup, request, undefined);
|
|
160
|
-
}
|
|
161
|
-
function shortestSpecifier(specifiers) {
|
|
162
|
-
const [specifier] = specifiers.toSorted(function (left, right) {
|
|
163
|
-
return left.length - right.length;
|
|
164
|
-
});
|
|
165
|
-
return specifier;
|
|
166
|
-
}
|
|
167
|
-
function getExplicitPublicModuleSpecifierForSourcePath(bundle, surface, request) {
|
|
168
|
-
const lookup = createContentLookup(bundle);
|
|
169
|
-
const specifiers = [];
|
|
170
|
-
const moduleEntries = surface.packageInterface.modules ?? [];
|
|
171
|
-
for (const moduleEntry of moduleEntries) {
|
|
172
|
-
const root = getRoot(bundle, moduleEntry.root);
|
|
173
|
-
const rootPaths = rootSourceFilePaths(root);
|
|
174
|
-
const candidate = toPackageSpecifier(bundle.name, moduleEntry.export);
|
|
175
|
-
if (publicModuleCanSatisfyRequest(rootPaths, lookup, request)) {
|
|
176
|
-
specifiers.push(candidate);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return shortestSpecifier(specifiers);
|
|
180
|
-
}
|
|
181
|
-
function getImplicitPublicModuleSpecifierForSourcePath(bundle, surface, request) {
|
|
182
|
-
const lookup = createContentLookup(bundle);
|
|
183
|
-
const specifiers = [];
|
|
184
|
-
const defaultRoot = getRoot(bundle, surface.defaultModuleRoot);
|
|
185
|
-
if (publicModuleCanSatisfyRequest(rootSourceFilePaths(defaultRoot), lookup, request)) {
|
|
186
|
-
specifiers.push(bundle.name);
|
|
187
|
-
}
|
|
188
|
-
for (const root of Object.values(bundle.roots)) {
|
|
189
|
-
const candidate = toPackageSpecifier(bundle.name, `./${root.js.targetFilePath}`);
|
|
190
|
-
if (publicModuleCanSatisfyRequest(rootSourceFilePaths(root), lookup, request)) {
|
|
191
|
-
specifiers.push(candidate);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return shortestSpecifier(specifiers) ?? getPublicModuleSpecifierForSourcePath(bundle, request.sourceFilePath);
|
|
195
|
-
}
|
|
196
|
-
function getExistingPublicModuleSpecifierForSourcePath(bundle, request) {
|
|
197
|
-
const { surface } = bundle;
|
|
198
|
-
if (surface.mode === 'implicit') {
|
|
199
|
-
return getImplicitPublicModuleSpecifierForSourcePath(bundle, surface, request);
|
|
200
|
-
}
|
|
201
|
-
return getExplicitPublicModuleSpecifierForSourcePath(bundle, surface, request);
|
|
202
|
-
}
|
|
203
|
-
function findReplacementInBundles(request, bundles, getTargetPath) {
|
|
204
|
-
for (const bundle of bundles) {
|
|
205
|
-
const targetPath = getTargetPath(bundle, request);
|
|
206
|
-
if (targetPath !== undefined) {
|
|
207
|
-
return {
|
|
208
|
-
bundle,
|
|
209
|
-
replacement: {
|
|
210
|
-
emittedSpecifier: targetPath,
|
|
211
|
-
packageName: bundle.name
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
if (needsImportReplacement(request.sourceFilePath) && ownsSourcePath(request.sourceFilePath, bundle)) {
|
|
216
|
-
throw new Error(`Package "${bundle.name}" does not expose "${request.sourceFilePath}" for cross-package substitution`);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return undefined;
|
|
220
|
-
}
|
|
221
|
-
function findReplacement(request, bundleDependencies, bundlePeerDependencies) {
|
|
222
|
-
const dependencyReplacement = findReplacementInBundles(request, bundleDependencies, function (bundle, replacementRequest) {
|
|
223
|
-
return getPublicModuleSpecifierForSourcePath(bundle, replacementRequest.sourceFilePath);
|
|
224
|
-
});
|
|
225
|
-
if (dependencyReplacement !== undefined) {
|
|
226
|
-
return dependencyReplacement;
|
|
227
|
-
}
|
|
228
|
-
return findReplacementInBundles(request, bundlePeerDependencies, getExistingPublicModuleSpecifierForSourcePath);
|
|
229
|
-
}
|
|
230
|
-
function withSubstitutedSourcePath(substitutedSourceFilePathsByPackageName, packageName, file) {
|
|
231
|
-
const existing = substitutedSourceFilePathsByPackageName.get(packageName) ?? [];
|
|
232
|
-
const updated = new Map(substitutedSourceFilePathsByPackageName);
|
|
233
|
-
updated.set(packageName, new Set([...existing, file]));
|
|
234
|
-
return updated;
|
|
235
|
-
}
|
|
236
|
-
function contentWithSourceFilePath(bundle, sourceFilePath) {
|
|
237
|
-
return bundle.contents.find(function (content) {
|
|
238
|
-
return content.fileDescription.sourceFilePath === sourceFilePath;
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
function runtimeSourceFilePathForDeclaration(bundle, declarationContent) {
|
|
242
|
-
const runtimeContent = bundle.contents.find(function (content) {
|
|
243
|
-
return declarationCompanionCandidates(content.fileDescription.targetFilePath)
|
|
244
|
-
.includes(declarationContent.fileDescription.targetFilePath);
|
|
245
|
-
});
|
|
246
|
-
return runtimeContent?.fileDescription.sourceFilePath;
|
|
247
|
-
}
|
|
248
|
-
function substitutedSourceFilePathsFor(bundle, file) {
|
|
249
|
-
const content = contentWithSourceFilePath(bundle, file);
|
|
250
|
-
if (content === undefined || !isDeclarationCompanionFilePath(content.fileDescription.targetFilePath)) {
|
|
251
|
-
return declarationCompanionCandidates(file).length === 0
|
|
252
|
-
? []
|
|
253
|
-
: [
|
|
254
|
-
file
|
|
255
|
-
];
|
|
256
|
-
}
|
|
257
|
-
const runtimeSourceFilePath = runtimeSourceFilePathForDeclaration(bundle, content);
|
|
258
|
-
if (runtimeSourceFilePath === undefined) {
|
|
259
|
-
return [
|
|
260
|
-
file
|
|
261
|
-
];
|
|
262
|
-
}
|
|
263
|
-
return [
|
|
264
|
-
runtimeSourceFilePath,
|
|
265
|
-
file
|
|
266
|
-
];
|
|
267
|
-
}
|
|
268
|
-
function withSubstitutedSourcePaths(substitutedSourceFilePathsByPackageName, match, request) {
|
|
269
|
-
let updated = substitutedSourceFilePathsByPackageName;
|
|
270
|
-
for (const sourceFilePath of substitutedSourceFilePathsFor(match.bundle, request.sourceFilePath)) {
|
|
271
|
-
updated = withSubstitutedSourcePath(updated, match.replacement.packageName, sourceFilePath);
|
|
272
|
-
}
|
|
273
|
-
return updated;
|
|
274
|
-
}
|
|
275
|
-
export function findAllPathReplacements(requests, bundleDependencies, bundlePeerDependencies) {
|
|
276
|
-
const importPathReplacements = new Map();
|
|
277
|
-
const matchedBundleDependencies = [];
|
|
278
|
-
let substitutedSourceFilePathsByPackageName = new Map();
|
|
279
|
-
function recordReplacement(match, request) {
|
|
280
|
-
importPathReplacements.set(request.sourceFilePath, match.replacement);
|
|
281
|
-
matchedBundleDependencies.push(match.replacement.packageName);
|
|
282
|
-
substitutedSourceFilePathsByPackageName = withSubstitutedSourcePaths(substitutedSourceFilePathsByPackageName, match, request);
|
|
283
|
-
}
|
|
284
|
-
for (const request of requests) {
|
|
285
|
-
const replacement = findReplacement(request, bundleDependencies, bundlePeerDependencies);
|
|
286
|
-
if (replacement !== undefined) {
|
|
287
|
-
recordReplacement(replacement, request);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
return {
|
|
291
|
-
importPathReplacements,
|
|
292
|
-
bundleDependencies: matchedBundleDependencies,
|
|
293
|
-
substitutedSourceFilePathsByPackageName
|
|
294
|
-
};
|
|
295
|
-
}
|
|
1
|
+
import 'node:path';
|
|
2
|
+
import 'ts-morph';
|
|
3
|
+
import "../common/declaration-companion-paths.js";
|
|
4
|
+
import "../dead-code-eliminator/reachability/bfs-closure.js";
|
|
5
|
+
import "../package-surface/package-surface-index.js";
|
|
6
|
+
import "../package-surface/public-specifiers.js";
|
|
7
|
+
import "../package-surface/root-registry.js";
|
|
8
|
+
import "../package-surface/specifier-syntax.js";
|
|
296
9
|
//# sourceMappingURL=replacement-lookup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replacement-lookup.js","sourceRoot":"","sources":["../../../../source/linker/replacement-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,EAAE,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EACH,8BAA8B,EAC9B,8BAA8B,EACjC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,UAAU,EAA+B,MAAM,qDAAqD,CAAC;AAE9G,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAyB5E,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,MAAgC;IACzE,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,OAAO;QACzC,OAAO,OAAO,CAAC,eAAe,CAAC,cAAc,KAAK,IAAI,CAAC;IAC3D,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,sBAAsB,CAAC,IAAY;IACxC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC;AAOD,SAAS,SAAS,CAAI,KAAoB;IACtC,OAAO,KAAK,KAAK,SAAS,CAAC;AAC/B,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAgC;IACzD,MAAM,mBAAmB,GAAG,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;IACL,CAAC;IAED,OAAO;QACH,sBAAsB;QACtB,kBAAkB,EAAE,yBAAyB;QAC7C,uCAAuC;KAC1C,CAAC;AACN,CAAC"}
|
|
1
|
+
{"version":3,"file":"replacement-lookup.js","sourceRoot":"","sources":["../../../../source/linker/replacement-lookup.ts"],"names":[],"mappings":"AAAA,OAAiB,WAAW,CAAC;AAC7B,OAAiC,UAAU,CAAC;AAC5C,OAGO,0CAA0C,CAAC;AAClD,OAAwD,qDAAqD,CAAC;AAE9G,OAAoC,6CAA6C,CAAC;AAClF,OAAsD,yCAAyC,CAAC;AAChG,OAAwB,qCAAqC,CAAC;AAC9D,OAAmC,wCAAwC,CAAC"}
|
package/linker/resource-graph.js
CHANGED
|
@@ -1,45 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
function collectResourceSpecificExternalDependencies(resource, externalDependencies) {
|
|
4
|
-
return pipe(Array.from(externalDependencies.values()), filter(function (dependency) {
|
|
5
|
-
return dependency.referencedFrom.includes(resource.fileDescription.sourceFilePath);
|
|
6
|
-
}), flatMap(function (dependency) {
|
|
7
|
-
const references = dependency.references?.filter(function (reference) {
|
|
8
|
-
return reference.sourceFilePath === resource.fileDescription.sourceFilePath;
|
|
9
|
-
});
|
|
10
|
-
if (references === undefined || references.length === 0) {
|
|
11
|
-
return [{
|
|
12
|
-
name: dependency.name,
|
|
13
|
-
sourceSpecifier: dependency.name,
|
|
14
|
-
emittedSpecifier: dependency.name
|
|
15
|
-
}];
|
|
16
|
-
}
|
|
17
|
-
return references.map(function (reference) {
|
|
18
|
-
return {
|
|
19
|
-
name: dependency.name,
|
|
20
|
-
sourceSpecifier: reference.sourceSpecifier,
|
|
21
|
-
emittedSpecifier: reference.emittedSpecifier
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
export function createGraphFromResolvedBundle(bundle) {
|
|
27
|
-
const graph = createDirectedGraph();
|
|
28
|
-
for (const resource of bundle.contents) {
|
|
29
|
-
const externalDependencies = collectResourceSpecificExternalDependencies(resource, bundle.externalDependencies);
|
|
30
|
-
graph.addNode(resource.fileDescription.sourceFilePath, {
|
|
31
|
-
fileDescription: resource.fileDescription,
|
|
32
|
-
externalDependencies,
|
|
33
|
-
project: resource.project,
|
|
34
|
-
isExplicitlyIncluded: resource.isExplicitlyIncluded,
|
|
35
|
-
...resource.isGeneratedManifest ? { isGeneratedManifest: true } : {}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
for (const resource of bundle.contents) {
|
|
39
|
-
for (const directDependency of resource.directDependencies) {
|
|
40
|
-
graph.connect({ from: resource.fileDescription.sourceFilePath, to: directDependency });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return graph;
|
|
44
|
-
}
|
|
1
|
+
import 'remeda';
|
|
2
|
+
import "../directed-graph/graph.js";
|
|
45
3
|
//# sourceMappingURL=resource-graph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-graph.js","sourceRoot":"","sources":["../../../../source/linker/resource-graph.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"resource-graph.js","sourceRoot":"","sources":["../../../../source/linker/resource-graph.ts"],"names":[],"mappings":"AACA,OAAsC,QAAQ,CAAC;AAK/C,OAAwD,4BAA4B,CAAC"}
|
|
@@ -1,77 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
function collectImportPathEdits(sourceFile, replacements) {
|
|
5
|
-
const edits = [];
|
|
6
|
-
const literals = getModuleReferenceLiterals(sourceFile);
|
|
7
|
-
for (const literal of literals) {
|
|
8
|
-
const resolvedSourceFile = resolveSourceFileForLiteral(literal, sourceFile);
|
|
9
|
-
if (resolvedSourceFile !== undefined) {
|
|
10
|
-
const replacement = replacements.get(getSourcePathFromSourceFile(resolvedSourceFile));
|
|
11
|
-
if (replacement !== undefined) {
|
|
12
|
-
edits.push({
|
|
13
|
-
start: literal.getStart() + 1,
|
|
14
|
-
end: literal.getEnd() - 1,
|
|
15
|
-
reference: {
|
|
16
|
-
name: replacement.packageName,
|
|
17
|
-
sourceSpecifier: literal.getLiteralValue(),
|
|
18
|
-
emittedSpecifier: replacement.emittedSpecifier
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return edits.toSorted(function (left, right) {
|
|
25
|
-
return left.start - right.start;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function applyEdits(sourceContent, edits) {
|
|
29
|
-
let content = '';
|
|
30
|
-
let originalOffset = 0;
|
|
31
|
-
const atoms = [];
|
|
32
|
-
function appendEdit(edit) {
|
|
33
|
-
const newStart = content.length;
|
|
34
|
-
content += sourceContent.slice(originalOffset, edit.start) + edit.reference.emittedSpecifier;
|
|
35
|
-
atoms.push({ originalStart: originalOffset, originalEnd: edit.start, newStart });
|
|
36
|
-
originalOffset = edit.end;
|
|
37
|
-
}
|
|
38
|
-
function appendTail() {
|
|
39
|
-
const tailStart = content.length;
|
|
40
|
-
content += sourceContent.slice(originalOffset);
|
|
41
|
-
atoms.push({
|
|
42
|
-
originalStart: originalOffset,
|
|
43
|
-
originalEnd: sourceContent.length,
|
|
44
|
-
newStart: tailStart
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
for (const edit of edits) {
|
|
48
|
-
appendEdit(edit);
|
|
49
|
-
}
|
|
50
|
-
appendTail();
|
|
51
|
-
return {
|
|
52
|
-
content,
|
|
53
|
-
dependencyReferences: edits.map(function (edit) {
|
|
54
|
-
return edit.reference;
|
|
55
|
-
}),
|
|
56
|
-
sourceMapTransform: {
|
|
57
|
-
originalLineIndex: buildLineIndex(sourceContent),
|
|
58
|
-
transformedLineIndex: buildLineIndex(content),
|
|
59
|
-
atoms
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export function replaceImportPathsWithTransform(project, sourceFilePath, sourceContent, replacements) {
|
|
64
|
-
if (project === undefined) {
|
|
65
|
-
return { content: sourceContent, dependencyReferences: [], sourceMapTransform: undefined };
|
|
66
|
-
}
|
|
67
|
-
const sourceFile = project.getSourceFile(sourceFilePath);
|
|
68
|
-
if (sourceFile === undefined) {
|
|
69
|
-
return { content: sourceContent, dependencyReferences: [], sourceMapTransform: undefined };
|
|
70
|
-
}
|
|
71
|
-
const edits = collectImportPathEdits(sourceFile, replacements);
|
|
72
|
-
if (edits.length === 0) {
|
|
73
|
-
return { content: sourceContent, dependencyReferences: [], sourceMapTransform: undefined };
|
|
74
|
-
}
|
|
75
|
-
return applyEdits(sourceContent, edits);
|
|
76
|
-
}
|
|
1
|
+
import "../../dead-code-eliminator/transform/line-index.js";
|
|
2
|
+
import "../../dependency-scanner/source-file-references.js";
|
|
3
|
+
import "../../dependency-scanner/typescript-project-analyzer.js";
|
|
77
4
|
//# sourceMappingURL=import-paths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-paths.js","sourceRoot":"","sources":["../../../../../source/linker/source-modifier/import-paths.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"import-paths.js","sourceRoot":"","sources":["../../../../../source/linker/source-modifier/import-paths.ts"],"names":[],"mappings":"AACA,OAA+B,oDAAoD,CAAC;AAEpF,OAGO,oDAAoD,CAAC;AAC5D,OAA4C,yDAAyD,CAAC"}
|
|
@@ -1,141 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
function isSubstitutionSourcePath(sourceFilePath, substitutionSources) {
|
|
5
|
-
return substitutionSources.some(function (bundle) {
|
|
6
|
-
return ownsSourcePath(sourceFilePath, bundle);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
function recordUnreplacedConnections(outstandingConnections, fromNodeId, directDependencies, replacedPaths) {
|
|
10
|
-
for (const file of directDependencies) {
|
|
11
|
-
if (!replacedPaths.has(file)) {
|
|
12
|
-
outstandingConnections.push({ from: fromNodeId, to: file });
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function createReplacementRequest(sourceFilePath) {
|
|
17
|
-
return {
|
|
18
|
-
sourceFilePath,
|
|
19
|
-
requiredExportNames: new Set(),
|
|
20
|
-
requiresNamespaceExport: false
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function replacementRequestForSourceFilePath(requestsBySourceFilePath, sourceFilePath) {
|
|
24
|
-
return requestsBySourceFilePath.get(sourceFilePath) ?? createReplacementRequest(sourceFilePath);
|
|
25
|
-
}
|
|
26
|
-
function addRequiredExportName(requestsBySourceFilePath, sourceFilePath, requiredExportName) {
|
|
27
|
-
const request = replacementRequestForSourceFilePath(requestsBySourceFilePath, sourceFilePath);
|
|
28
|
-
requestsBySourceFilePath.set(sourceFilePath, {
|
|
29
|
-
...request,
|
|
30
|
-
requiredExportNames: new Set([...request.requiredExportNames, requiredExportName])
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function requireNamespaceExport(requestsBySourceFilePath, sourceFilePath) {
|
|
34
|
-
const request = replacementRequestForSourceFilePath(requestsBySourceFilePath, sourceFilePath);
|
|
35
|
-
requestsBySourceFilePath.set(sourceFilePath, { ...request, requiresNamespaceExport: true });
|
|
36
|
-
}
|
|
37
|
-
function recordImportRequirements(requestsBySourceFilePath, declaration) {
|
|
38
|
-
const importedSourceFile = declaration.getModuleSpecifierSourceFile();
|
|
39
|
-
if (importedSourceFile === undefined) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const sourceFilePath = importedSourceFile.getFilePath();
|
|
43
|
-
if (declaration.getDefaultImport() !== undefined) {
|
|
44
|
-
addRequiredExportName(requestsBySourceFilePath, sourceFilePath, 'default');
|
|
45
|
-
}
|
|
46
|
-
if (declaration.getNamespaceImport() !== undefined) {
|
|
47
|
-
requireNamespaceExport(requestsBySourceFilePath, sourceFilePath);
|
|
48
|
-
}
|
|
49
|
-
for (const namedImport of declaration.getNamedImports()) {
|
|
50
|
-
addRequiredExportName(requestsBySourceFilePath, sourceFilePath, namedImport.getName());
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function recordExportRequirements(requestsBySourceFilePath, declaration) {
|
|
54
|
-
const exportedSourceFile = declaration.getModuleSpecifierSourceFile();
|
|
55
|
-
if (exportedSourceFile === undefined) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const sourceFilePath = exportedSourceFile.getFilePath();
|
|
59
|
-
if (declaration.isNamespaceExport()) {
|
|
60
|
-
requireNamespaceExport(requestsBySourceFilePath, sourceFilePath);
|
|
61
|
-
}
|
|
62
|
-
for (const namedExport of declaration.getNamedExports()) {
|
|
63
|
-
addRequiredExportName(requestsBySourceFilePath, sourceFilePath, namedExport.getName());
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function recordStaticRequirements(requestsBySourceFilePath, sourceFile) {
|
|
67
|
-
for (const declaration of sourceFile.getImportDeclarations()) {
|
|
68
|
-
recordImportRequirements(requestsBySourceFilePath, declaration);
|
|
69
|
-
}
|
|
70
|
-
for (const declaration of sourceFile.getExportDeclarations()) {
|
|
71
|
-
recordExportRequirements(requestsBySourceFilePath, declaration);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function collectImportRequirements(node) {
|
|
75
|
-
const requestsBySourceFilePath = new Map();
|
|
76
|
-
for (const sourceFilePath of node.adjacentNodeIds) {
|
|
77
|
-
requestsBySourceFilePath.set(sourceFilePath, createReplacementRequest(sourceFilePath));
|
|
78
|
-
}
|
|
79
|
-
const sourceFile = node.data.project?.getSourceFile(node.data.fileDescription.sourceFilePath);
|
|
80
|
-
if (sourceFile !== undefined) {
|
|
81
|
-
recordStaticRequirements(requestsBySourceFilePath, sourceFile);
|
|
82
|
-
}
|
|
83
|
-
return Array.from(requestsBySourceFilePath.values());
|
|
84
|
-
}
|
|
85
|
-
function contentWithReplacements(node, replacements) {
|
|
86
|
-
return replaceImportPathsWithTransform(node.data.project, node.data.fileDescription.sourceFilePath, node.data.fileDescription.content, replacements.importPathReplacements);
|
|
87
|
-
}
|
|
88
|
-
function fallbackDependencyReferences(replacements) {
|
|
89
|
-
return Array.from(replacements.importPathReplacements.values(), function (replacement) {
|
|
90
|
-
return {
|
|
91
|
-
name: replacement.packageName,
|
|
92
|
-
sourceSpecifier: replacement.emittedSpecifier,
|
|
93
|
-
emittedSpecifier: replacement.emittedSpecifier
|
|
94
|
-
};
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
function addNodeWithReplacements(substitutedGraph, node, replacements) {
|
|
98
|
-
const isSubstituted = replacements.importPathReplacements.size > 0;
|
|
99
|
-
const replacementResult = contentWithReplacements(node, replacements);
|
|
100
|
-
const dependencyReferences = replacementResult.dependencyReferences.length === 0
|
|
101
|
-
? fallbackDependencyReferences(replacements)
|
|
102
|
-
: replacementResult.dependencyReferences;
|
|
103
|
-
const sourceMapTransformsByTargetPath = replacementResult.sourceMapTransform === undefined
|
|
104
|
-
? new Map()
|
|
105
|
-
: new Map([[node.data.fileDescription.targetFilePath, [replacementResult.sourceMapTransform]]]);
|
|
106
|
-
substitutedGraph.add(node.id, {
|
|
107
|
-
fileDescription: { ...node.data.fileDescription, content: replacementResult.content },
|
|
108
|
-
externalDependencies: node.data.externalDependencies,
|
|
109
|
-
bundleDependencies: isSubstituted ? dependencyReferences : [],
|
|
110
|
-
substitutedSourceFilePathsByPackageName: replacements.substitutedSourceFilePathsByPackageName,
|
|
111
|
-
sourceMapTransformsByTargetPath,
|
|
112
|
-
isSubstituted,
|
|
113
|
-
isExplicitlyIncluded: node.data.isExplicitlyIncluded,
|
|
114
|
-
...node.data.isGeneratedManifest ? { isGeneratedManifest: true } : {}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
export function substituteDependencies(resourceGraph, bundleDependencies, bundlePeerDependencies) {
|
|
118
|
-
const substitutedGraph = createSubstitutedResourceGraph();
|
|
119
|
-
const outstandingConnections = [];
|
|
120
|
-
const visited = new Set();
|
|
121
|
-
const substitutionSources = [...bundleDependencies, ...bundlePeerDependencies];
|
|
122
|
-
function substituteNode(node) {
|
|
123
|
-
if (visited.has(node.id)) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
visited.add(node.id);
|
|
127
|
-
if (!node.data.isExplicitlyIncluded && isSubstitutionSourcePath(node.id, substitutionSources)) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
const directDependencies = Array.from(node.adjacentNodeIds);
|
|
131
|
-
const replacements = findAllPathReplacements(collectImportRequirements(node), bundleDependencies, bundlePeerDependencies);
|
|
132
|
-
recordUnreplacedConnections(outstandingConnections, node.id, directDependencies, replacements.importPathReplacements);
|
|
133
|
-
addNodeWithReplacements(substitutedGraph, node, replacements);
|
|
134
|
-
}
|
|
135
|
-
resourceGraph.traverse(substituteNode);
|
|
136
|
-
for (const connection of outstandingConnections) {
|
|
137
|
-
substitutedGraph.connect(connection.from, connection.to);
|
|
138
|
-
}
|
|
139
|
-
return substitutedGraph;
|
|
140
|
-
}
|
|
1
|
+
import "./replacement-lookup.js";
|
|
2
|
+
import "./source-modifier/import-paths.js";
|
|
3
|
+
import "./substituted-resource-graph.js";
|
|
141
4
|
//# sourceMappingURL=substitute-bundles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"substitute-bundles.js","sourceRoot":"","sources":["../../../../source/linker/substitute-bundles.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"substitute-bundles.js","sourceRoot":"","sources":["../../../../source/linker/substitute-bundles.ts"],"names":[],"mappings":"AAEA,OAKO,yBAAyB,CAAC;AAEjC,OAIO,mCAAmC,CAAC;AAC3C,OAA8E,iCAAiC,CAAC"}
|