packtory 0.0.95 → 0.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/artifacts-builder.d.ts +28 -0
- package/artifacts/artifacts-builder.d.ts.map +1 -0
- 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.d.ts +8 -0
- package/bundle-emitter/emitter.d.ts.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.d.ts +2 -0
- package/bundle-emitter/fetch-published-artifacts.d.ts.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.d.ts +3 -0
- package/bundle-emitter/publication-outcome.d.ts.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.d.ts +14 -0
- package/bundle-emitter/registry/package-metadata-fetcher.d.ts.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.d.ts +17 -0
- package/bundle-emitter/registry/registry-auth-config.d.ts.map +1 -0
- 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.d.ts +13 -1
- package/bundle-emitter/registry/registry-client.d.ts.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.d.ts +1 -0
- package/bundle-emitter/registry/tarball-integrity.d.ts.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.d.ts +18 -0
- package/checks/check-runner.d.ts.map +1 -0
- package/checks/check-runner.js +8 -0
- package/checks/check-runner.js.map +1 -1
- package/checks/rule.d.ts +42 -0
- package/checks/rule.d.ts.map +1 -0
- 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.d.ts +13 -0
- package/checks/rules/max-bundle-size.d.ts.map +1 -0
- 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.d.ts +11 -0
- package/checks/rules/no-dev-dependency-imports.d.ts.map +1 -0
- 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.d.ts +11 -0
- package/checks/rules/no-duplicated-files.d.ts.map +1 -0
- 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.d.ts +15 -0
- package/checks/rules/no-side-effects.d.ts.map +1 -0
- 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.d.ts +8 -0
- package/checks/rules/no-unexposed-executables.d.ts.map +1 -0
- 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.d.ts +8 -0
- package/checks/rules/no-unused-bundle-dependencies.d.ts.map +1 -0
- 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.d.ts +23 -0
- package/checks/rules/registry.d.ts.map +1 -0
- package/checks/rules/registry.js +22 -9
- package/checks/rules/registry.js.map +1 -1
- package/checks/rules/required-files.d.ts +15 -0
- package/checks/rules/required-files.d.ts.map +1 -0
- package/checks/rules/required-files.js +41 -3
- package/checks/rules/required-files.js.map +1 -1
- package/checks/rules/type-script-declaration-integrity.d.ts +9 -0
- package/checks/rules/type-script-declaration-integrity.d.ts.map +1 -0
- 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.d.ts +29 -0
- package/checks/rules/type-script-declaration-project.d.ts.map +1 -0
- 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.d.ts +24 -0
- package/checks/rules/type-script-integrity.d.ts.map +1 -0
- 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.d.ts +29 -0
- package/checks/rules/type-script-package-resolution.d.ts.map +1 -0
- 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.d.ts +8 -0
- package/checks/rules/unique-target-paths.d.ts.map +1 -0
- 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.d.ts +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.d.ts +44 -0
- package/config/changelog-settings.d.ts.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.d.ts +6 -1
- package/config/config.d.ts.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.d.ts +1 -0
- package/config/dead-code-elimination-settings.d.ts.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 +13 -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.d.ts +4 -0
- package/config/package-config.d.ts.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 +2 -0
- 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-schema.d.ts +12 -12
- 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.d.ts +3 -0
- package/config/publish-settings.d.ts.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.d.ts +41 -0
- package/config/registry-settings.d.ts.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/validation.d.ts.map +1 -1
- package/config/validation.js +35 -1
- package/config/validation.js.map +1 -1
- package/config/versioning-settings.d.ts +18 -1
- package/config/versioning-settings.d.ts.map +1 -1
- package/config/versioning-settings.js +10 -3
- package/config/versioning-settings.js.map +1 -1
- package/dead-code-eliminator/analyzed-bundle.d.ts +11 -0
- package/dead-code-eliminator/analyzed-bundle.d.ts.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/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 -1
- 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 -4
- 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 -3
- 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-module-resolution.js +172 -2
- package/dead-code-eliminator/liveness/external-module-resolution.js.map +1 -1
- package/dead-code-eliminator/liveness/external-purity-summary.js +294 -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 -2
- 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 +65 -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.d.ts +8 -0
- package/dead-code-eliminator/transform/atom-translator.d.ts.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.d.ts +7 -0
- package/dead-code-eliminator/transform/line-index.d.ts.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.d.ts +41 -0
- package/dependency-scanner/dependency-graph.d.ts.map +1 -0
- package/dependency-scanner/dependency-graph.js +77 -3
- package/dependency-scanner/dependency-graph.js.map +1 -1
- package/dependency-scanner/external-dependencies.d.ts +10 -1
- package/dependency-scanner/external-dependencies.d.ts.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.d.ts +20 -0
- package/dependency-scanner/scanner.d.ts.map +1 -0
- package/dependency-scanner/scanner.js +109 -4
- package/dependency-scanner/scanner.js.map +1 -1
- package/dependency-scanner/source-file-references.d.ts +37 -0
- package/dependency-scanner/source-file-references.d.ts.map +1 -0
- package/dependency-scanner/source-file-references.js +181 -6
- package/dependency-scanner/source-file-references.js.map +1 -1
- package/dependency-scanner/source-map-file-locator.d.ts +10 -0
- package/dependency-scanner/source-map-file-locator.d.ts.map +1 -0
- 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.d.ts +8 -0
- package/dependency-scanner/typescript-compiler-options.d.ts.map +1 -0
- 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.d.ts +12 -0
- package/dependency-scanner/typescript-file-host.d.ts.map +1 -0
- package/dependency-scanner/typescript-file-host.js +49 -5
- package/dependency-scanner/typescript-file-host.js.map +1 -1
- package/dependency-scanner/typescript-project-analyzer.d.ts +19 -0
- package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -0
- package/dependency-scanner/typescript-project-analyzer.js +35 -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.d.ts +1 -0
- package/directed-graph/graph.d.ts.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.d.ts +2 -1
- package/file-manager/file-description.d.ts.map +1 -1
- package/file-manager/file-description.js +3 -0
- package/file-manager/file-description.js.map +1 -1
- package/file-manager/file-manager.d.ts +1 -1
- package/file-manager/file-manager.d.ts.map +1 -1
- package/file-manager/file-manager.js +4 -4
- package/file-manager/file-manager.js.map +1 -1
- package/file-manager/permissions.js +28 -1
- package/file-manager/permissions.js.map +1 -1
- package/git/current-git-head.d.ts +12 -0
- package/git/current-git-head.d.ts.map +1 -0
- 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.d.ts +19 -2
- package/linker/linked-bundle.d.ts.map +1 -1
- package/linker/linked-bundle.js +5 -0
- package/linker/linked-bundle.js.map +1 -1
- package/linker/linker.d.ts +13 -0
- package/linker/linker.d.ts.map +1 -0
- 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 +76 -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.d.ts +20 -0
- package/pack-emitter/pack-emitter.d.ts.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.d.ts +2 -0
- package/package-surface/surface.d.ts.map +1 -1
- package/package-surface/surface.js +12 -0
- package/package-surface/surface.js.map +1 -1
- package/package.json +1 -1
- package/packages/package-processor.composition.d.ts +22 -0
- package/packages/package-processor.composition.d.ts.map +1 -1
- package/packages/package-processor.composition.js +161 -34
- package/packages/package-processor.composition.js.map +1 -1
- package/packtory/changelog-source-attribution.js +16 -16
- package/packtory/changelog-source-attribution.js.map +1 -1
- package/packtory/map-config.d.ts +11 -1
- package/packtory/map-config.d.ts.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.d.ts +13 -1
- package/packtory/options/prepare-package-options.d.ts.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.d.ts +17 -1
- package/packtory/options/setting-resolvers.d.ts.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-result.d.ts +3 -0
- package/packtory/package-processor-publish-result.d.ts.map +1 -1
- package/packtory/package-processor-publish.d.ts +2 -0
- package/packtory/package-processor-publish.d.ts.map +1 -1
- package/packtory/package-processor-publish.js +297 -6
- package/packtory/package-processor-publish.js.map +1 -1
- package/packtory/package-processor.d.ts +34 -0
- package/packtory/package-processor.d.ts.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 -3
- 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.d.ts +28 -1
- package/packtory/packtory.d.ts.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.d.ts +19 -0
- package/packtory/published-release-state.d.ts.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.d.ts +11 -0
- package/packtory/resolved-package.d.ts.map +1 -1
- package/packtory/resolved-package.js +97 -3
- package/packtory/resolved-package.js.map +1 -1
- package/packtory/scheduler.d.ts +47 -0
- package/packtory/scheduler.d.ts.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.d.ts +1 -0
- package/progress/progress-broadcaster.d.ts.map +1 -1
- package/progress/progress-broadcaster.js +45 -0
- package/progress/progress-broadcaster.js.map +1 -1
- package/published-package/published-package.d.ts +2 -0
- package/published-package/published-package.d.ts.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.d.ts +21 -0
- package/report/aggregator/report-types.d.ts.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 -3
- 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.d.ts +54 -0
- package/resource-resolver/resolved-bundle.d.ts.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.d.ts +5 -0
- package/resource-resolver/resource-resolve-options.d.ts.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.d.ts +15 -0
- package/resource-resolver/resource-resolver.d.ts.map +1 -0
- package/resource-resolver/resource-resolver.js +128 -5
- 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.d.ts +14 -0
- package/sbom/license-resolver.d.ts.map +1 -0
- 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.d.ts +10 -0
- package/sbom/sbom-file.d.ts.map +1 -1
- package/sbom/sbom-file.js +54 -5
- package/sbom/sbom-file.js.map +1 -1
- package/sbom/sbom-serializer.d.ts +8 -0
- package/sbom/sbom-serializer.d.ts.map +1 -0
- 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 +5 -5
- 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.d.ts +14 -0
- package/tar/tarball-builder.d.ts.map +1 -0
- package/tar/tarball-builder.js +44 -4
- package/tar/tarball-builder.js.map +1 -1
- package/vendor-materializer/vendor-entry.d.ts +12 -0
- package/vendor-materializer/vendor-entry.d.ts.map +1 -0
- package/vendor-materializer/vendor-entry.js +20 -1
- package/vendor-materializer/vendor-entry.js.map +1 -1
- package/vendor-materializer/vendor-materializer.d.ts +55 -0
- package/vendor-materializer/vendor-materializer.d.ts.map +1 -0
- 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.d.ts +5 -0
- package/version-manager/manager.d.ts.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.d.ts +3 -1
- package/version-manager/versioned-bundle.d.ts.map +1 -1
- package/version-manager/versioned-bundle.js +31 -6
- package/version-manager/versioned-bundle.js.map +1 -1
- package/zip/zip-builder.d.ts +22 -0
- package/zip/zip-builder.d.ts.map +1 -0
- package/zip/zip-builder.js +81 -2
- package/zip/zip-builder.js.map +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type _npmFetch from 'npm-registry-fetch';
|
|
1
2
|
import type { Maybe } from 'true-myth';
|
|
3
|
+
import type { Clock } from '../../common/clock.ts';
|
|
2
4
|
import type { PublishSettings } from '../../config/publish-settings.ts';
|
|
3
|
-
import type { RegistrySettings } from '../../config/registry-settings.ts';
|
|
5
|
+
import type { NpmOidcPublishAuth, RegistrySettings } from '../../config/registry-settings.ts';
|
|
4
6
|
import { type PublicationOutcome } from '../publication-outcome.ts';
|
|
5
7
|
import { type PackageReleaseMetadata, type PackageVersionDetails, type PackageVersionReleaseMetadata } from './package-metadata-fetcher.ts';
|
|
6
8
|
import type { TarballIntegrity } from './tarball-integrity.ts';
|
|
@@ -8,6 +10,7 @@ type PublishManifest = Readonly<Record<string, unknown>> & {
|
|
|
8
10
|
readonly name: string;
|
|
9
11
|
readonly version: string;
|
|
10
12
|
};
|
|
13
|
+
type PublishLibraryOptions = Readonly<Record<string, unknown>>;
|
|
11
14
|
type PublishPackageArguments = readonly [
|
|
12
15
|
manifest: PublishManifest,
|
|
13
16
|
tarData: Buffer,
|
|
@@ -15,6 +18,14 @@ type PublishPackageArguments = readonly [
|
|
|
15
18
|
publishSettings: PublishSettings,
|
|
16
19
|
stage: boolean
|
|
17
20
|
];
|
|
21
|
+
export type RegistryClientDependencies = {
|
|
22
|
+
readonly npmFetch: typeof _npmFetch;
|
|
23
|
+
readonly publish: (manifest: PublishManifest, tarData: Buffer, options?: PublishLibraryOptions) => Promise<unknown>;
|
|
24
|
+
readonly fetch: typeof globalThis.fetch;
|
|
25
|
+
readonly clock: Clock;
|
|
26
|
+
readonly resolveIdToken: (auth: NpmOidcPublishAuth) => Promise<string>;
|
|
27
|
+
readonly promptForOneTimePassword?: (() => Promise<string | undefined>) | undefined;
|
|
28
|
+
};
|
|
18
29
|
export type RegistryClient = {
|
|
19
30
|
fetchLatestReleaseMetadata: (packageName: string, config: RegistrySettings) => Promise<Maybe<PackageReleaseMetadata>>;
|
|
20
31
|
fetchVersionReleaseMetadata: (packageName: string, version: string, config: RegistrySettings) => Promise<Maybe<PackageVersionReleaseMetadata>>;
|
|
@@ -23,5 +34,6 @@ export type RegistryClient = {
|
|
|
23
34
|
publishPackage: (...publishArguments: PublishPackageArguments) => Promise<PublicationOutcome>;
|
|
24
35
|
fetchTarball: (tarballUrl: string, tarballIntegrity: TarballIntegrity, config: RegistrySettings) => Promise<Buffer>;
|
|
25
36
|
};
|
|
37
|
+
export declare function createRegistryClient(dependencies: Readonly<RegistryClientDependencies>): RegistryClient;
|
|
26
38
|
export {};
|
|
27
39
|
//# sourceMappingURL=registry-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-client.d.ts","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/registry-client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"registry-client.d.ts","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/registry-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC9F,OAAO,EAA0C,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE5G,OAAO,EAMH,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EACrC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,KAAK,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC5B,CAAC;AACF,KAAK,qBAAqB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAQ/D,KAAK,uBAAuB,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S,MAAM,EAAE,CAAC,CAAC;IACnG,cAAc,EAAE,CAAC,GAAG,gBAAgB,EAAE,uBAAuB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9F,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACvH,CAAC;AA2CF,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,QAAQ,CAAC,0BAA0B,CAAC,GAAG,cAAc,CAsDvG"}
|
|
@@ -1,5 +1,75 @@
|
|
|
1
|
-
import "../publication-outcome.js";
|
|
2
|
-
import "./oidc-token-exchange.js";
|
|
3
|
-
import "./package-metadata-fetcher.js";
|
|
4
|
-
import "./publish-settings-bridge.js";
|
|
1
|
+
import { publishedToRegistry, stagedForApproval } from "../publication-outcome.js";
|
|
2
|
+
import { createOidcTokenExchanger } from "./oidc-token-exchange.js";
|
|
3
|
+
import { fetchLatestPackageReleaseMetadata, fetchPackageTarball, fetchLatestPackageVersion, fetchPackageVersionReleaseMetadata, fetchStagedPackageVersions } from "./package-metadata-fetcher.js";
|
|
4
|
+
import { buildPublishOptionsForPublishSettings, remapPublishError } from "./publish-settings-bridge.js";
|
|
5
|
+
function isStageIdRecord(response) {
|
|
6
|
+
return (typeof response === 'object' &&
|
|
7
|
+
response !== null &&
|
|
8
|
+
Object.hasOwn(response, 'stageId'));
|
|
9
|
+
}
|
|
10
|
+
function hasStageId(response) {
|
|
11
|
+
return isStageIdRecord(response) && typeof response.stageId === 'string' && response.stageId.length > 0;
|
|
12
|
+
}
|
|
13
|
+
function readStageId(response) {
|
|
14
|
+
if (!hasStageId(response)) {
|
|
15
|
+
throw new Error('npm staged publish succeeded without returning a stage ID');
|
|
16
|
+
}
|
|
17
|
+
return response.stageId;
|
|
18
|
+
}
|
|
19
|
+
async function readPublishedPublicationOutcome(publishPromise) {
|
|
20
|
+
await publishPromise;
|
|
21
|
+
return publishedToRegistry;
|
|
22
|
+
}
|
|
23
|
+
async function readStagedPublicationOutcome(publishPromise) {
|
|
24
|
+
return stagedForApproval(readStageId(await publishPromise));
|
|
25
|
+
}
|
|
26
|
+
async function readPublicationOutcome(publishPromise, readOutcome, publishSettings) {
|
|
27
|
+
try {
|
|
28
|
+
return await readOutcome(publishPromise);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
throw remapPublishError(error, publishSettings);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function createRegistryClient(dependencies) {
|
|
35
|
+
const { npmFetch, publish, fetch: fetchImplementation, clock, promptForOneTimePassword, resolveIdToken } = dependencies;
|
|
36
|
+
const oidcExchanger = createOidcTokenExchanger({ fetch: fetchImplementation, clock, resolveIdToken });
|
|
37
|
+
return {
|
|
38
|
+
async fetchTarball(tarballUrl, tarballIntegrity, registrySettings) {
|
|
39
|
+
return fetchPackageTarball(npmFetch, tarballUrl, tarballIntegrity, registrySettings);
|
|
40
|
+
},
|
|
41
|
+
async publishPackage(...[manifest, tarData, registrySettings, publishSettings, stage]) {
|
|
42
|
+
const authOptions = await oidcExchanger.resolveWriteAuthOptions(manifest.name, registrySettings);
|
|
43
|
+
const publishOptionsFromSettings = buildPublishOptionsForPublishSettings(publishSettings);
|
|
44
|
+
const publishOptions = {
|
|
45
|
+
defaultTag: 'latest',
|
|
46
|
+
...authOptions,
|
|
47
|
+
...publishOptionsFromSettings,
|
|
48
|
+
...stage ? { stage: true } : {}
|
|
49
|
+
};
|
|
50
|
+
const publishOptionsWithOneTimePassword = {
|
|
51
|
+
...publishOptions,
|
|
52
|
+
otpPrompt: promptForOneTimePassword
|
|
53
|
+
};
|
|
54
|
+
const publishOptionsForOneTimePassword = promptForOneTimePassword === undefined
|
|
55
|
+
? publishOptions
|
|
56
|
+
: publishOptionsWithOneTimePassword;
|
|
57
|
+
const publishPromise = publish(manifest, tarData, publishOptionsForOneTimePassword);
|
|
58
|
+
const readOutcome = stage ? readStagedPublicationOutcome : readPublishedPublicationOutcome;
|
|
59
|
+
return readPublicationOutcome(publishPromise, readOutcome, publishSettings);
|
|
60
|
+
},
|
|
61
|
+
async fetchLatestVersion(packageName, registrySettings) {
|
|
62
|
+
return fetchLatestPackageVersion(npmFetch, packageName, registrySettings);
|
|
63
|
+
},
|
|
64
|
+
async fetchStagedVersions(packageName, registrySettings) {
|
|
65
|
+
return fetchStagedPackageVersions(npmFetch, packageName, registrySettings);
|
|
66
|
+
},
|
|
67
|
+
async fetchLatestReleaseMetadata(packageName, registrySettings) {
|
|
68
|
+
return fetchLatestPackageReleaseMetadata(npmFetch, packageName, registrySettings);
|
|
69
|
+
},
|
|
70
|
+
async fetchVersionReleaseMetadata(packageName, version, registrySettings) {
|
|
71
|
+
return fetchPackageVersionReleaseMetadata(npmFetch, packageName, version, registrySettings);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
5
75
|
//# sourceMappingURL=registry-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-client.js","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/registry-client.ts"],"names":[],"mappings":"AAKA,
|
|
1
|
+
{"version":3,"file":"registry-client.js","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/registry-client.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAA2B,MAAM,2BAA2B,CAAC;AAC5G,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACH,iCAAiC,EACjC,mBAAmB,EACnB,yBAAyB,EACzB,kCAAkC,EAClC,0BAA0B,EAI7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,qCAAqC,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAgDxG,SAAS,eAAe,CAAC,QAAiB;IACtC,OAAO,CACH,OAAO,QAAQ,KAAK,QAAQ;QAC5B,QAAQ,KAAK,IAAI;QACj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gBAAgB;YACnD,OAAO,0BAA0B,CAAC,QAAQ,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAC;QAC/E,CAAC;QAED,KAAK,CAAC,0BAA0B,CAAC,WAAW,EAAE,gBAAgB;YAC1D,OAAO,iCAAiC,CAAC,QAAQ,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAC;QACtF,CAAC;QAED,KAAK,CAAC,2BAA2B,CAAC,WAAW,EAAE,OAAO,EAAE,gBAAgB;YACpE,OAAO,kCAAkC,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAChG,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-package-path.js","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/registry-package-path.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"registry-package-path.js","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/registry-package-path.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,qBAAqB,CAAC,WAAmB;IACrD,OAAO,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -1,3 +1,51 @@
|
|
|
1
|
-
import 'zod/mini';
|
|
2
|
-
import "../../common/schema-validation.js";
|
|
1
|
+
import { z } from 'zod/mini';
|
|
2
|
+
import { safeParse } from "../../common/schema-validation.js";
|
|
3
|
+
const packageVersionDetailsSchema = z.object({
|
|
4
|
+
dist: z.object({
|
|
5
|
+
tarball: z.string(),
|
|
6
|
+
integrity: z.optional(z.unknown()),
|
|
7
|
+
shasum: z.optional(z.unknown())
|
|
8
|
+
}),
|
|
9
|
+
gitHead: z.optional(z.string())
|
|
10
|
+
});
|
|
11
|
+
const abbreviatedPackageResponseSchema = z.object({
|
|
12
|
+
name: z.string(),
|
|
13
|
+
'dist-tags': z.object({
|
|
14
|
+
latest: z.optional(z.string())
|
|
15
|
+
}),
|
|
16
|
+
versions: z.record(z.string(), packageVersionDetailsSchema)
|
|
17
|
+
});
|
|
18
|
+
const fullPackageResponseSchema = z.object({
|
|
19
|
+
name: z.string(),
|
|
20
|
+
'dist-tags': z.object({
|
|
21
|
+
latest: z.optional(z.string())
|
|
22
|
+
}),
|
|
23
|
+
time: z.optional(z.record(z.string(), z.string())),
|
|
24
|
+
versions: z.record(z.string(), packageVersionDetailsSchema)
|
|
25
|
+
});
|
|
26
|
+
const oidcExchangeResponseSchema = z.object({
|
|
27
|
+
token: z.string(),
|
|
28
|
+
expires: z.coerce.date()
|
|
29
|
+
});
|
|
30
|
+
function isRecord(response) {
|
|
31
|
+
return typeof response === 'object' && response !== null && !Array.isArray(response);
|
|
32
|
+
}
|
|
33
|
+
export function parseAbbreviatedPackageResponse(response) {
|
|
34
|
+
const result = abbreviatedPackageResponseSchema.safeParse(response);
|
|
35
|
+
return result.success ? result.data : undefined;
|
|
36
|
+
}
|
|
37
|
+
export function parseFullPackageResponse(response) {
|
|
38
|
+
const result = fullPackageResponseSchema.safeParse(response);
|
|
39
|
+
return result.success ? result.data : undefined;
|
|
40
|
+
}
|
|
41
|
+
export function parseOidcExchangeResponse(response) {
|
|
42
|
+
if (!isRecord(response)) {
|
|
43
|
+
return { success: false, issues: ['expected object'] };
|
|
44
|
+
}
|
|
45
|
+
const result = safeParse(oidcExchangeResponseSchema, response);
|
|
46
|
+
if (result.success) {
|
|
47
|
+
return { success: true, data: result.data };
|
|
48
|
+
}
|
|
49
|
+
return { success: false, issues: result.error.issues };
|
|
50
|
+
}
|
|
3
51
|
//# sourceMappingURL=registry-response-schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-response-schemas.js","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/registry-response-schemas.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"registry-response-schemas.js","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/registry-response-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ACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -2,4 +2,5 @@ export type TarballIntegrity = {
|
|
|
2
2
|
readonly integrity: string | undefined;
|
|
3
3
|
readonly shasum: string | undefined;
|
|
4
4
|
};
|
|
5
|
+
export declare function assertTarballIntegrity(tarball: Buffer, tarballIntegrity: TarballIntegrity): void;
|
|
5
6
|
//# sourceMappingURL=tarball-integrity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tarball-integrity.d.ts","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/tarball-integrity.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC,CAAC"}
|
|
1
|
+
{"version":3,"file":"tarball-integrity.d.ts","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/tarball-integrity.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC,CAAC;AA0BF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAQhG"}
|
|
@@ -1,2 +1,32 @@
|
|
|
1
|
-
import 'ssri';
|
|
1
|
+
import ssri from 'ssri';
|
|
2
|
+
const sha1HexPattern = /^[a-f0-9]{40}$/u;
|
|
3
|
+
function assertIntegrityMetadataMatches(tarball, integrity) {
|
|
4
|
+
try {
|
|
5
|
+
ssri.checkData(tarball, integrity, { strict: true, error: true });
|
|
6
|
+
}
|
|
7
|
+
catch (error) {
|
|
8
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
9
|
+
throw new Error(`Downloaded tarball failed dist.integrity verification: ${message}`, { cause: error });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function assertShasumMetadataMatches(tarball, shasum) {
|
|
13
|
+
if (!sha1HexPattern.test(shasum)) {
|
|
14
|
+
throw new Error(`Registry returned invalid dist.shasum "${shasum}"`);
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
ssri.checkData(tarball, ssri.fromHex(shasum, 'sha1'), { error: true });
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
21
|
+
throw new Error(`Downloaded tarball failed dist.shasum verification: ${message}`, { cause: error });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function assertTarballIntegrity(tarball, tarballIntegrity) {
|
|
25
|
+
if (tarballIntegrity.integrity !== undefined) {
|
|
26
|
+
assertIntegrityMetadataMatches(tarball, tarballIntegrity.integrity);
|
|
27
|
+
}
|
|
28
|
+
if (tarballIntegrity.shasum !== undefined) {
|
|
29
|
+
assertShasumMetadataMatches(tarball, tarballIntegrity.shasum);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
2
32
|
//# sourceMappingURL=tarball-integrity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tarball-integrity.js","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/tarball-integrity.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"tarball-integrity.js","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/tarball-integrity.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAOxB,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAEzC,SAAS,8BAA8B,CAAC,OAAe,EAAE,SAAiB;IACtE,IAAI,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,E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C;QACxC,2BAA2B,CAAC,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;AACL,CAAC"}
|
|
@@ -1,2 +1,27 @@
|
|
|
1
|
-
import "./registry-auth-config.js";
|
|
1
|
+
import { npmRegistryUrl } from "./registry-auth-config.js";
|
|
2
|
+
function resolveConfiguredOrigin(registrySettings) {
|
|
3
|
+
const configuredUrl = new URL(registrySettings.registryUrl ?? npmRegistryUrl);
|
|
4
|
+
return configuredUrl.origin;
|
|
5
|
+
}
|
|
6
|
+
function parseTarballOrigin(tarballUrl) {
|
|
7
|
+
try {
|
|
8
|
+
const parsedUrl = new URL(tarballUrl);
|
|
9
|
+
return parsedUrl.origin;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
throw new TypeError(`Registry returned an invalid tarball URL: "${tarballUrl}"`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function buildMismatchMessage(tarballOrigin, configuredOrigin) {
|
|
16
|
+
return (`Refusing to download tarball from "${tarballOrigin}" because it differs from the configured registry origin ` +
|
|
17
|
+
`"${configuredOrigin}". A tampered registry response could redirect the request and exfiltrate ` +
|
|
18
|
+
'publish credentials.');
|
|
19
|
+
}
|
|
20
|
+
export function assertTarballOriginMatchesRegistry(tarballUrl, registrySettings) {
|
|
21
|
+
const tarballOrigin = parseTarballOrigin(tarballUrl);
|
|
22
|
+
const configuredOrigin = resolveConfiguredOrigin(registrySettings);
|
|
23
|
+
if (tarballOrigin !== configuredOrigin) {
|
|
24
|
+
throw new Error(buildMismatchMessage(tarballOrigin, configuredOrigin));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
2
27
|
//# sourceMappingURL=validate-tarball-host.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-tarball-host.js","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/validate-tarball-host.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"validate-tarball-host.js","sourceRoot":"","sources":["../../../../../source/bundle-emitter/registry/validate-tarball-host.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,SAAS,uBAAuB,CAAC,gBAA4C;IACzE,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,WAAW,IAAI,cAAc,CAAC,CAAC;IAC9E,OAAO,aAAa,CAAC,MAAM,CAAC;AAChC,CAAC;AAED,SAAS,kBAAkB,CAAC,UAAkB;IAC1C,IAAI,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;QACtC,OAAO,SAAS,CAAC,MAAM,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,IAAI,SAAS,CAAC,8CAA8C,UAAU,GAAG,CAAC,CAAC;IACrF,CAAC;AACL,CAAC;AAED,SAAS,oBAAoB,CAAC,aAAqB,EAAE,gBAAwB;IACzE,OAAO,CACH,sCAAsC,aAAa,2DAA2D;QAC9G,IAAI,gBAAgB,4EAA4E;QAChG,sBAAsB,CACzB,CAAC;AACN,CAAC;AAED,MAAM,UAAU,kCAAkC,CAC9C,UAAkB,EAClB,gBAA4C;IAE5C,MAAM,aAAa,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACrD,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;IAEnE,IAAI,aAAa,KAAK,gBAAgB,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAC3E,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,32 @@
|
|
|
1
|
-
import 'remeda';
|
|
2
|
-
import 'true-myth/result';
|
|
3
|
-
import "../common/package-layout.js";
|
|
4
|
-
import "../common/stable-json.js";
|
|
5
|
-
import "../sbom/sbom-canonicalizer.js";
|
|
1
|
+
import { isPlainObject } from 'remeda';
|
|
2
|
+
import { tryOr } from 'true-myth/result';
|
|
3
|
+
import { bundleRelativePath, packageManifestFilePath } from "../common/package-layout.js";
|
|
4
|
+
import { serializeStableJson } from "../common/stable-json.js";
|
|
5
|
+
import { canonicalizeSbomInFileSet } from "../sbom/sbom-canonicalizer.js";
|
|
6
|
+
function canonicalizeManifestContent(content) {
|
|
7
|
+
const parsedResult = tryOr(undefined, function () {
|
|
8
|
+
return JSON.parse(content);
|
|
9
|
+
});
|
|
10
|
+
if (parsedResult.isErr) {
|
|
11
|
+
return content;
|
|
12
|
+
}
|
|
13
|
+
const parsed = parsedResult.value;
|
|
14
|
+
if (!isPlainObject(parsed)) {
|
|
15
|
+
return content;
|
|
16
|
+
}
|
|
17
|
+
const withoutGitHead = { ...parsed };
|
|
18
|
+
delete withoutGitHead.gitHead;
|
|
19
|
+
return serializeStableJson(withoutGitHead);
|
|
20
|
+
}
|
|
21
|
+
function canonicalizePackageManifestInFileSet(files) {
|
|
22
|
+
return files.map(function (file) {
|
|
23
|
+
if (bundleRelativePath(file.filePath) !== packageManifestFilePath) {
|
|
24
|
+
return file;
|
|
25
|
+
}
|
|
26
|
+
return { ...file, content: canonicalizeManifestContent(file.content) };
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export function canonicalizeReleaseArtifactFiles(files) {
|
|
30
|
+
return canonicalizePackageManifestInFileSet(canonicalizeSbomInFileSet(files));
|
|
31
|
+
}
|
|
6
32
|
//# sourceMappingURL=release-artifact-canonicalizer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-artifact-canonicalizer.js","sourceRoot":"","sources":["../../../../source/bundle-emitter/release-artifact-canonicalizer.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"release-artifact-canonicalizer.js","sourceRoot":"","sources":["../../../../source/bundle-emitter/release-artifact-canonicalizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO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ChecksSettings, PackageChecksSettings, PackageConfigsByName } from '../config/config.ts';
|
|
2
|
+
import type { AnalyzedBundle } from '../dead-code-eliminator/analyzed-bundle.ts';
|
|
3
|
+
import type { PublishedPackageWithManifest } from '../published-package/published-package.ts';
|
|
4
|
+
import type { AllCheckRules } from './rules/registry.ts';
|
|
5
|
+
export type CheckRunnerDependencies = {
|
|
6
|
+
readonly rules: AllCheckRules;
|
|
7
|
+
};
|
|
8
|
+
type CheckRunnerInput = {
|
|
9
|
+
readonly bundles: readonly AnalyzedBundle[];
|
|
10
|
+
readonly publishedPackages: ReadonlyMap<string, PublishedPackageWithManifest> | undefined;
|
|
11
|
+
readonly settings: ChecksSettings | undefined;
|
|
12
|
+
readonly perPackageSettings: ReadonlyMap<string, PackageChecksSettings | undefined>;
|
|
13
|
+
readonly packageConfigs: PackageConfigsByName;
|
|
14
|
+
};
|
|
15
|
+
export type CheckRunner = (input: CheckRunnerInput) => Promise<readonly string[]>;
|
|
16
|
+
export declare function createCheckRunner(dependencies: CheckRunnerDependencies): CheckRunner;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=check-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-runner.d.ts","sourceRoot":"","sources":["../../../../source/checks/check-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACvG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;CACjC,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACpB,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,4BAA4B,CAAC,GAAG,SAAS,CAAC;IAC1F,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,CAAC,CAAC;IACpF,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,gBAAgB,KAAK,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;AAElF,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,uBAAuB,GAAG,WAAW,CASpF"}
|
package/checks/check-runner.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
+
export function createCheckRunner(dependencies) {
|
|
2
|
+
return async function runChecks(input) {
|
|
3
|
+
const issues = await Promise.all(dependencies.rules.map(async function (rule) {
|
|
4
|
+
return await rule.run(input);
|
|
5
|
+
}));
|
|
6
|
+
return issues.flat();
|
|
7
|
+
};
|
|
8
|
+
}
|
|
1
9
|
//# sourceMappingURL=check-runner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-runner.js","sourceRoot":"","sources":["../../../../source/checks/check-runner.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"check-runner.js","sourceRoot":"","sources":["../../../../source/checks/check-runner.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,iBAAiB,CAAC,YAAqC;IACnE,OAAO,KAAK,UAAU,SAAS,CAAC,KAAK;QACjC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAC5B,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,WAAW,IAAI;YACvC,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC,CACL,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC,CAAC;AACN,CAAC"}
|
package/checks/rule.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z, type ZodMiniType } from 'zod/mini';
|
|
2
|
+
import type { AnalyzedBundle } from '../dead-code-eliminator/analyzed-bundle.ts';
|
|
3
|
+
import type { PublishedPackageWithManifest } from '../published-package/published-package.ts';
|
|
4
|
+
export declare const enabledOnlyGlobalSchema: z.ZodMiniObject<{
|
|
5
|
+
enabled: z.ZodMiniBoolean<boolean>;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
export declare const emptyPerPackageSchema: z.ZodMiniObject<{}, z.core.$strict>;
|
|
8
|
+
export declare const pathAllowListGlobalSchema: z.ZodMiniObject<{
|
|
9
|
+
allowList: z.ZodMiniOptional<z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniString<string>>>>;
|
|
10
|
+
enabled: z.ZodMiniBoolean<boolean>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export declare const pathAllowListPerPackageSchema: z.ZodMiniObject<{
|
|
13
|
+
allowList: z.ZodMiniOptional<z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniString<string>>>>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
type RuleGlobalConfig = {
|
|
16
|
+
readonly enabled: boolean;
|
|
17
|
+
};
|
|
18
|
+
type MainPackageJsonShape = {
|
|
19
|
+
readonly dependencies?: Readonly<Record<string, string>> | undefined;
|
|
20
|
+
readonly devDependencies?: Readonly<Record<string, string>> | undefined;
|
|
21
|
+
readonly peerDependencies?: Readonly<Record<string, string>> | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type RulePackageConfig = {
|
|
24
|
+
readonly bundleDependencies?: readonly string[] | undefined;
|
|
25
|
+
readonly bundlePeerDependencies?: readonly string[] | undefined;
|
|
26
|
+
readonly mainPackageJson?: MainPackageJsonShape | undefined;
|
|
27
|
+
};
|
|
28
|
+
export type RuleRunInput<TName extends string, TGlobal extends RuleGlobalConfig, TPerPackage> = {
|
|
29
|
+
readonly bundles: readonly AnalyzedBundle[];
|
|
30
|
+
readonly publishedPackages?: ReadonlyMap<string, PublishedPackageWithManifest> | undefined;
|
|
31
|
+
readonly settings: Readonly<Partial<Readonly<Record<TName, TGlobal | undefined>>>> | undefined;
|
|
32
|
+
readonly perPackageSettings: ReadonlyMap<string, Readonly<Partial<Readonly<Record<TName, TPerPackage | undefined>>>> | undefined>;
|
|
33
|
+
readonly packageConfigs?: Readonly<Record<string, RulePackageConfig>>;
|
|
34
|
+
};
|
|
35
|
+
export type CheckRuleDefinition<TName extends string, TGlobal extends RuleGlobalConfig, TPerPackage> = {
|
|
36
|
+
readonly name: TName;
|
|
37
|
+
readonly globalSchema: ZodMiniType<TGlobal>;
|
|
38
|
+
readonly perPackageSchema: ZodMiniType<TPerPackage>;
|
|
39
|
+
readonly run: (input: RuleRunInput<TName, TGlobal, TPerPackage>) => Promise<readonly string[]>;
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../../../source/checks/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAE9F,eAAO,MAAM,uBAAuB;;kBAA2C,CAAC;AAChF,eAAO,MAAM,qBAAqB,qCAAqB,CAAC;AAMxD,eAAO,MAAM,yBAAyB;;;kBAGpC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;kBAAqC,CAAC;AAEhF,KAAK,gBAAgB,GAAG;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC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ClF,CAAC;IACF,QAAQ,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;CACzE,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,KAAK,SAAS,MAAM,EAAE,OAAO,SAAS,gBAAgB,EAAE,WAAW,IAAI;IACnG,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5C,QAAQ,CAAC,gBAAgB,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACpD,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,KAAK,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CAClG,CAAC"}
|
package/checks/rule.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import 'zod/mini';
|
|
2
|
-
import "../config/base-validations.js";
|
|
1
|
+
import { z } from 'zod/mini';
|
|
2
|
+
import { nonEmptyStringSchema } from "../config/base-validations.js";
|
|
3
|
+
export const enabledOnlyGlobalSchema = z.strictObject({ enabled: z.boolean() });
|
|
4
|
+
export const emptyPerPackageSchema = z.strictObject({});
|
|
5
|
+
const pathAllowListShape = {
|
|
6
|
+
allowList: z.optional(z.readonly(z.array(nonEmptyStringSchema)))
|
|
7
|
+
};
|
|
8
|
+
export const pathAllowListGlobalSchema = z.strictObject({
|
|
9
|
+
enabled: z.boolean(),
|
|
10
|
+
...pathAllowListShape
|
|
11
|
+
});
|
|
12
|
+
export const pathAllowListPerPackageSchema = z.strictObject(pathAllowListShape);
|
|
3
13
|
//# sourceMappingURL=rule.js.map
|
package/checks/rule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../../../source/checks/rule.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../../../source/checks/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAoB,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAIrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAChF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AAExD,MAAM,kBAAkB,GAAG;IACvB,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;CACnE,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,YAAY,CAAC;IACpD,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,GAAG,kBAAkB;CACxB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
import "./duplicate-messages.js";
|
|
1
|
+
import { formatPathLevelMessage, formatSharedDeclarationsMessage } from "./duplicate-messages.js";
|
|
2
|
+
const minimumOwnerCountForDuplicate = 2;
|
|
3
|
+
export function hasMultipleOwners(owners) {
|
|
4
|
+
return owners.length >= minimumOwnerCountForDuplicate;
|
|
5
|
+
}
|
|
6
|
+
export function duplicateMessage(filePath, owners) {
|
|
7
|
+
const allOwnersHaveNoBindings = owners.every(function (owner) {
|
|
8
|
+
return owner.survivingBindings.size === 0;
|
|
9
|
+
});
|
|
10
|
+
if (allOwnersHaveNoBindings) {
|
|
11
|
+
return formatPathLevelMessage(filePath, owners);
|
|
12
|
+
}
|
|
13
|
+
const [firstOwner, ...remainingOwners] = owners;
|
|
14
|
+
const sharedDeclarations = remainingOwners.reduce(function (declarations, owner) {
|
|
15
|
+
return new Set(Array.from(declarations).filter(function (declaration) {
|
|
16
|
+
return owner.survivingBindings.has(declaration);
|
|
17
|
+
}));
|
|
18
|
+
}, new Set(firstOwner.survivingBindings));
|
|
19
|
+
if (sharedDeclarations.size === 0) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return formatSharedDeclarationsMessage(filePath, sharedDeclarations, owners);
|
|
23
|
+
}
|
|
2
24
|
//# sourceMappingURL=duplicate-detection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplicate-detection.js","sourceRoot":"","sources":["../../../../../source/checks/rules/duplicate-detection.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"duplicate-detection.js","sourceRoot":"","sources":["../../../../../source/checks/rules/duplicate-detection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAKlG,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAExC,MAAM,UAAU,iBAAiB,CAAC,MAA4B;IAC1D,OAAO,MAAM,CAAC,MAAM,IAAI,6BAA6B,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,MAAsB;IACrE,MAAM,uBAAuB,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,KAAK;QACxD,OAAO,KAAK,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,IAAI,uBAAuB,EAAE,CAAC;QAC1B,OAAO,sBAAsB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,CAAE,UAAU,EAAE,GAAG,eAAe,CAAE,GAAG,MAAM,CAAC;IAClD,MAAM,kBAAkB,GAAG,eAAe,CAAC,MAAM,CAAc,UAAU,YAAY,EAAE,KAAK;QACxF,OAAO,IAAI,GAAG,CACV,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,UAAU,WAAW;YACjD,OAAO,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACpD,CAAC,CAAC,CACL,CAAC;IACN,CAAC,EAAE,IAAI,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC1C,IAAI,kBAAkB,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,+BAA+B,CAAC,QAAQ,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -1 +1,23 @@
|
|
|
1
|
+
function ownerNames(owners) {
|
|
2
|
+
const bundleNames = owners.map(function (owner) {
|
|
3
|
+
return owner.bundleName;
|
|
4
|
+
});
|
|
5
|
+
return bundleNames.toSorted(function (left, right) {
|
|
6
|
+
return left.localeCompare(right);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export function formatSharedDeclarationsMessage(filePath, sharedDeclarations, owners) {
|
|
10
|
+
const ownersList = ownerNames(owners).join(', ');
|
|
11
|
+
const sortedDeclarations = Array.from(sharedDeclarations).toSorted(function (left, right) {
|
|
12
|
+
return left.localeCompare(right);
|
|
13
|
+
});
|
|
14
|
+
const lines = [`File "${filePath}" has shared declarations across multiple packages:`];
|
|
15
|
+
for (const declaration of sortedDeclarations) {
|
|
16
|
+
lines.push(` - "${declaration}" → ${ownersList}`);
|
|
17
|
+
}
|
|
18
|
+
return lines.join('\n');
|
|
19
|
+
}
|
|
20
|
+
export function formatPathLevelMessage(filePath, owners) {
|
|
21
|
+
return `File "${filePath}" is included in multiple packages: ${ownerNames(owners).join(', ')}`;
|
|
22
|
+
}
|
|
1
23
|
//# sourceMappingURL=duplicate-messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplicate-messages.js","sourceRoot":"","sources":["../../../../../source/checks/rules/duplicate-messages.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"duplicate-messages.js","sourceRoot":"","sources":["../../../../../source/checks/rules/duplicate-messages.ts"],"names":[],"mappings":"AAEA,SAAS,UAAU,CAAC,MAA4B;IAC5C,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,KAAK;QAC1C,OAAO,KAAK,CAAC,UAAU,CAAC;IAC5B,CAAC,CAAC,CAAC;IACH,OAAO,WAAW,CAAC,QAAQ,CAAC,UAAU,IAAI,EAAE,KAAK;QAC7C,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC3C,QAAgB,EAChB,kBAAuC,EACvC,MAA4B;IAE5B,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,UAAU,IAAI,EAAE,KAAK;QACpF,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,CAAE,SAAS,QAAQ,qDAAqD,CAAE,CAAC;IAEzF,KAAK,MAAM,WAAW,IAAI,kBAAkB,EAAE,CAAC;QAC3C,KAAK,CAAC,IAAI,CAAC,QAAQ,WAAW,OAAO,UAAU,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAAgB,EAAE,MAA4B;IACjF,OAAO,SAAS,QAAQ,uCAAuC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACnG,CAAC"}
|
|
@@ -1 +1,16 @@
|
|
|
1
|
+
export function collectFileOwnership(bundles) {
|
|
2
|
+
const ownership = new Map();
|
|
3
|
+
for (const bundle of bundles) {
|
|
4
|
+
for (const resource of bundle.contents) {
|
|
5
|
+
const filePath = resource.fileDescription.inputFilePath;
|
|
6
|
+
const owners = ownership.get(filePath) ?? [];
|
|
7
|
+
owners.push({
|
|
8
|
+
bundleName: bundle.name,
|
|
9
|
+
survivingBindings: resource.analysis.survivingBindings
|
|
10
|
+
});
|
|
11
|
+
ownership.set(filePath, owners);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return ownership;
|
|
15
|
+
}
|
|
1
16
|
//# sourceMappingURL=file-ownership.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-ownership.js","sourceRoot":"","sources":["../../../../../source/checks/rules/file-ownership.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"file-ownership.js","sourceRoot":"","sources":["../../../../../source/checks/rules/file-ownership.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,oBAAoB,CAChC,OAA6D;IAE7D,MAAM,SAAS,GAAG,IAAI,GAAG,EAAuB,CAAC;IAEjD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC3B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrC,MAAM,QAAQ,GAAG,QAAQ,CAAC,eAAe,CAAC,aAAa,CAAC;YACxD,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC;gBACR,UAAU,EAAE,MAAM,CAAC,IAAI;gBACvB,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,iBAAiB;aACzD,CAAC,CAAC;YACH,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CheckRuleDefinition } from '../rule.ts';
|
|
2
|
+
declare function ruleName(): 'maxBundleSize';
|
|
3
|
+
type RuleName = ReturnType<typeof ruleName>;
|
|
4
|
+
type GlobalConfig = {
|
|
5
|
+
readonly enabled: boolean;
|
|
6
|
+
readonly bytes?: number | undefined;
|
|
7
|
+
};
|
|
8
|
+
type PerPackageConfig = {
|
|
9
|
+
readonly bytes?: number | undefined;
|
|
10
|
+
};
|
|
11
|
+
export declare const maxBundleSizeRule: CheckRuleDefinition<RuleName, GlobalConfig, PerPackageConfig>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=max-bundle-size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"max-bundle-size.d.ts","sourceRoot":"","sources":["../../../../../source/checks/rules/max-bundle-size.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAgB,MAAM,YAAY,CAAC;AAEpE,iBAAS,QAAQ,IAAI,eAAe,CAEnC;AAID,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,KAAK,YAAY,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAAE,CAAC;AACxF,KAAK,gBAAgB,GAAG;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAAE,CAAC;AAgDjE,eAAO,MAAM,iBAAiB,EAAE,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,gBAAgB,CAW3F,CAAC"}
|
|
@@ -1,2 +1,56 @@
|
|
|
1
|
-
import 'zod/mini';
|
|
1
|
+
import { z } from 'zod/mini';
|
|
2
|
+
function ruleName() {
|
|
3
|
+
return 'maxBundleSize';
|
|
4
|
+
}
|
|
5
|
+
const byteLimitSchema = z.number().check(z.int(), z.nonnegative());
|
|
6
|
+
function globalSchema() {
|
|
7
|
+
return z.strictObject({
|
|
8
|
+
enabled: z.boolean(),
|
|
9
|
+
bytes: z.optional(byteLimitSchema)
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function perPackageSchema() {
|
|
13
|
+
return z.strictObject({
|
|
14
|
+
bytes: z.optional(byteLimitSchema)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function bundleSizeBytes(bundle) {
|
|
18
|
+
let total = 0;
|
|
19
|
+
for (const resource of bundle.contents) {
|
|
20
|
+
total += Buffer.byteLength(resource.fileDescription.content);
|
|
21
|
+
}
|
|
22
|
+
return total;
|
|
23
|
+
}
|
|
24
|
+
function checkBundle(bundle, threshold) {
|
|
25
|
+
if (threshold === undefined) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
const size = bundleSizeBytes(bundle);
|
|
29
|
+
if (size <= threshold) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
return [`Package "${bundle.name}" exceeds the maximum bundle size: ${size} bytes (limit: ${threshold} bytes)`];
|
|
33
|
+
}
|
|
34
|
+
async function run(input) {
|
|
35
|
+
const globalConfig = input.settings?.maxBundleSize;
|
|
36
|
+
if (globalConfig?.enabled !== true) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
return input.bundles.flatMap(function (bundle) {
|
|
40
|
+
const override = input.perPackageSettings.get(bundle.name)?.maxBundleSize?.bytes;
|
|
41
|
+
return checkBundle(bundle, override ?? globalConfig.bytes);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export const maxBundleSizeRule = {
|
|
45
|
+
get name() {
|
|
46
|
+
return ruleName();
|
|
47
|
+
},
|
|
48
|
+
get globalSchema() {
|
|
49
|
+
return globalSchema();
|
|
50
|
+
},
|
|
51
|
+
get perPackageSchema() {
|
|
52
|
+
return perPackageSchema();
|
|
53
|
+
},
|
|
54
|
+
run
|
|
55
|
+
};
|
|
2
56
|
//# sourceMappingURL=max-bundle-size.js.map
|