renovate 41.0.0-next.21 → 41.0.0-next.23
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/dist/config/decrypt.js +5 -3
- package/dist/config/decrypt.js.map +1 -1
- package/dist/config/options/index.js +45 -3
- package/dist/config/options/index.js.map +1 -1
- package/dist/config/presets/github/index.js +2 -2
- package/dist/config/presets/github/index.js.map +1 -1
- package/dist/config/presets/internal/group.js +21 -0
- package/dist/config/presets/internal/group.js.map +1 -1
- package/dist/config/presets/internal/workarounds.js +11 -0
- package/dist/config/presets/internal/workarounds.js.map +1 -1
- package/dist/config/secrets.d.ts +2 -0
- package/dist/config/secrets.js +10 -77
- package/dist/config/secrets.js.map +1 -1
- package/dist/config/types.d.ts +9 -1
- package/dist/config/types.js.map +1 -1
- package/dist/config-validator.js +4 -2
- package/dist/config-validator.js.map +1 -1
- package/dist/data/monorepo.json +10 -1
- package/dist/data-files.generated.d.ts +1 -1
- package/dist/data-files.generated.js +2 -1
- package/dist/data-files.generated.js.map +1 -1
- package/dist/instrumentation/index.js +5 -3
- package/dist/instrumentation/index.js.map +1 -1
- package/dist/instrumentation/reporting.d.ts +2 -2
- package/dist/instrumentation/reporting.js +3 -7
- package/dist/instrumentation/reporting.js.map +1 -1
- package/dist/instrumentation/types.d.ts +11 -5
- package/dist/instrumentation/types.js.map +1 -1
- package/dist/instrumentation/utils.js +3 -2
- package/dist/instrumentation/utils.js.map +1 -1
- package/dist/logger/once.js +2 -0
- package/dist/logger/once.js.map +1 -1
- package/dist/modules/datasource/aws-eks-addon/schema.d.ts +14 -38
- package/dist/modules/datasource/aws-eks-addon/schema.js +11 -22
- package/dist/modules/datasource/aws-eks-addon/schema.js.map +1 -1
- package/dist/modules/datasource/cdnjs/index.js +2 -1
- package/dist/modules/datasource/cdnjs/index.js.map +1 -1
- package/dist/modules/datasource/crate/index.js +7 -2
- package/dist/modules/datasource/crate/index.js.map +1 -1
- package/dist/modules/datasource/docker/ecr.js +2 -2
- package/dist/modules/datasource/docker/ecr.js.map +1 -1
- package/dist/modules/datasource/docker/index.js +26 -9
- package/dist/modules/datasource/docker/index.js.map +1 -1
- package/dist/modules/datasource/docker/schema.d.ts +9 -87
- package/dist/modules/datasource/docker/schema.js +1 -1
- package/dist/modules/datasource/docker/schema.js.map +1 -1
- package/dist/modules/datasource/git-refs/base.js +2 -6
- package/dist/modules/datasource/git-refs/base.js.map +1 -1
- package/dist/modules/datasource/go/goproxy-parser.js +6 -2
- package/dist/modules/datasource/go/goproxy-parser.js.map +1 -1
- package/dist/modules/datasource/go/index.js +4 -2
- package/dist/modules/datasource/go/index.js.map +1 -1
- package/dist/modules/datasource/go/releases-goproxy.js +3 -2
- package/dist/modules/datasource/go/releases-goproxy.js.map +1 -1
- package/dist/modules/datasource/index.js +1 -1
- package/dist/modules/datasource/index.js.map +1 -1
- package/dist/modules/datasource/maven/index.js +5 -19
- package/dist/modules/datasource/maven/index.js.map +1 -1
- package/dist/modules/datasource/maven/util.js +8 -1
- package/dist/modules/datasource/maven/util.js.map +1 -1
- package/dist/modules/datasource/npm/get.js +2 -1
- package/dist/modules/datasource/npm/get.js.map +1 -1
- package/dist/modules/datasource/npm/npmrc.js +2 -1
- package/dist/modules/datasource/npm/npmrc.js.map +1 -1
- package/dist/modules/datasource/nuget/v3.js +3 -2
- package/dist/modules/datasource/nuget/v3.js.map +1 -1
- package/dist/modules/datasource/pod/index.js +3 -1
- package/dist/modules/datasource/pod/index.js.map +1 -1
- package/dist/modules/datasource/pypi/index.js +2 -1
- package/dist/modules/datasource/pypi/index.js.map +1 -1
- package/dist/modules/datasource/types.d.ts +2 -1
- package/dist/modules/datasource/types.js.map +1 -1
- package/dist/modules/manager/asdf/upgradeable-tooling.js +8 -0
- package/dist/modules/manager/asdf/upgradeable-tooling.js.map +1 -1
- package/dist/modules/manager/bazel/rules/git.d.ts +7 -7
- package/dist/modules/manager/bazel/rules/git.js +6 -1
- package/dist/modules/manager/bazel/rules/git.js.map +1 -1
- package/dist/modules/manager/bazel-module/bazelrc.d.ts +2 -0
- package/dist/modules/manager/bazel-module/bazelrc.js +30 -1
- package/dist/modules/manager/bazel-module/bazelrc.js.map +1 -1
- package/dist/modules/manager/bazel-module/parser/rules.js +1 -0
- package/dist/modules/manager/bazel-module/parser/rules.js.map +1 -1
- package/dist/modules/manager/bazel-module/rules.d.ts +62 -24
- package/dist/modules/manager/bazel-module/rules.js +10 -4
- package/dist/modules/manager/bazel-module/rules.js.map +1 -1
- package/dist/modules/manager/cargo/extract.js +2 -1
- package/dist/modules/manager/cargo/extract.js.map +1 -1
- package/dist/modules/manager/composer/schema.js +1 -1
- package/dist/modules/manager/composer/schema.js.map +1 -1
- package/dist/modules/manager/docker-compose/extract.js +2 -0
- package/dist/modules/manager/docker-compose/extract.js.map +1 -1
- package/dist/modules/manager/docker-compose/schema.d.ts +120 -9
- package/dist/modules/manager/docker-compose/schema.js +35 -4
- package/dist/modules/manager/docker-compose/schema.js.map +1 -1
- package/dist/modules/manager/fingerprint.generated.js +19 -19
- package/dist/modules/manager/fingerprint.generated.js.map +1 -1
- package/dist/modules/manager/fleet/extract.js +2 -2
- package/dist/modules/manager/fleet/extract.js.map +1 -1
- package/dist/modules/manager/fleet/schema.d.ts +5 -5
- package/dist/modules/manager/fleet/schema.js +1 -1
- package/dist/modules/manager/fleet/schema.js.map +1 -1
- package/dist/modules/manager/flux/extract.js +1 -1
- package/dist/modules/manager/flux/extract.js.map +1 -1
- package/dist/modules/manager/git-submodules/extract.js +2 -6
- package/dist/modules/manager/git-submodules/extract.js.map +1 -1
- package/dist/modules/manager/git-submodules/update.js +3 -7
- package/dist/modules/manager/git-submodules/update.js.map +1 -1
- package/dist/modules/manager/github-actions/extract.js +1 -1
- package/dist/modules/manager/github-actions/extract.js.map +1 -1
- package/dist/modules/manager/gleam/artifacts.js +5 -1
- package/dist/modules/manager/gleam/artifacts.js.map +1 -1
- package/dist/modules/manager/gomod/artifacts.js +8 -6
- package/dist/modules/manager/gomod/artifacts.js.map +1 -1
- package/dist/modules/manager/gradle/extract.js +4 -1
- package/dist/modules/manager/gradle/extract.js.map +1 -1
- package/dist/modules/manager/gradle/utils.js +8 -14
- package/dist/modules/manager/gradle/utils.js.map +1 -1
- package/dist/modules/manager/helmfile/utils.js +1 -1
- package/dist/modules/manager/helmfile/utils.js.map +1 -1
- package/dist/modules/manager/helmv3/artifacts.js +8 -2
- package/dist/modules/manager/helmv3/artifacts.js.map +1 -1
- package/dist/modules/manager/helmv3/common.d.ts +1 -1
- package/dist/modules/manager/helmv3/common.js +9 -3
- package/dist/modules/manager/helmv3/common.js.map +1 -1
- package/dist/modules/manager/hermit/artifacts.js +2 -2
- package/dist/modules/manager/hermit/artifacts.js.map +1 -1
- package/dist/modules/manager/kubernetes/extract.js +2 -2
- package/dist/modules/manager/kubernetes/extract.js.map +1 -1
- package/dist/modules/manager/kustomize/artifacts.js +1 -1
- package/dist/modules/manager/kustomize/artifacts.js.map +1 -1
- package/dist/modules/manager/maven/extract.d.ts +1 -1
- package/dist/modules/manager/maven/extract.js +82 -24
- package/dist/modules/manager/maven/extract.js.map +1 -1
- package/dist/modules/manager/maven/index.d.ts +0 -1
- package/dist/modules/manager/maven/index.js +2 -4
- package/dist/modules/manager/maven/index.js.map +1 -1
- package/dist/modules/manager/maven/update.js +15 -0
- package/dist/modules/manager/maven/update.js.map +1 -1
- package/dist/modules/manager/mise/backends.d.ts +48 -0
- package/dist/modules/manager/mise/backends.js +219 -0
- package/dist/modules/manager/mise/backends.js.map +1 -0
- package/dist/modules/manager/mise/extract.js +77 -10
- package/dist/modules/manager/mise/extract.js.map +1 -1
- package/dist/modules/manager/mise/index.js +37 -2
- package/dist/modules/manager/mise/index.js.map +1 -1
- package/dist/modules/manager/mise/schema.d.ts +24 -0
- package/dist/modules/manager/mise/schema.js +7 -1
- package/dist/modules/manager/mise/schema.js.map +1 -1
- package/dist/modules/manager/mise/upgradeable-tooling.js +210 -1
- package/dist/modules/manager/mise/upgradeable-tooling.js.map +1 -1
- package/dist/modules/manager/mix/artifacts.js +5 -0
- package/dist/modules/manager/mix/artifacts.js.map +1 -1
- package/dist/modules/manager/npm/extract/index.js +27 -24
- package/dist/modules/manager/npm/extract/index.js.map +1 -1
- package/dist/modules/manager/npm/post-update/index.js +9 -3
- package/dist/modules/manager/npm/post-update/index.js.map +1 -1
- package/dist/modules/manager/npm/post-update/npm.js +8 -5
- package/dist/modules/manager/npm/post-update/npm.js.map +1 -1
- package/dist/modules/manager/npm/post-update/pnpm.js +4 -0
- package/dist/modules/manager/npm/post-update/pnpm.js.map +1 -1
- package/dist/modules/manager/npm/post-update/utils.js +17 -0
- package/dist/modules/manager/npm/post-update/utils.js.map +1 -1
- package/dist/modules/manager/npm/post-update/yarn.js +7 -5
- package/dist/modules/manager/npm/post-update/yarn.js.map +1 -1
- package/dist/modules/manager/npm/schema.d.ts +116 -0
- package/dist/modules/manager/npm/schema.js +9 -0
- package/dist/modules/manager/npm/schema.js.map +1 -1
- package/dist/modules/manager/npm/utils.js +1 -1
- package/dist/modules/manager/npm/utils.js.map +1 -1
- package/dist/modules/manager/nuget/util.js +9 -0
- package/dist/modules/manager/nuget/util.js.map +1 -1
- package/dist/modules/manager/pep621/processors/uv.js +1 -1
- package/dist/modules/manager/pep621/processors/uv.js.map +1 -1
- package/dist/modules/manager/pip-compile/artifacts.js +6 -4
- package/dist/modules/manager/pip-compile/artifacts.js.map +1 -1
- package/dist/modules/manager/pip_requirements/common.js +2 -1
- package/dist/modules/manager/pip_requirements/common.js.map +1 -1
- package/dist/modules/manager/poetry/schema.js +2 -1
- package/dist/modules/manager/poetry/schema.js.map +1 -1
- package/dist/modules/manager/pre-commit/index.js +2 -1
- package/dist/modules/manager/pre-commit/index.js.map +1 -1
- package/dist/modules/manager/renovate-config-presets/index.d.ts +1 -1
- package/dist/modules/manager/renovate-config-presets/index.js +1 -3
- package/dist/modules/manager/renovate-config-presets/index.js.map +1 -1
- package/dist/modules/manager/terraform/extractors/others/modules.js +4 -9
- package/dist/modules/manager/terraform/extractors/others/modules.js.map +1 -1
- package/dist/modules/manager/terraform/extractors/resources/generic-docker-image-ref.d.ts +1 -0
- package/dist/modules/manager/terraform/extractors/resources/generic-docker-image-ref.js +9 -4
- package/dist/modules/manager/terraform/extractors/resources/generic-docker-image-ref.js.map +1 -1
- package/dist/modules/manager/terraform/extractors/resources/utils.d.ts +1 -0
- package/dist/modules/manager/terraform/extractors/resources/utils.js +4 -1
- package/dist/modules/manager/terraform/extractors/resources/utils.js.map +1 -1
- package/dist/modules/manager/terraform/hcl/types.d.ts +1 -0
- package/dist/modules/manager/terraform/hcl/types.js.map +1 -1
- package/dist/modules/manager/types.d.ts +3 -0
- package/dist/modules/manager/types.js.map +1 -1
- package/dist/modules/platform/bitbucket-server/index.js +4 -2
- package/dist/modules/platform/bitbucket-server/index.js.map +1 -1
- package/dist/modules/platform/codecommit/codecommit-client.js +7 -5
- package/dist/modules/platform/codecommit/codecommit-client.js.map +1 -1
- package/dist/modules/platform/codecommit/index.js +7 -5
- package/dist/modules/platform/codecommit/index.js.map +1 -1
- package/dist/modules/platform/default-scm.d.ts +1 -0
- package/dist/modules/platform/default-scm.js +3 -0
- package/dist/modules/platform/default-scm.js.map +1 -1
- package/dist/modules/platform/gerrit/client.d.ts +6 -7
- package/dist/modules/platform/gerrit/client.js +58 -38
- package/dist/modules/platform/gerrit/client.js.map +1 -1
- package/dist/modules/platform/gerrit/index.d.ts +4 -3
- package/dist/modules/platform/gerrit/index.js +103 -42
- package/dist/modules/platform/gerrit/index.js.map +1 -1
- package/dist/modules/platform/gerrit/scm.d.ts +1 -1
- package/dist/modules/platform/gerrit/scm.js +56 -34
- package/dist/modules/platform/gerrit/scm.js.map +1 -1
- package/dist/modules/platform/gerrit/types.d.ts +23 -12
- package/dist/modules/platform/gerrit/types.js.map +1 -1
- package/dist/modules/platform/gerrit/utils.d.ts +8 -4
- package/dist/modules/platform/gerrit/utils.js +24 -12
- package/dist/modules/platform/gerrit/utils.js.map +1 -1
- package/dist/modules/platform/gitea/index.js +7 -2
- package/dist/modules/platform/gitea/index.js.map +1 -1
- package/dist/modules/platform/gitea/types.d.ts +2 -1
- package/dist/modules/platform/gitea/types.js.map +1 -1
- package/dist/modules/platform/github/index.js +12 -26
- package/dist/modules/platform/github/index.js.map +1 -1
- package/dist/modules/platform/gitlab/code-owners.d.ts +2 -0
- package/dist/modules/platform/gitlab/code-owners.js +38 -0
- package/dist/modules/platform/gitlab/code-owners.js.map +1 -0
- package/dist/modules/platform/gitlab/index.d.ts +2 -1
- package/dist/modules/platform/gitlab/index.js +29 -56
- package/dist/modules/platform/gitlab/index.js.map +1 -1
- package/dist/modules/platform/gitlab/pr-cache.d.ts +21 -0
- package/dist/modules/platform/gitlab/pr-cache.js +124 -0
- package/dist/modules/platform/gitlab/pr-cache.js.map +1 -0
- package/dist/modules/platform/gitlab/types.d.ts +7 -0
- package/dist/modules/platform/gitlab/types.js.map +1 -1
- package/dist/modules/platform/gitlab/utils.js +1 -0
- package/dist/modules/platform/gitlab/utils.js.map +1 -1
- package/dist/modules/platform/types.d.ts +8 -0
- package/dist/modules/platform/types.js.map +1 -1
- package/dist/modules/versioning/api.js +2 -0
- package/dist/modules/versioning/api.js.map +1 -1
- package/dist/modules/versioning/cargo/index.js +20 -0
- package/dist/modules/versioning/cargo/index.js.map +1 -1
- package/dist/modules/versioning/composer/index.js +4 -0
- package/dist/modules/versioning/composer/index.js.map +1 -1
- package/dist/modules/versioning/lambda-node/index.d.ts +8 -0
- package/dist/modules/versioning/lambda-node/index.js +27 -0
- package/dist/modules/versioning/lambda-node/index.js.map +1 -0
- package/dist/modules/versioning/lambda-node/schedule.d.ts +10 -0
- package/dist/modules/versioning/lambda-node/schedule.js +19 -0
- package/dist/modules/versioning/lambda-node/schedule.js.map +1 -0
- package/dist/modules/versioning/npm/index.js +2 -0
- package/dist/modules/versioning/npm/index.js.map +1 -1
- package/dist/modules/versioning/npm/range.js +4 -0
- package/dist/modules/versioning/npm/range.js.map +1 -1
- package/dist/modules/versioning/pep440/index.js +1 -1
- package/dist/modules/versioning/pep440/index.js.map +1 -1
- package/dist/modules/versioning/python/index.d.ts +1 -0
- package/dist/modules/versioning/python/index.js +9 -0
- package/dist/modules/versioning/python/index.js.map +1 -1
- package/dist/modules/versioning/semver/index.d.ts +1 -0
- package/dist/modules/versioning/semver/index.js +15 -0
- package/dist/modules/versioning/semver/index.js.map +1 -1
- package/dist/modules/versioning/semver-coerced/index.js +9 -0
- package/dist/modules/versioning/semver-coerced/index.js.map +1 -1
- package/dist/modules/versioning/types.d.ts +1 -0
- package/dist/modules/versioning/types.js.map +1 -1
- package/dist/util/cache/memory/index.d.ts +1 -0
- package/dist/util/cache/memory/index.js +17 -6
- package/dist/util/cache/memory/index.js.map +1 -1
- package/dist/util/cache/package/index.js +2 -1
- package/dist/util/cache/package/index.js.map +1 -1
- package/dist/util/cache/package/key.js +1 -1
- package/dist/util/cache/package/key.js.map +1 -1
- package/dist/util/cache/package/types.d.ts +2 -2
- package/dist/util/cache/package/types.js.map +1 -1
- package/dist/util/cache/repository/impl/s3.js +2 -1
- package/dist/util/cache/repository/impl/s3.js.map +1 -1
- package/dist/util/cache/repository/types.d.ts +3 -0
- package/dist/util/cache/repository/types.js.map +1 -1
- package/dist/util/env.d.ts +6 -0
- package/dist/util/env.js +13 -0
- package/dist/util/env.js.map +1 -1
- package/dist/util/exec/common.js +2 -1
- package/dist/util/exec/common.js.map +1 -1
- package/dist/util/exec/containerbase.js +2 -1
- package/dist/util/exec/containerbase.js.map +1 -1
- package/dist/util/exec/env.js +1 -0
- package/dist/util/exec/env.js.map +1 -1
- package/dist/util/exec/utils.d.ts +1 -1
- package/dist/util/exec/utils.js +1 -1
- package/dist/util/exec/utils.js.map +1 -1
- package/dist/util/fs/index.js +2 -2
- package/dist/util/fs/index.js.map +1 -1
- package/dist/util/git/auth.js +4 -2
- package/dist/util/git/auth.js.map +1 -1
- package/dist/util/git/error.js +2 -1
- package/dist/util/git/error.js.map +1 -1
- package/dist/util/git/index.d.ts +20 -0
- package/dist/util/git/index.js +140 -10
- package/dist/util/git/index.js.map +1 -1
- package/dist/util/git/types.d.ts +1 -0
- package/dist/util/git/types.js.map +1 -1
- package/dist/util/github/graphql/datasource-fetcher.js +2 -3
- package/dist/util/github/graphql/datasource-fetcher.js.map +1 -1
- package/dist/util/github/graphql/query-adapters/tags-query-adapter.d.ts +48 -2
- package/dist/util/github/graphql/query-adapters/tags-query-adapter.js +27 -7
- package/dist/util/github/graphql/query-adapters/tags-query-adapter.js.map +1 -1
- package/dist/util/host-rules.js +4 -3
- package/dist/util/host-rules.js.map +1 -1
- package/dist/util/http/cache/package-http-cache-provider.d.ts +4 -4
- package/dist/util/http/cache/package-http-cache-provider.js +4 -4
- package/dist/util/http/cache/package-http-cache-provider.js.map +1 -1
- package/dist/util/http/github.js +20 -12
- package/dist/util/http/github.js.map +1 -1
- package/dist/util/http/gitlab.js +2 -1
- package/dist/util/http/gitlab.js.map +1 -1
- package/dist/util/http/http.js +7 -3
- package/dist/util/http/http.js.map +1 -1
- package/dist/util/interpolator.d.ts +8 -0
- package/dist/util/interpolator.js +85 -0
- package/dist/util/interpolator.js.map +1 -0
- package/dist/util/merge-confidence/index.js +4 -1
- package/dist/util/merge-confidence/index.js.map +1 -1
- package/dist/util/promises.d.ts +4 -4
- package/dist/util/promises.js +3 -4
- package/dist/util/promises.js.map +1 -1
- package/dist/util/regex.js +3 -2
- package/dist/util/regex.js.map +1 -1
- package/dist/util/{schema-utils.d.ts → schema-utils/index.d.ts} +2 -2
- package/dist/util/{schema-utils.js → schema-utils/index.js} +5 -5
- package/dist/util/schema-utils/index.js.map +1 -0
- package/dist/util/schema-utils/v4.d.ts +7 -0
- package/dist/util/schema-utils/v4.js +64 -0
- package/dist/util/schema-utils/v4.js.map +1 -0
- package/dist/util/stats.d.ts +13 -2
- package/dist/util/stats.js +38 -27
- package/dist/util/stats.js.map +1 -1
- package/dist/workers/global/config/parse/codespaces.js +7 -4
- package/dist/workers/global/config/parse/codespaces.js.map +1 -1
- package/dist/workers/global/index.js +7 -5
- package/dist/workers/global/index.js.map +1 -1
- package/dist/workers/repository/config-migration/branch/migrated-data.js +1 -1
- package/dist/workers/repository/config-migration/branch/migrated-data.js.map +1 -1
- package/dist/workers/repository/dependency-dashboard.d.ts +1 -0
- package/dist/workers/repository/dependency-dashboard.js +47 -0
- package/dist/workers/repository/dependency-dashboard.js.map +1 -1
- package/dist/workers/repository/index.js +1 -0
- package/dist/workers/repository/index.js.map +1 -1
- package/dist/workers/repository/init/inherited.js +10 -6
- package/dist/workers/repository/init/inherited.js.map +1 -1
- package/dist/workers/repository/init/merge.d.ts +2 -2
- package/dist/workers/repository/init/merge.js +12 -5
- package/dist/workers/repository/init/merge.js.map +1 -1
- package/dist/workers/repository/package-files.js +11 -1
- package/dist/workers/repository/package-files.js.map +1 -1
- package/dist/workers/repository/process/extract-update.d.ts +1 -1
- package/dist/workers/repository/process/extract-update.js +15 -10
- package/dist/workers/repository/process/extract-update.js.map +1 -1
- package/dist/workers/repository/process/index.d.ts +1 -1
- package/dist/workers/repository/process/index.js +6 -3
- package/dist/workers/repository/process/index.js.map +1 -1
- package/dist/workers/repository/process/libyear.js +15 -7
- package/dist/workers/repository/process/libyear.js.map +1 -1
- package/dist/workers/repository/process/lookup/abandonment.d.ts +3 -0
- package/dist/workers/repository/process/lookup/abandonment.js +50 -0
- package/dist/workers/repository/process/lookup/abandonment.js.map +1 -0
- package/dist/workers/repository/process/lookup/current.js +0 -5
- package/dist/workers/repository/process/lookup/current.js.map +1 -1
- package/dist/workers/repository/process/lookup/generate.js +10 -0
- package/dist/workers/repository/process/lookup/generate.js.map +1 -1
- package/dist/workers/repository/process/lookup/index.js +7 -0
- package/dist/workers/repository/process/lookup/index.js.map +1 -1
- package/dist/workers/repository/process/lookup/timestamps.d.ts +4 -4
- package/dist/workers/repository/process/lookup/timestamps.js +10 -10
- package/dist/workers/repository/process/lookup/timestamps.js.map +1 -1
- package/dist/workers/repository/process/lookup/types.d.ts +4 -0
- package/dist/workers/repository/process/lookup/types.js.map +1 -1
- package/dist/workers/repository/update/branch/auto-replace.js +30 -7
- package/dist/workers/repository/update/branch/auto-replace.js.map +1 -1
- package/dist/workers/repository/update/branch/bump-versions.d.ts +2 -0
- package/dist/workers/repository/update/branch/bump-versions.js +192 -0
- package/dist/workers/repository/update/branch/bump-versions.js.map +1 -0
- package/dist/workers/repository/update/branch/execute-post-upgrade-commands.js +14 -8
- package/dist/workers/repository/update/branch/execute-post-upgrade-commands.js.map +1 -1
- package/dist/workers/repository/update/branch/get-updated.js +3 -4
- package/dist/workers/repository/update/branch/get-updated.js.map +1 -1
- package/dist/workers/repository/update/branch/index.js +3 -0
- package/dist/workers/repository/update/branch/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/release-notes.js +23 -19
- package/dist/workers/repository/update/pr/changelog/release-notes.js.map +1 -1
- package/dist/workers/repository/update/pr/code-owners.js +13 -9
- package/dist/workers/repository/update/pr/code-owners.js.map +1 -1
- package/dist/workers/repository/updates/generate.js +1 -0
- package/dist/workers/repository/updates/generate.js.map +1 -1
- package/package.json +75 -80
- package/renovate-schema.json +78 -14
- package/dist/util/schema-utils.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/modules/platform/gitlab/utils.ts"],"names":[],"mappings":";;;AAOA,
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/modules/platform/gitlab/utils.ts"],"names":[],"mappings":";;;AAOA,wBAkCC;;AAzCD,kEAAkC;AAClC,wCAA6C;AAGhC,QAAA,YAAY,GAAG,SAAS,CAAC;AACzB,QAAA,uBAAuB,GAAG,OAAO,CAAC;AAE/C,SAAgB,MAAM,CAAC,EAAsB;IAC3C,MAAM,EAAE,GAAa;QACnB,YAAY,EAAE,EAAE,CAAC,aAAa;QAC9B,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,QAAQ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AAM,CAAC,CAAC;QACnD,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC;IACpB,CAAC;SAAM,IAAI,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,+BAAuB,CAAC,EAAE,CAAC;QACxD,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,+BAAuB,CAAC,MAAM,CAAC,CAAC;QAC9D,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { getPrBodyStruct } from '../pr-body';\nimport type { GitLabMergeRequest, GitlabPr } from './types';\n\nexport const DRAFT_PREFIX = 'Draft: ';\nexport const DRAFT_PREFIX_DEPRECATED = 'WIP: ';\n\nexport function prInfo(mr: GitLabMergeRequest): GitlabPr {\n const pr: GitlabPr = {\n sourceBranch: mr.source_branch,\n state: mr.state === 'opened' ? 'open' : mr.state,\n number: mr.iid,\n title: mr.title,\n createdAt: mr.created_at,\n hasAssignees: !!(mr.assignee?.id ?? mr.assignees?.[0]?.id),\n bodyStruct: getPrBodyStruct(mr.description),\n\n ...(mr.target_branch && { targetBranch: mr.target_branch }),\n\n ...(mr.head_pipeline?.status && {\n headPipelineStatus: mr.head_pipeline?.status,\n }),\n ...(mr.head_pipeline?.sha && { headPipelineSha: mr.head_pipeline?.sha }),\n\n ...(is.nonEmptyArray(mr.reviewers) && {\n reviewers: mr.reviewers?.map(({ username }) => username),\n }),\n\n ...(mr.labels && { labels: mr.labels }),\n ...(mr.sha && { sha: mr.sha }),\n };\n\n if (pr.title.startsWith(DRAFT_PREFIX)) {\n pr.title = pr.title.substring(DRAFT_PREFIX.length);\n pr.isDraft = true;\n } else if (pr.title.startsWith(DRAFT_PREFIX_DEPRECATED)) {\n pr.title = pr.title.substring(DRAFT_PREFIX_DEPRECATED.length);\n pr.isDraft = true;\n }\n\n return pr;\n}\n"]}
|
@@ -188,6 +188,12 @@ export interface AutodiscoverConfig {
|
|
188
188
|
namespaces?: string[];
|
189
189
|
projects?: string[];
|
190
190
|
}
|
191
|
+
export interface FileOwnerRule {
|
192
|
+
usernames: string[];
|
193
|
+
pattern: string;
|
194
|
+
score: number;
|
195
|
+
match: (path: string) => boolean;
|
196
|
+
}
|
191
197
|
export interface Platform {
|
192
198
|
findIssue(title: string): Promise<Issue | null>;
|
193
199
|
getIssueList(): Promise<Issue[]>;
|
@@ -224,6 +230,7 @@ export interface Platform {
|
|
224
230
|
filterUnavailableUsers?(users: string[]): Promise<string[]>;
|
225
231
|
commitFiles?(config: CommitFilesConfig): Promise<LongCommitSha | null>;
|
226
232
|
expandGroupMembers?(reviewersOrAssignees: string[]): Promise<string[]>;
|
233
|
+
extractRulesFromCodeOwnersLines?(cleanedLines: string[]): FileOwnerRule[];
|
227
234
|
maxBodyLength(): number;
|
228
235
|
labelCharLimit?(): number;
|
229
236
|
}
|
@@ -239,5 +246,6 @@ export interface PlatformScm {
|
|
239
246
|
checkoutBranch(branchName: string): Promise<LongCommitSha>;
|
240
247
|
mergeToLocal(branchName: string): Promise<void>;
|
241
248
|
mergeAndPush(branchName: string): Promise<void>;
|
249
|
+
syncForkWithUpstream?(baseBranch: string): Promise<void>;
|
242
250
|
}
|
243
251
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/modules/platform/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MergeStrategy } from '../../config/types';\nimport type { BranchStatus, HostRule, VulnerabilityAlert } from '../../types';\nimport type { CommitFilesConfig, LongCommitSha } from '../../util/git/types';\n\ntype VulnerabilityKey = string;\ntype VulnerabilityRangeKey = string;\ntype VulnerabilityPatch = string;\nexport type AggregatedVulnerabilities = Record<\n VulnerabilityKey,\n Record<VulnerabilityRangeKey, VulnerabilityPatch | null>\n>;\n\nexport interface PlatformParams {\n endpoint?: string;\n token?: string;\n username?: string;\n password?: string;\n gitAuthor?: string;\n}\n\nexport interface PlatformResult {\n endpoint: string;\n renovateUsername?: string;\n token?: string;\n gitAuthor?: string;\n /*\n * return these only if _additional_ rules/hosts are required\n */\n hostRules?: HostRule[];\n}\n\nexport interface RepoResult {\n defaultBranch: string;\n isFork: boolean;\n repoFingerprint: string;\n}\n\nexport type GitUrlOption = 'default' | 'ssh' | 'endpoint';\n\nexport interface RepoParams {\n repository: string;\n endpoint?: string;\n gitUrl?: GitUrlOption;\n forkCreation?: boolean;\n forkOrg?: string;\n forkToken?: string;\n forkProcessing?: 'enabled' | 'disabled';\n renovateUsername?: string;\n cloneSubmodules?: boolean;\n cloneSubmodulesFilter?: string[];\n ignorePrAuthor?: boolean;\n bbUseDevelopmentBranch?: boolean;\n includeMirrors?: boolean;\n}\n\nexport interface PrDebugData {\n createdInVer: string;\n updatedInVer: string;\n targetBranch: string;\n labels?: string[];\n}\n\nexport interface PrBodyStruct {\n hash: string;\n rawConfigHash?: string;\n rebaseRequested?: boolean;\n debugData?: PrDebugData;\n}\n\n/**\n *\n */\nexport interface Pr {\n bodyStruct?: PrBodyStruct;\n sourceBranch: string;\n cannotMergeReason?: string; // for reflecting platform policies which may prevent merging\n createdAt?: string;\n closedAt?: string;\n hasAssignees?: boolean;\n labels?: string[];\n number: number;\n reviewers?: string[];\n sha?: LongCommitSha;\n sourceRepo?: string;\n state: string;\n targetBranch?: string;\n title: string;\n isDraft?: boolean;\n}\n\n/**\n * TODO: Proper typing\n */\nexport interface Issue {\n body?: string;\n number?: number;\n state?: string;\n title?: string;\n}\nexport interface PlatformPrOptions {\n autoApprove?: boolean;\n automergeStrategy?: MergeStrategy;\n azureWorkItemId?: number;\n bbUseDefaultReviewers?: boolean;\n bbAutoResolvePrTasks?: boolean;\n gitLabIgnoreApprovals?: boolean;\n usePlatformAutomerge?: boolean;\n forkModeDisallowMaintainerEdits?: boolean;\n}\n\nexport interface CreatePRConfig {\n sourceBranch: string;\n targetBranch: string;\n prTitle: string;\n prBody: string;\n labels?: string[] | null;\n platformPrOptions?: PlatformPrOptions;\n draftPR?: boolean;\n milestone?: number;\n}\nexport interface UpdatePrConfig {\n number: number;\n platformPrOptions?: PlatformPrOptions;\n prTitle: string;\n prBody?: string;\n state?: 'open' | 'closed';\n targetBranch?: string;\n\n /**\n * This field allows for label management and is designed to\n * accommodate the different label update methods on various platforms.\n *\n * - For Gitea, labels are updated by replacing the entire labels array.\n * - In the case of GitHub and GitLab, specific endpoints exist\n * for adding and removing labels.\n */\n labels?: string[] | null;\n\n /**\n * Specifies an array of labels to be added.\n * @see {@link labels}\n */\n addLabels?: string[] | null;\n\n /**\n * Specifies an array of labels to be removed.\n * @see {@link labels}\n */\n removeLabels?: string[] | null;\n}\nexport interface ReattemptPlatformAutomergeConfig {\n number: number;\n platformPrOptions?: PlatformPrOptions;\n}\nexport interface EnsureIssueConfig {\n title: string;\n reuseTitle?: string;\n body: string;\n labels?: string[];\n once?: boolean;\n shouldReOpen?: boolean;\n confidential?: boolean;\n}\nexport interface BranchStatusConfig {\n branchName: string;\n context: string;\n description: string;\n state: BranchStatus;\n url?: string;\n}\nexport interface FindPRConfig {\n branchName: string;\n prTitle?: string | null;\n state?: 'open' | 'closed' | '!open' | 'all';\n refreshCache?: boolean;\n targetBranch?: string | null;\n includeOtherAuthors?: boolean;\n}\nexport interface MergePRConfig {\n branchName?: string;\n id: number;\n strategy?: MergeStrategy;\n}\nexport interface EnsureCommentConfig {\n number: number;\n topic: string | null;\n content: string;\n}\n\nexport interface EnsureCommentRemovalConfigByTopic {\n type: 'by-topic';\n number: number;\n topic: string;\n}\nexport interface EnsureCommentRemovalConfigByContent {\n type: 'by-content';\n number: number;\n content: string;\n}\nexport type EnsureCommentRemovalConfig =\n | EnsureCommentRemovalConfigByTopic\n | EnsureCommentRemovalConfigByContent;\n\nexport type EnsureIssueResult = 'updated' | 'created';\n\nexport type RepoSortMethod =\n | 'alpha'\n | 'created'\n | 'updated'\n | 'size'\n | 'id'\n | null;\n\nexport type SortMethod = 'asc' | 'desc' | null;\nexport interface AutodiscoverConfig {\n topics?: string[];\n sort?: RepoSortMethod;\n order?: SortMethod;\n includeMirrors?: boolean;\n namespaces?: string[];\n projects?: string[];\n}\n\nexport interface Platform {\n findIssue(title: string): Promise<Issue | null>;\n getIssueList(): Promise<Issue[]>;\n getIssue?(number: number, memCache?: boolean): Promise<Issue | null>;\n getVulnerabilityAlerts?(): Promise<VulnerabilityAlert[]>;\n getRawFile(\n fileName: string,\n repoName?: string,\n branchOrTag?: string,\n ): Promise<string | null>;\n getJsonFile(\n fileName: string,\n repoName?: string,\n branchOrTag?: string,\n ): Promise<any>;\n initRepo(config: RepoParams): Promise<RepoResult>;\n getPrList(): Promise<Pr[]>;\n ensureIssueClosing(title: string): Promise<void>;\n ensureIssue(\n issueConfig: EnsureIssueConfig,\n ): Promise<EnsureIssueResult | null>;\n massageMarkdown(prBody: string): string;\n updatePr(prConfig: UpdatePrConfig): Promise<void>;\n mergePr(config: MergePRConfig): Promise<boolean>;\n addReviewers(number: number, reviewers: string[]): Promise<void>;\n addAssignees(number: number, assignees: string[]): Promise<void>;\n createPr(prConfig: CreatePRConfig): Promise<Pr | null>;\n getRepos(config?: AutodiscoverConfig): Promise<string[]>;\n getBranchForceRebase?(branchName: string): Promise<boolean>;\n deleteLabel(number: number, label: string): Promise<void>;\n addLabel?(number: number, label: string): Promise<void>;\n setBranchStatus(branchStatusConfig: BranchStatusConfig): Promise<void>;\n getBranchStatusCheck(\n branchName: string,\n // TODO: can be undefined or null ? #22198\n context: string | null | undefined,\n ): Promise<BranchStatus | null>;\n ensureCommentRemoval(\n ensureCommentRemoval:\n | EnsureCommentRemovalConfigByTopic\n | EnsureCommentRemovalConfigByContent,\n ): Promise<void>;\n ensureComment(ensureComment: EnsureCommentConfig): Promise<boolean>;\n getPr(number: number): Promise<Pr | null>;\n findPr(findPRConfig: FindPRConfig): Promise<Pr | null>;\n refreshPr?(number: number): Promise<void>;\n reattemptPlatformAutomerge?(\n prConfig: ReattemptPlatformAutomergeConfig,\n ): Promise<void>;\n getBranchStatus(\n branchName: string,\n internalChecksAsSuccess: boolean,\n ): Promise<BranchStatus>;\n getBranchPr(branchName: string, targetBranch?: string): Promise<Pr | null>;\n tryReuseAutoclosedPr?(pr: Pr): Promise<Pr | null>;\n initPlatform(config: PlatformParams): Promise<PlatformResult>;\n filterUnavailableUsers?(users: string[]): Promise<string[]>;\n commitFiles?(config: CommitFilesConfig): Promise<LongCommitSha | null>;\n expandGroupMembers?(reviewersOrAssignees: string[]): Promise<string[]>;\n\n maxBodyLength(): number;\n labelCharLimit?(): number;\n}\n\nexport interface PlatformScm {\n isBranchBehindBase(branchName: string, baseBranch: string): Promise<boolean>;\n isBranchModified(branchName: string, baseBranch: string): Promise<boolean>;\n isBranchConflicted(baseBranch: string, branch: string): Promise<boolean>;\n branchExists(branchName: string): Promise<boolean>;\n getBranchCommit(branchName: string): Promise<LongCommitSha | null>;\n deleteBranch(branchName: string): Promise<void>;\n commitAndPush(commitConfig: CommitFilesConfig): Promise<LongCommitSha | null>;\n getFileList(): Promise<string[]>;\n checkoutBranch(branchName: string): Promise<LongCommitSha>;\n mergeToLocal(branchName: string): Promise<void>;\n mergeAndPush(branchName: string): Promise<void>;\n}\n"]}
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/modules/platform/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MergeStrategy } from '../../config/types';\nimport type { BranchStatus, HostRule, VulnerabilityAlert } from '../../types';\nimport type { CommitFilesConfig, LongCommitSha } from '../../util/git/types';\n\ntype VulnerabilityKey = string;\ntype VulnerabilityRangeKey = string;\ntype VulnerabilityPatch = string;\nexport type AggregatedVulnerabilities = Record<\n VulnerabilityKey,\n Record<VulnerabilityRangeKey, VulnerabilityPatch | null>\n>;\n\nexport interface PlatformParams {\n endpoint?: string;\n token?: string;\n username?: string;\n password?: string;\n gitAuthor?: string;\n}\n\nexport interface PlatformResult {\n endpoint: string;\n renovateUsername?: string;\n token?: string;\n gitAuthor?: string;\n /*\n * return these only if _additional_ rules/hosts are required\n */\n hostRules?: HostRule[];\n}\n\nexport interface RepoResult {\n defaultBranch: string;\n isFork: boolean;\n repoFingerprint: string;\n}\n\nexport type GitUrlOption = 'default' | 'ssh' | 'endpoint';\n\nexport interface RepoParams {\n repository: string;\n endpoint?: string;\n gitUrl?: GitUrlOption;\n forkCreation?: boolean;\n forkOrg?: string;\n forkToken?: string;\n forkProcessing?: 'enabled' | 'disabled';\n renovateUsername?: string;\n cloneSubmodules?: boolean;\n cloneSubmodulesFilter?: string[];\n ignorePrAuthor?: boolean;\n bbUseDevelopmentBranch?: boolean;\n includeMirrors?: boolean;\n}\n\nexport interface PrDebugData {\n createdInVer: string;\n updatedInVer: string;\n targetBranch: string;\n labels?: string[];\n}\n\nexport interface PrBodyStruct {\n hash: string;\n rawConfigHash?: string;\n rebaseRequested?: boolean;\n debugData?: PrDebugData;\n}\n\n/**\n *\n */\nexport interface Pr {\n bodyStruct?: PrBodyStruct;\n sourceBranch: string;\n cannotMergeReason?: string; // for reflecting platform policies which may prevent merging\n createdAt?: string;\n closedAt?: string;\n hasAssignees?: boolean;\n labels?: string[];\n number: number;\n reviewers?: string[];\n sha?: LongCommitSha;\n sourceRepo?: string;\n state: string;\n targetBranch?: string;\n title: string;\n isDraft?: boolean;\n}\n\n/**\n * TODO: Proper typing\n */\nexport interface Issue {\n body?: string;\n number?: number;\n state?: string;\n title?: string;\n}\nexport interface PlatformPrOptions {\n autoApprove?: boolean;\n automergeStrategy?: MergeStrategy;\n azureWorkItemId?: number;\n bbUseDefaultReviewers?: boolean;\n bbAutoResolvePrTasks?: boolean;\n gitLabIgnoreApprovals?: boolean;\n usePlatformAutomerge?: boolean;\n forkModeDisallowMaintainerEdits?: boolean;\n}\n\nexport interface CreatePRConfig {\n sourceBranch: string;\n targetBranch: string;\n prTitle: string;\n prBody: string;\n labels?: string[] | null;\n platformPrOptions?: PlatformPrOptions;\n draftPR?: boolean;\n milestone?: number;\n}\nexport interface UpdatePrConfig {\n number: number;\n platformPrOptions?: PlatformPrOptions;\n prTitle: string;\n prBody?: string;\n state?: 'open' | 'closed';\n targetBranch?: string;\n\n /**\n * This field allows for label management and is designed to\n * accommodate the different label update methods on various platforms.\n *\n * - For Gitea, labels are updated by replacing the entire labels array.\n * - In the case of GitHub and GitLab, specific endpoints exist\n * for adding and removing labels.\n */\n labels?: string[] | null;\n\n /**\n * Specifies an array of labels to be added.\n * @see {@link labels}\n */\n addLabels?: string[] | null;\n\n /**\n * Specifies an array of labels to be removed.\n * @see {@link labels}\n */\n removeLabels?: string[] | null;\n}\nexport interface ReattemptPlatformAutomergeConfig {\n number: number;\n platformPrOptions?: PlatformPrOptions;\n}\nexport interface EnsureIssueConfig {\n title: string;\n reuseTitle?: string;\n body: string;\n labels?: string[];\n once?: boolean;\n shouldReOpen?: boolean;\n confidential?: boolean;\n}\nexport interface BranchStatusConfig {\n branchName: string;\n context: string;\n description: string;\n state: BranchStatus;\n url?: string;\n}\nexport interface FindPRConfig {\n branchName: string;\n prTitle?: string | null;\n state?: 'open' | 'closed' | '!open' | 'all';\n refreshCache?: boolean;\n targetBranch?: string | null;\n includeOtherAuthors?: boolean;\n}\nexport interface MergePRConfig {\n branchName?: string;\n id: number;\n strategy?: MergeStrategy;\n}\nexport interface EnsureCommentConfig {\n number: number;\n topic: string | null;\n content: string;\n}\n\nexport interface EnsureCommentRemovalConfigByTopic {\n type: 'by-topic';\n number: number;\n topic: string;\n}\nexport interface EnsureCommentRemovalConfigByContent {\n type: 'by-content';\n number: number;\n content: string;\n}\nexport type EnsureCommentRemovalConfig =\n | EnsureCommentRemovalConfigByTopic\n | EnsureCommentRemovalConfigByContent;\n\nexport type EnsureIssueResult = 'updated' | 'created';\n\nexport type RepoSortMethod =\n | 'alpha'\n | 'created'\n | 'updated'\n | 'size'\n | 'id'\n | null;\n\nexport type SortMethod = 'asc' | 'desc' | null;\nexport interface AutodiscoverConfig {\n topics?: string[];\n sort?: RepoSortMethod;\n order?: SortMethod;\n includeMirrors?: boolean;\n namespaces?: string[];\n projects?: string[];\n}\n\nexport interface FileOwnerRule {\n usernames: string[];\n pattern: string;\n score: number;\n match: (path: string) => boolean;\n}\n\nexport interface Platform {\n findIssue(title: string): Promise<Issue | null>;\n getIssueList(): Promise<Issue[]>;\n getIssue?(number: number, memCache?: boolean): Promise<Issue | null>;\n getVulnerabilityAlerts?(): Promise<VulnerabilityAlert[]>;\n getRawFile(\n fileName: string,\n repoName?: string,\n branchOrTag?: string,\n ): Promise<string | null>;\n getJsonFile(\n fileName: string,\n repoName?: string,\n branchOrTag?: string,\n ): Promise<any>;\n initRepo(config: RepoParams): Promise<RepoResult>;\n getPrList(): Promise<Pr[]>;\n ensureIssueClosing(title: string): Promise<void>;\n ensureIssue(\n issueConfig: EnsureIssueConfig,\n ): Promise<EnsureIssueResult | null>;\n massageMarkdown(prBody: string): string;\n updatePr(prConfig: UpdatePrConfig): Promise<void>;\n mergePr(config: MergePRConfig): Promise<boolean>;\n addReviewers(number: number, reviewers: string[]): Promise<void>;\n addAssignees(number: number, assignees: string[]): Promise<void>;\n createPr(prConfig: CreatePRConfig): Promise<Pr | null>;\n getRepos(config?: AutodiscoverConfig): Promise<string[]>;\n getBranchForceRebase?(branchName: string): Promise<boolean>;\n deleteLabel(number: number, label: string): Promise<void>;\n addLabel?(number: number, label: string): Promise<void>;\n setBranchStatus(branchStatusConfig: BranchStatusConfig): Promise<void>;\n getBranchStatusCheck(\n branchName: string,\n // TODO: can be undefined or null ? #22198\n context: string | null | undefined,\n ): Promise<BranchStatus | null>;\n ensureCommentRemoval(\n ensureCommentRemoval:\n | EnsureCommentRemovalConfigByTopic\n | EnsureCommentRemovalConfigByContent,\n ): Promise<void>;\n ensureComment(ensureComment: EnsureCommentConfig): Promise<boolean>;\n getPr(number: number): Promise<Pr | null>;\n findPr(findPRConfig: FindPRConfig): Promise<Pr | null>;\n refreshPr?(number: number): Promise<void>;\n reattemptPlatformAutomerge?(\n prConfig: ReattemptPlatformAutomergeConfig,\n ): Promise<void>;\n getBranchStatus(\n branchName: string,\n internalChecksAsSuccess: boolean,\n ): Promise<BranchStatus>;\n getBranchPr(branchName: string, targetBranch?: string): Promise<Pr | null>;\n tryReuseAutoclosedPr?(pr: Pr): Promise<Pr | null>;\n initPlatform(config: PlatformParams): Promise<PlatformResult>;\n filterUnavailableUsers?(users: string[]): Promise<string[]>;\n commitFiles?(config: CommitFilesConfig): Promise<LongCommitSha | null>;\n expandGroupMembers?(reviewersOrAssignees: string[]): Promise<string[]>;\n extractRulesFromCodeOwnersLines?(cleanedLines: string[]): FileOwnerRule[];\n\n maxBodyLength(): number;\n labelCharLimit?(): number;\n}\n\nexport interface PlatformScm {\n isBranchBehindBase(branchName: string, baseBranch: string): Promise<boolean>;\n isBranchModified(branchName: string, baseBranch: string): Promise<boolean>;\n isBranchConflicted(baseBranch: string, branch: string): Promise<boolean>;\n branchExists(branchName: string): Promise<boolean>;\n getBranchCommit(branchName: string): Promise<LongCommitSha | null>;\n deleteBranch(branchName: string): Promise<void>;\n commitAndPush(commitConfig: CommitFilesConfig): Promise<LongCommitSha | null>;\n getFileList(): Promise<string[]>;\n checkoutBranch(branchName: string): Promise<LongCommitSha>;\n mergeToLocal(branchName: string): Promise<void>;\n mergeAndPush(branchName: string): Promise<void>;\n syncForkWithUpstream?(baseBranch: string): Promise<void>;\n}\n"]}
|
@@ -23,6 +23,7 @@ const hermit = tslib_1.__importStar(require("./hermit"));
|
|
23
23
|
const hex = tslib_1.__importStar(require("./hex"));
|
24
24
|
const ivy = tslib_1.__importStar(require("./ivy"));
|
25
25
|
const kubernetesApi = tslib_1.__importStar(require("./kubernetes-api"));
|
26
|
+
const lambdaNode = tslib_1.__importStar(require("./lambda-node"));
|
26
27
|
const loose = tslib_1.__importStar(require("./loose"));
|
27
28
|
const maven = tslib_1.__importStar(require("./maven"));
|
28
29
|
const nixpkgs = tslib_1.__importStar(require("./nixpkgs"));
|
@@ -69,6 +70,7 @@ api.set(hermit.id, hermit.api);
|
|
69
70
|
api.set(hex.id, hex.api);
|
70
71
|
api.set(ivy.id, ivy.api);
|
71
72
|
api.set(kubernetesApi.id, kubernetesApi.api);
|
73
|
+
api.set(lambdaNode.id, lambdaNode.api);
|
72
74
|
api.set(loose.id, loose.api);
|
73
75
|
api.set(maven.id, maven.api);
|
74
76
|
api.set(nixpkgs.id, nixpkgs.api);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../lib/modules/versioning/api.ts"],"names":[],"mappings":";;;AAAA,qEAA+C;AAC/C,gFAA0D;AAC1D,uEAAiD;AACjD,oEAA8C;AAC9C,uDAAiC;AACjC,6DAAuC;AACvC,uDAAiC;AACjC,uDAAiC;AACjC,mDAA6B;AAC7B,yDAAmC;AACnC,yDAAmC;AACnC,yDAAmC;AACnC,mDAA6B;AAC7B,+DAAyC;AACzC,2EAAqD;AACrD,yDAAmC;AACnC,+DAAyC;AACzC,qDAA+B;AAC/B,yDAAmC;AACnC,mDAA6B;AAC7B,mDAA6B;AAC7B,wEAAkD;AAClD,uDAAiC;AACjC,uDAAiC;AACjC,2DAAqC;AACrC,qDAA+B;AAC/B,mDAA6B;AAC7B,uDAAiC;AACjC,yDAAmC;AACnC,qDAA+B;AAC/B,yDAAmC;AACnC,mDAA6B;AAC7B,yDAAmC;AACnC,yDAAmC;AACnC,uDAAiC;AACjC,mDAA6B;AAC7B,mDAA6B;AAC7B,qDAA+B;AAC/B,gEAA0C;AAC1C,yDAAmC;AACnC,wEAAkD;AAClD,uDAAiC;AAEjC,yDAAmC;AACnC,2DAAqC;AAErC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAoD,CAAC;AACxE,kBAAe,GAAG,CAAC;AAEnB,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;AACzC,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,EAAE,kBAAkB,CAAC,GAAG,CAAC,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C,CAAC;AAC/B,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;AACzB,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AAC/B,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AAC/B,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;AAC7B,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;AACzB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;AACzB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;AACrC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AAC/B,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;AAC7C,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;AAC7B,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AAC/B,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC","sourcesContent":["import * as awsEksAddon from './aws-eks-addon';\nimport * as amazonMachineImage from './aws-machine-image';\nimport * as azureRestApi from './azure-rest-api';\nimport * as bazelModule from './bazel-module';\nimport * as cargo from './cargo';\nimport * as composer from './composer';\nimport * as conan from './conan';\nimport * as conda from './conda';\nimport * as deb from './deb';\nimport * as debian from './debian';\nimport * as devbox from './devbox';\nimport * as docker from './docker';\nimport * as git from './git';\nimport * as glasskube from './glasskube';\nimport * as goModDirective from './go-mod-directive';\nimport * as gradle from './gradle';\nimport * as hashicorp from './hashicorp';\nimport * as helm from './helm';\nimport * as hermit from './hermit';\nimport * as hex from './hex';\nimport * as ivy from './ivy';\nimport * as kubernetesApi from './kubernetes-api';\nimport * as loose from './loose';\nimport * as maven from './maven';\nimport * as nixpkgs from './nixpkgs';\nimport * as node from './node';\nimport * as npm from './npm';\nimport * as nuget from './nuget';\nimport * as pep440 from './pep440';\nimport * as perl from './perl';\nimport * as poetry from './poetry';\nimport * as pvp from './pvp';\nimport * as python from './python';\nimport * as redhat from './redhat';\nimport * as regex from './regex';\nimport * as rez from './rez';\nimport * as rpm from './rpm';\nimport * as ruby from './ruby';\nimport * as sameMajor from './same-major';\nimport * as semver from './semver';\nimport * as semverCoerced from './semver-coerced';\nimport * as swift from './swift';\nimport type { VersioningApi, VersioningApiConstructor } from './types';\nimport * as ubuntu from './ubuntu';\nimport * as unity3d from './unity3d';\n\nconst api = new Map<string, VersioningApi | VersioningApiConstructor>();\nexport default api;\n\napi.set(awsEksAddon.id, awsEksAddon.api);\napi.set(amazonMachineImage.id, amazonMachineImage.api);\napi.set(azureRestApi.id, azureRestApi.api);\napi.set(bazelModule.id, bazelModule.api);\napi.set(cargo.id, cargo.api);\napi.set(composer.id, composer.api);\napi.set(conan.id, conan.api);\napi.set(conda.id, conda.api);\napi.set(deb.id, deb.api);\napi.set(debian.id, debian.api);\napi.set(devbox.id, devbox.api);\napi.set(docker.id, docker.api);\napi.set(git.id, git.api);\napi.set(glasskube.id, glasskube.api);\napi.set(goModDirective.id, goModDirective.api);\napi.set(gradle.id, gradle.api);\napi.set(hashicorp.id, hashicorp.api);\napi.set(helm.id, helm.api);\napi.set(hermit.id, hermit.api);\napi.set(hex.id, hex.api);\napi.set(ivy.id, ivy.api);\napi.set(kubernetesApi.id, kubernetesApi.api);\napi.set(loose.id, loose.api);\napi.set(maven.id, maven.api);\napi.set(nixpkgs.id, nixpkgs.api);\napi.set(node.id, node.api);\napi.set(npm.id, npm.api);\napi.set(nuget.id, nuget.api);\napi.set(pep440.id, pep440.api);\napi.set(perl.id, perl.api);\napi.set(poetry.id, poetry.api);\napi.set(pvp.id, pvp.api);\napi.set(python.id, python.api);\napi.set(redhat.id, redhat.api);\napi.set(regex.id, regex.api);\napi.set(rez.id, rez.api);\napi.set(rpm.id, rpm.api);\napi.set(ruby.id, ruby.api);\napi.set(sameMajor.id, sameMajor.api);\napi.set(semver.id, semver.api);\napi.set(semverCoerced.id, semverCoerced.api);\napi.set(swift.id, swift.api);\napi.set(ubuntu.id, ubuntu.api);\napi.set(unity3d.id, unity3d.api);\n"]}
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../lib/modules/versioning/api.ts"],"names":[],"mappings":";;;AAAA,qEAA+C;AAC/C,gFAA0D;AAC1D,uEAAiD;AACjD,oEAA8C;AAC9C,uDAAiC;AACjC,6DAAuC;AACvC,uDAAiC;AACjC,uDAAiC;AACjC,mDAA6B;AAC7B,yDAAmC;AACnC,yDAAmC;AACnC,yDAAmC;AACnC,mDAA6B;AAC7B,+DAAyC;AACzC,2EAAqD;AACrD,yDAAmC;AACnC,+DAAyC;AACzC,qDAA+B;AAC/B,yDAAmC;AACnC,mDAA6B;AAC7B,mDAA6B;AAC7B,wEAAkD;AAClD,kEAA4C;AAC5C,uDAAiC;AACjC,uDAAiC;AACjC,2DAAqC;AACrC,qDAA+B;AAC/B,mDAA6B;AAC7B,uDAAiC;AACjC,yDAAmC;AACnC,qDAA+B;AAC/B,yDAAmC;AACnC,mDAA6B;AAC7B,yDAAmC;AACnC,yDAAmC;AACnC,uDAAiC;AACjC,mDAA6B;AAC7B,mDAA6B;AAC7B,qDAA+B;AAC/B,gEAA0C;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Aa,CAAC,GAAG,CAAC,CAAC;AAC7C,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;AAC7B,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AAC/B,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC","sourcesContent":["import * as awsEksAddon from './aws-eks-addon';\nimport * as amazonMachineImage from './aws-machine-image';\nimport * as azureRestApi from './azure-rest-api';\nimport * as bazelModule from './bazel-module';\nimport * as cargo from './cargo';\nimport * as composer from './composer';\nimport * as conan from './conan';\nimport * as conda from './conda';\nimport * as deb from './deb';\nimport * as debian from './debian';\nimport * as devbox from './devbox';\nimport * as docker from './docker';\nimport * as git from './git';\nimport * as glasskube from './glasskube';\nimport * as goModDirective from './go-mod-directive';\nimport * as gradle from './gradle';\nimport * as hashicorp from './hashicorp';\nimport * as helm from './helm';\nimport * as hermit from './hermit';\nimport * as hex from './hex';\nimport * as ivy from './ivy';\nimport * as kubernetesApi from './kubernetes-api';\nimport * as lambdaNode from './lambda-node';\nimport * as loose from './loose';\nimport * as maven from './maven';\nimport * as nixpkgs from './nixpkgs';\nimport * as node from './node';\nimport * as npm from './npm';\nimport * as nuget from './nuget';\nimport * as pep440 from './pep440';\nimport * as perl from './perl';\nimport * as poetry from './poetry';\nimport * as pvp from './pvp';\nimport * as python from './python';\nimport * as redhat from './redhat';\nimport * as regex from './regex';\nimport * as rez from './rez';\nimport * as rpm from './rpm';\nimport * as ruby from './ruby';\nimport * as sameMajor from './same-major';\nimport * as semver from './semver';\nimport * as semverCoerced from './semver-coerced';\nimport * as swift from './swift';\nimport type { VersioningApi, VersioningApiConstructor } from './types';\nimport * as ubuntu from './ubuntu';\nimport * as unity3d from './unity3d';\n\nconst api = new Map<string, VersioningApi | VersioningApiConstructor>();\nexport default api;\n\napi.set(awsEksAddon.id, awsEksAddon.api);\napi.set(amazonMachineImage.id, amazonMachineImage.api);\napi.set(azureRestApi.id, azureRestApi.api);\napi.set(bazelModule.id, bazelModule.api);\napi.set(cargo.id, cargo.api);\napi.set(composer.id, composer.api);\napi.set(conan.id, conan.api);\napi.set(conda.id, conda.api);\napi.set(deb.id, deb.api);\napi.set(debian.id, debian.api);\napi.set(devbox.id, devbox.api);\napi.set(docker.id, docker.api);\napi.set(git.id, git.api);\napi.set(glasskube.id, glasskube.api);\napi.set(goModDirective.id, goModDirective.api);\napi.set(gradle.id, gradle.api);\napi.set(hashicorp.id, hashicorp.api);\napi.set(helm.id, helm.api);\napi.set(hermit.id, hermit.api);\napi.set(hex.id, hex.api);\napi.set(ivy.id, ivy.api);\napi.set(kubernetesApi.id, kubernetesApi.api);\napi.set(lambdaNode.id, lambdaNode.api);\napi.set(loose.id, loose.api);\napi.set(maven.id, maven.api);\napi.set(nixpkgs.id, nixpkgs.api);\napi.set(node.id, node.api);\napi.set(npm.id, npm.api);\napi.set(nuget.id, nuget.api);\napi.set(pep440.id, pep440.api);\napi.set(perl.id, perl.api);\napi.set(poetry.id, poetry.api);\napi.set(pvp.id, pvp.api);\napi.set(python.id, python.api);\napi.set(redhat.id, redhat.api);\napi.set(regex.id, regex.api);\napi.set(rez.id, rez.api);\napi.set(rpm.id, rpm.api);\napi.set(ruby.id, ruby.api);\napi.set(sameMajor.id, sameMajor.api);\napi.set(semver.id, semver.api);\napi.set(semverCoerced.id, semverCoerced.api);\napi.set(swift.id, swift.api);\napi.set(ubuntu.id, ubuntu.api);\napi.set(unity3d.id, unity3d.api);\n"]}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.api = exports.isValid = exports.supportedRangeStrategies = exports.supportsRanges = exports.urls = exports.displayName = exports.id = void 0;
|
4
|
+
const semver_1 = require("semver");
|
5
|
+
const semver_stable_1 = require("semver-stable");
|
4
6
|
const logger_1 = require("../../../logger");
|
5
7
|
const regex_1 = require("../../../util/regex");
|
6
8
|
const npm_1 = require("../npm");
|
@@ -116,9 +118,27 @@ function getNewValue({ currentValue, rangeStrategy, currentVersion, newVersion,
|
|
116
118
|
}
|
117
119
|
return newCargo;
|
118
120
|
}
|
121
|
+
function isBreaking(current, version) {
|
122
|
+
// The change may be breaking if either version is unstable
|
123
|
+
if (!(0, semver_stable_1.is)(version) || !(0, semver_stable_1.is)(current)) {
|
124
|
+
return true;
|
125
|
+
}
|
126
|
+
const currentMajor = (0, semver_1.major)(current);
|
127
|
+
if (currentMajor === 0) {
|
128
|
+
if ((0, semver_1.minor)(current) === 0) {
|
129
|
+
// This can only be non-breaking if they're the same version
|
130
|
+
return current !== version;
|
131
|
+
}
|
132
|
+
// v0.x updates are breaking if x changes
|
133
|
+
return (0, semver_1.minor)(current) !== (0, semver_1.minor)(version);
|
134
|
+
}
|
135
|
+
// Otherwise, only major updates are breaking
|
136
|
+
return currentMajor !== (0, semver_1.major)(version);
|
137
|
+
}
|
119
138
|
exports.api = {
|
120
139
|
...npm_1.api,
|
121
140
|
getNewValue,
|
141
|
+
isBreaking,
|
122
142
|
isLessThanRange,
|
123
143
|
isSingleVersion,
|
124
144
|
isValid: exports.isValid,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/modules/versioning/cargo/index.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAEzC,+CAA4C;AAC5C,gCAAoC;AAGvB,QAAA,EAAE,GAAG,OAAO,CAAC;AACb,QAAA,WAAW,GAAG,OAAO,CAAC;AACtB,QAAA,IAAI,GAAG;IAClB,wEAAwE;CACzE,CAAC;AACW,QAAA,cAAc,GAAG,IAAI,CAAC;AACtB,QAAA,wBAAwB,GAAoB;IACvD,MAAM;IACN,KAAK;IACL,SAAS;CACV,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,SAAG,CA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,EAC3B,yCAAyC,CAC1C,CAAC;QACF,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,+CAA+C;IAC/C,IACE,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC9D,aAAa,KAAK,SAAS;QAC3B,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAC3D,CAAC;QACD,QAAQ,GAAG,QAAQ;aAChB,KAAK,CAAC,GAAG,CAAC;aACV,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;aACxC,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IACD,oCAAoC;IACpC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9D,MAAM,YAAY,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3C,mFAAmF;QACnF,yCAAyC;QACzC,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;QAClD,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAEY,QAAA,GAAG,GAAkB;IAChC,GAAG,SAAG;IACN,WAAW;IACX,eAAe;IACf,eAAe;IACf,OAAO,EAAP,eAAO;IACP,OAAO;IACP,oBAAoB;IACpB,oBAAoB;CACrB,CAAC;AACF,kBAAe,WAAG,CAAC","sourcesContent":["import { logger } from '../../../logger';\nimport type { RangeStrategy } from '../../../types/versioning';\nimport { regEx } from '../../../util/regex';\nimport { api as npm } from '../npm';\nimport type { NewValueConfig, VersioningApi } from '../types';\n\nexport const id = 'cargo';\nexport const displayName = 'Cargo';\nexport const urls = [\n 'https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html',\n];\nexport const supportsRanges = true;\nexport const supportedRangeStrategies: RangeStrategy[] = [\n 'bump',\n 'pin',\n 'replace',\n];\n\nconst isVersion = (input: string): boolean => npm.isVersion(input);\n\nfunction convertToCaret(item: string): string {\n // In Cargo, caret versions are used by default, so \"1.2.3\" actually means ^1.2.3.\n // Similarly, \"0.4\" actually means ^0.4.\n // See: https://doc.rust-lang.org/stable/cargo/reference/specifying-dependencies.html#caret-requirements\n if (isVersion(item) || isVersion(item + '.0') || isVersion(item + '.0.0')) {\n return '^' + item.trim();\n }\n return item.trim();\n}\n\nfunction cargo2npm(input: string): string {\n let versions = input.split(',');\n versions = versions.map(convertToCaret);\n return versions.join(' ');\n}\n\nfunction notEmpty(s: string): boolean {\n return s !== '';\n}\n\nfunction npm2cargo(input: string): string {\n // istanbul ignore if\n if (!input) {\n return input;\n }\n // Note: this doesn't remove the ^\n const res = input\n .split(regEx(/\\s+,?\\s*|\\s*,?\\s+/))\n .map((str) => str.trim())\n .filter(notEmpty);\n const operators = ['^', '~', '=', '>', '<', '<=', '>='];\n for (let i = 0; i < res.length - 1; i += 1) {\n if (operators.includes(res[i])) {\n const newValue = res[i] + ' ' + res[i + 1];\n res.splice(i, 2, newValue);\n }\n }\n return res.join(', ');\n}\n\nconst isLessThanRange = (version: string, range: string): boolean =>\n !!npm.isLessThanRange?.(version, cargo2npm(range));\n\nexport const isValid = (input: string): boolean =>\n npm.isValid(cargo2npm(input));\n\nconst matches = (version: string, range: string): boolean =>\n npm.matches(version, cargo2npm(range));\n\nfunction getSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return npm.getSatisfyingVersion(versions, cargo2npm(range));\n}\n\nfunction minSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return npm.minSatisfyingVersion(versions, cargo2npm(range));\n}\n\nconst isSingleVersion = (constraint: string): boolean =>\n constraint.trim().startsWith('=') &&\n isVersion(constraint.trim().substring(1).trim());\n\nfunction getNewValue({\n currentValue,\n rangeStrategy,\n currentVersion,\n newVersion,\n}: NewValueConfig): string {\n if (!currentValue || currentValue === '*') {\n return rangeStrategy === 'pin' ? `=${newVersion}` : currentValue;\n }\n // If the current value is a simple version, bump to fully specified newVersion\n if (rangeStrategy === 'bump' && regEx(/^\\d+(?:\\.\\d+)*$/).test(currentValue)) {\n return newVersion;\n }\n if (rangeStrategy === 'pin' || isSingleVersion(currentValue)) {\n let res = '=';\n if (currentValue.startsWith('= ')) {\n res += ' ';\n }\n res += newVersion;\n return res;\n }\n if (rangeStrategy === 'replace' && matches(newVersion, currentValue)) {\n return currentValue;\n }\n const newSemver = npm.getNewValue({\n currentValue: cargo2npm(currentValue),\n rangeStrategy,\n currentVersion,\n newVersion,\n });\n let newCargo = newSemver\n ? npm2cargo(newSemver)\n : /* istanbul ignore next: should never happen */ null;\n // istanbul ignore if\n if (!newCargo) {\n logger.info(\n { currentValue, newSemver },\n 'Could not get cargo version from semver',\n );\n return currentValue;\n }\n // Keep new range precision the same as current\n if (\n (currentValue.startsWith('~') || currentValue.startsWith('^')) &&\n rangeStrategy === 'replace' &&\n newCargo.split('.').length > currentValue.split('.').length\n ) {\n newCargo = newCargo\n .split('.')\n .slice(0, currentValue.split('.').length)\n .join('.');\n }\n // Try to reverse any caret we added\n if (newCargo.startsWith('^') && !currentValue.startsWith('^')) {\n const withoutCaret = newCargo.substring(1);\n // NOTE: We want the number of components in the new version to match the original.\n // e.g. \"5.0\" should be updated to \"6.0\".\n const components = currentValue.split('.').length;\n newCargo = withoutCaret.split('.').slice(0, components).join('.');\n }\n\n return newCargo;\n}\n\nexport const api: VersioningApi = {\n ...npm,\n getNewValue,\n isLessThanRange,\n isSingleVersion,\n isValid,\n matches,\n getSatisfyingVersion,\n minSatisfyingVersion,\n};\nexport default api;\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/modules/versioning/cargo/index.ts"],"names":[],"mappings":";;;AAAA,mCAA8D;AAC9D,iDAA+C;AAC/C,4CAAyC;AAEzC,+CAA4C;AAC5C,gCAAoC;AAGvB,QAAA,EAAE,GAAG,OAAO,CAAC;AACb,QAAA,WAAW,GAAG,OAAO,CAAC;AACtB,QAAA,IAAI,GAAG;IAClB,wEAAwE;CACzE,CAAC;AACW,QAAA,cAAc,GAAG,IAAI,CAAC;AACtB,QAAA,wBAAwB,GAAoB;IACvD,MAAM;IACN,KAAK;IACL,SAAS;CACV,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,SAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAEnE,SAAS,cAAc,CAAC,IAAY;IAClC,kFAAkF;IAClF,wCAAwC;IACxC,wGAAwG;IACxG,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC;QAC1E,OAAO,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;AACrB,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACxC,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,QAAQ,CAAC,CAAS;IACzB,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,qBAAqB;IACrB,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KA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AY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;QAClD,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,UAAU,CAAC,OAAe,EAAE,OAAe;IAClD,2DAA2D;IAC3D,IAAI,CAAC,IAAA,kBAAQ,EAAC,OAAO,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,YAAY,GAAG,IAAA,cAAQ,EAAC,OAAO,CAAC,CAAC;IACvC,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QACvB,IAAI,IAAA,cAAQ,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,4DAA4D;YAC5D,OAAO,OAAO,KAAK,OAAO,CAAC;QAC7B,CAAC;QACD,yCAAyC;QACzC,OAAO,IAAA,cAAQ,EAAC,OAAO,CAAC,KAAK,IAAA,cAAQ,EAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IACD,6CAA6C;IAC7C,OAAO,YAAY,KAAK,IAAA,cAAQ,EAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AAEY,QAAA,GAAG,GAAkB;IAChC,GAAG,SAAG;IACN,WAAW;IACX,UAAU;IACV,eAAe;IACf,eAAe;IACf,OAAO,EAAP,eAAO;IACP,OAAO;IACP,oBAAoB;IACpB,oBAAoB;CACrB,CAAC;AACF,kBAAe,WAAG,CAAC","sourcesContent":["import { major as getMajor, minor as getMinor } from 'semver';\nimport { is as isStable } from 'semver-stable';\nimport { logger } from '../../../logger';\nimport type { RangeStrategy } from '../../../types/versioning';\nimport { regEx } from '../../../util/regex';\nimport { api as npm } from '../npm';\nimport type { NewValueConfig, VersioningApi } from '../types';\n\nexport const id = 'cargo';\nexport const displayName = 'Cargo';\nexport const urls = [\n 'https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html',\n];\nexport const supportsRanges = true;\nexport const supportedRangeStrategies: RangeStrategy[] = [\n 'bump',\n 'pin',\n 'replace',\n];\n\nconst isVersion = (input: string): boolean => npm.isVersion(input);\n\nfunction convertToCaret(item: string): string {\n // In Cargo, caret versions are used by default, so \"1.2.3\" actually means ^1.2.3.\n // Similarly, \"0.4\" actually means ^0.4.\n // See: https://doc.rust-lang.org/stable/cargo/reference/specifying-dependencies.html#caret-requirements\n if (isVersion(item) || isVersion(item + '.0') || isVersion(item + '.0.0')) {\n return '^' + item.trim();\n }\n return item.trim();\n}\n\nfunction cargo2npm(input: string): string {\n let versions = input.split(',');\n versions = versions.map(convertToCaret);\n return versions.join(' ');\n}\n\nfunction notEmpty(s: string): boolean {\n return s !== '';\n}\n\nfunction npm2cargo(input: string): string {\n // istanbul ignore if\n if (!input) {\n return input;\n }\n // Note: this doesn't remove the ^\n const res = input\n .split(regEx(/\\s+,?\\s*|\\s*,?\\s+/))\n .map((str) => str.trim())\n .filter(notEmpty);\n const operators = ['^', '~', '=', '>', '<', '<=', '>='];\n for (let i = 0; i < res.length - 1; i += 1) {\n if (operators.includes(res[i])) {\n const newValue = res[i] + ' ' + res[i + 1];\n res.splice(i, 2, newValue);\n }\n }\n return res.join(', ');\n}\n\nconst isLessThanRange = (version: string, range: string): boolean =>\n !!npm.isLessThanRange?.(version, cargo2npm(range));\n\nexport const isValid = (input: string): boolean =>\n npm.isValid(cargo2npm(input));\n\nconst matches = (version: string, range: string): boolean =>\n npm.matches(version, cargo2npm(range));\n\nfunction getSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return npm.getSatisfyingVersion(versions, cargo2npm(range));\n}\n\nfunction minSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return npm.minSatisfyingVersion(versions, cargo2npm(range));\n}\n\nconst isSingleVersion = (constraint: string): boolean =>\n constraint.trim().startsWith('=') &&\n isVersion(constraint.trim().substring(1).trim());\n\nfunction getNewValue({\n currentValue,\n rangeStrategy,\n currentVersion,\n newVersion,\n}: NewValueConfig): string {\n if (!currentValue || currentValue === '*') {\n return rangeStrategy === 'pin' ? `=${newVersion}` : currentValue;\n }\n // If the current value is a simple version, bump to fully specified newVersion\n if (rangeStrategy === 'bump' && regEx(/^\\d+(?:\\.\\d+)*$/).test(currentValue)) {\n return newVersion;\n }\n if (rangeStrategy === 'pin' || isSingleVersion(currentValue)) {\n let res = '=';\n if (currentValue.startsWith('= ')) {\n res += ' ';\n }\n res += newVersion;\n return res;\n }\n if (rangeStrategy === 'replace' && matches(newVersion, currentValue)) {\n return currentValue;\n }\n const newSemver = npm.getNewValue({\n currentValue: cargo2npm(currentValue),\n rangeStrategy,\n currentVersion,\n newVersion,\n });\n let newCargo = newSemver\n ? npm2cargo(newSemver)\n : /* istanbul ignore next: should never happen */ null;\n // istanbul ignore if\n if (!newCargo) {\n logger.info(\n { currentValue, newSemver },\n 'Could not get cargo version from semver',\n );\n return currentValue;\n }\n // Keep new range precision the same as current\n if (\n (currentValue.startsWith('~') || currentValue.startsWith('^')) &&\n rangeStrategy === 'replace' &&\n newCargo.split('.').length > currentValue.split('.').length\n ) {\n newCargo = newCargo\n .split('.')\n .slice(0, currentValue.split('.').length)\n .join('.');\n }\n // Try to reverse any caret we added\n if (newCargo.startsWith('^') && !currentValue.startsWith('^')) {\n const withoutCaret = newCargo.substring(1);\n // NOTE: We want the number of components in the new version to match the original.\n // e.g. \"5.0\" should be updated to \"6.0\".\n const components = currentValue.split('.').length;\n newCargo = withoutCaret.split('.').slice(0, components).join('.');\n }\n\n return newCargo;\n}\n\nfunction isBreaking(current: string, version: string): boolean {\n // The change may be breaking if either version is unstable\n if (!isStable(version) || !isStable(current)) {\n return true;\n }\n const currentMajor = getMajor(current);\n if (currentMajor === 0) {\n if (getMinor(current) === 0) {\n // This can only be non-breaking if they're the same version\n return current !== version;\n }\n // v0.x updates are breaking if x changes\n return getMinor(current) !== getMinor(version);\n }\n // Otherwise, only major updates are breaking\n return currentMajor !== getMajor(version);\n}\n\nexport const api: VersioningApi = {\n ...npm,\n getNewValue,\n isBreaking,\n isLessThanRange,\n isSingleVersion,\n isValid,\n matches,\n getSatisfyingVersion,\n minSatisfyingVersion,\n};\nexport default api;\n"]}
|
@@ -321,11 +321,15 @@ function sortVersions(a, b) {
|
|
321
321
|
function isCompatible(version) {
|
322
322
|
return isVersion(version);
|
323
323
|
}
|
324
|
+
function isBreaking(current, version) {
|
325
|
+
return npm_1.api.isBreaking(composer2npm(current), composer2npm(version));
|
326
|
+
}
|
324
327
|
exports.api = {
|
325
328
|
equals,
|
326
329
|
getMajor,
|
327
330
|
getMinor,
|
328
331
|
getPatch,
|
332
|
+
isBreaking,
|
329
333
|
isCompatible,
|
330
334
|
isGreaterThan,
|
331
335
|
isLessThanRange,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/modules/versioning/composer/index.ts"],"names":[],"mappings":";;;AAyMA,0BAEC;AAED,8BAEC;;AA/MD,kEAAkC;AAClC,4DAA4B;AAC5B,+CAA0C;AAC1C,4CAAyC;AAEzC,+CAA4C;AAC5C,gCAAoC;AAGvB,QAAA,EAAE,GAAG,UAAU,CAAC;AAChB,QAAA,WAAW,GAAG,UAAU,CAAC;AACzB,QAAA,IAAI,GAAG;IAClB,kDAAkD;IAClD,gDAAgD;IAChD,sDAAsD;IACtD,uBAAuB;CACxB,CAAC;AACW,QAAA,cAAc,GAAG,IAAI,CAAC;AACtB,QAAA,wBAAwB,GAAoB;IACvD,MAAM;IACN,OAAO;IACP,KAAK;IACL,SAAS;IACT,iBAAiB;CAClB,CAAC;AAEF,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,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CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport semver from 'semver';\nimport { parseRange } from 'semver-utils';\nimport { logger } from '../../../logger';\nimport type { RangeStrategy } from '../../../types/versioning';\nimport { regEx } from '../../../util/regex';\nimport { api as npm } from '../npm';\nimport type { NewValueConfig, VersioningApi } from '../types';\n\nexport const id = 'composer';\nexport const displayName = 'Composer';\nexport const urls = [\n 'https://getcomposer.org/doc/articles/versions.md',\n 'https://packagist.org/packages/composer/semver',\n 'https://madewithlove.be/tilde-and-caret-constraints/',\n 'https://semver.mwl.be',\n];\nexport const supportsRanges = true;\nexport const supportedRangeStrategies: RangeStrategy[] = [\n 'bump',\n 'widen',\n 'pin',\n 'replace',\n 'update-lockfile',\n];\n\nfunction getVersionParts(input: string): [string, string] {\n const versionParts = input.split('-');\n if (versionParts.length === 1) {\n return [input, ''];\n }\n\n return [versionParts[0], '-' + versionParts[1]];\n}\n\nfunction padZeroes(input: string): string {\n const [output, stability] = getVersionParts(input);\n\n const sections = output.split('.');\n while (sections.length < 3) {\n sections.push('0');\n }\n return sections.join('.') + stability;\n}\n\nfunction convertStabilityModifier(input: string): string {\n // Handle stability modifiers.\n const versionParts = input.split('@');\n if (versionParts.length === 1) {\n return input;\n }\n\n // 1.0@beta2 to 1.0-beta.2\n const stability = versionParts[1].replace(\n regEx(/(?:^|\\s)(beta|alpha|rc)([1-9][0-9]*)(?: |$)/gi),\n '$1.$2',\n );\n\n // If there is a stability part, npm semver expects the version\n // to be full\n return padZeroes(versionParts[0]) + '-' + stability;\n}\n\nfunction normalizeVersion(input: string): string {\n let output = input;\n output = output.replace(regEx(/(^|>|>=|\\^|~)v/i), '$1');\n return convertStabilityModifier(output);\n}\n\n/**\n * @param versions Version list in any format, it recognizes the specific patch format x.x.x-pXX\n * @param range Range in composer format\n * @param minMode If true, it will calculate minSatisfyingVersion, if false, it calculates the maxSatisfyingVersion\n * @returns min or max satisfyingVersion from the input\n */\nfunction calculateSatisfyingVersionIntenal(\n versions: string[],\n range: string,\n minMode: boolean,\n): string | null {\n // Because composer -p versions are considered stable, we have to remove the suffix for the npm.XXX functions.\n const versionsMapped = versions.map((x) => {\n return {\n origianl: x,\n cleaned: removeComposerSpecificPatchPart(x),\n npmVariant: composer2npm(removeComposerSpecificPatchPart(x)[0]),\n };\n });\n\n const npmVersions = versionsMapped.map((x) => x.npmVariant);\n const npmVersion = minMode\n ? npm.minSatisfyingVersion(npmVersions, composer2npm(range))\n : npm.getSatisfyingVersion(npmVersions, composer2npm(range));\n\n if (!npmVersion) {\n return null;\n }\n\n // After we find the npm versions, we select from them back in the mapping the possible patches.\n const candidates = versionsMapped\n .filter((x) => x.npmVariant === npmVersion)\n .sort((a, b) => (minMode ? 1 : -1) * sortVersions(a.origianl, b.origianl));\n\n return candidates[0].origianl;\n}\n\n/**\n * @param intput Version in any format, it recognizes the specific patch format x.x.x-pXX\n * @returns If input contains the specific patch, it returns the input with removed the patch and true, otherwise it retunrs the same string and false.\n */\nfunction removeComposerSpecificPatchPart(input: string): [string, boolean] {\n // the regex is based on the original from composer implementation https://github.com/composer/semver/blob/fa1ec24f0ab1efe642671ec15c51a3ab879f59bf/src/VersionParser.php#L137\n const pattern = /^v?\\d+(\\.\\d+(\\.\\d+(\\.\\d+)?)?)?(?<suffix>-p[1-9]\\d*)$/gi;\n const match = pattern.exec(input);\n\n return match\n ? [input.replace(match.groups!.suffix, ''), true]\n : [input, false];\n}\n\nfunction composer2npm(input: string): string {\n return input\n .split(regEx(/\\s*\\|\\|?\\s*/g))\n .map((part): string => {\n const cleanInput = normalizeVersion(part);\n if (npm.isVersion(cleanInput)) {\n return cleanInput;\n }\n if (npm.isVersion(padZeroes(cleanInput))) {\n return padZeroes(cleanInput);\n }\n const [versionId, stability] = getVersionParts(cleanInput);\n let output = versionId;\n\n // ~4 to ^4 and ~4.1 to ^4.1\n output = output.replace(\n regEx(/(?:^|\\s)~([1-9][0-9]*(?:\\.[0-9]*)?)(?: |$)/g),\n '^$1',\n );\n // ~0.4 to >=0.4 <1\n output = output.replace(\n regEx(/(?:^|\\s)~(0\\.[1-9][0-9]*)(?: |$)/g),\n '>=$1 <1',\n );\n\n // add extra digits to <8-DEV and <8.0-DEV\n output = output\n .replace(regEx(/^(<\\d+(\\.\\d+)?)$/g), '$1.0')\n .replace(regEx(/^(<\\d+(\\.\\d+)?)$/g), '$1.0');\n\n return output + stability;\n })\n .map((part) => part.replace(/([a-z])([0-9])/gi, '$1.$2'))\n .join(' || ');\n}\n\nfunction equals(a: string, b: string): boolean {\n return npm.equals(composer2npm(a), composer2npm(b));\n}\n\nfunction getMajor(version: string): number | null {\n const semverVersion = semver.coerce(composer2npm(version));\n return semverVersion ? npm.getMajor(semverVersion) : null;\n}\n\nfunction getMinor(version: string): number | null {\n const semverVersion = semver.coerce(composer2npm(version));\n return semverVersion ? npm.getMinor(semverVersion) : null;\n}\n\nfunction getPatch(version: string): number | null {\n const semverVersion = semver.coerce(composer2npm(version));\n\n // This returns only the numbers without the optional `-pXX` patch version supported by composer. Fixing that would require a bigger\n // refactoring, because the API supports only numbers.\n return semverVersion ? npm.getPatch(semverVersion) : null;\n}\n\nfunction isGreaterThan(a: string, b: string): boolean {\n return sortVersions(a, b) === 1;\n}\n\nfunction isLessThanRange(version: string, range: string): boolean {\n return !!npm.isLessThanRange?.(composer2npm(version), composer2npm(range));\n}\n\nfunction isSingleVersion(input: string): boolean {\n return !!input && npm.isSingleVersion(composer2npm(input));\n}\n\nfunction isStable(version: string): boolean {\n if (version) {\n // Composer considers patches `-pXX` as stable: https://github.com/composer/semver/blob/fa1ec24f0ab1efe642671ec15c51a3ab879f59bf/src/VersionParser.php#L568 but npm not.\n // In order to be able to use the standard npm.isStable function, we remove the potential patch version for the check.\n const [withoutPatch] = removeComposerSpecificPatchPart(version);\n return npm.isStable(composer2npm(withoutPatch));\n }\n\n return false;\n}\n\nexport function isValid(input: string): boolean {\n return !!input && npm.isValid(composer2npm(input));\n}\n\nexport function isVersion(input: string): boolean {\n return !!input && npm.isVersion(composer2npm(input));\n}\n\nfunction matches(version: string, range: string): boolean {\n return npm.matches(composer2npm(version), composer2npm(range));\n}\n\nfunction getSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return calculateSatisfyingVersionIntenal(versions, range, false);\n}\n\nfunction minSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return calculateSatisfyingVersionIntenal(versions, range, true);\n}\n\nfunction subset(subRange: string, superRange: string): boolean | undefined {\n try {\n return npm.subset!(composer2npm(subRange), composer2npm(superRange));\n } catch (err) {\n logger.trace({ err }, 'composer.subset error');\n return false;\n }\n}\n\nfunction intersects(subRange: string, superRange: string): boolean {\n try {\n return npm.intersects!(composer2npm(subRange), composer2npm(superRange));\n } catch (err) {\n logger.trace({ err }, 'composer.intersects error');\n return false;\n }\n}\n\nfunction getNewValue({\n currentValue,\n rangeStrategy,\n currentVersion,\n newVersion,\n}: NewValueConfig): string | null {\n if (rangeStrategy === 'pin') {\n return newVersion;\n }\n if (rangeStrategy === 'update-lockfile') {\n if (matches(newVersion, currentValue)) {\n return currentValue;\n }\n return getNewValue({\n currentValue,\n rangeStrategy: 'replace',\n currentVersion,\n newVersion,\n });\n }\n const currentMajor = currentVersion ? getMajor(currentVersion) : null;\n const toMajor = getMajor(newVersion);\n const toMinor = getMinor(newVersion);\n let newValue: string | null = null;\n if (isVersion(currentValue)) {\n newValue = newVersion;\n } else if (regEx(/^[~^](0\\.[1-9][0-9]*)$/).test(currentValue)) {\n const operator = currentValue.substring(0, 1);\n // handle ~0.4 case first\n if (toMajor === 0) {\n // TODO: types (#22198)\n newValue = `${operator}0.${toMinor!}`;\n } else {\n // TODO: types (#22198)\n newValue = `${operator}${toMajor!}.0`;\n }\n } else if (regEx(/^[~^]([0-9]*)$/).test(currentValue)) {\n // handle ~4 case\n const operator = currentValue.substring(0, 1);\n // TODO: types (#22198)\n newValue = `${operator}${toMajor!}`;\n } else if (\n toMajor &&\n regEx(/^[~^]([0-9]*(?:\\.[0-9]*)?)$/).test(currentValue)\n ) {\n const operator = currentValue.substring(0, 1);\n if (rangeStrategy === 'bump') {\n newValue = `${operator}${newVersion}`;\n } else if (\n (is.number(currentMajor) && toMajor > currentMajor) ||\n !toMinor\n ) {\n // handle ~4.1 case\n newValue = `${operator}${toMajor}.0`;\n } else {\n newValue = `${operator}${toMajor}.${toMinor}`;\n }\n } else if (\n currentVersion &&\n npm.isVersion(padZeroes(normalizeVersion(newVersion))) &&\n npm.isValid(normalizeVersion(currentValue)) &&\n composer2npm(currentValue) === normalizeVersion(currentValue)\n ) {\n newValue = npm.getNewValue({\n currentValue: normalizeVersion(currentValue),\n rangeStrategy,\n currentVersion: padZeroes(normalizeVersion(currentVersion)),\n newVersion: padZeroes(normalizeVersion(newVersion)),\n });\n }\n\n if (rangeStrategy === 'widen' && matches(newVersion, currentValue)) {\n newValue = currentValue;\n } else {\n const hasOr = currentValue.includes(' || ');\n if (hasOr || rangeStrategy === 'widen') {\n const splitValues = currentValue.split('||');\n const lastValue = splitValues[splitValues.length - 1];\n const replacementValue = getNewValue({\n currentValue: lastValue.trim(),\n rangeStrategy: 'replace',\n currentVersion,\n newVersion,\n });\n if (rangeStrategy === 'replace') {\n newValue = replacementValue;\n } else if (replacementValue) {\n const parsedRange = parseRange(replacementValue);\n const element = parsedRange[parsedRange.length - 1];\n if (element.operator?.startsWith('<')) {\n const splitCurrent = currentValue.split(element.operator);\n splitCurrent.pop();\n newValue = splitCurrent.join(element.operator) + replacementValue;\n } else {\n newValue = currentValue + ' || ' + replacementValue;\n }\n }\n }\n }\n\n if (!newValue) {\n logger.warn(\n { currentValue, rangeStrategy, currentVersion, newVersion },\n 'Unsupported composer value',\n );\n newValue = newVersion;\n }\n if (currentValue.split('.')[0].includes('v')) {\n newValue = newValue.replace(regEx(/([0-9])/), 'v$1');\n }\n\n // Preserve original min-stability specifier\n if (currentValue.includes('@')) {\n newValue += '@' + currentValue.split('@')[1];\n }\n\n return newValue;\n}\n\nfunction sortVersions(a: string, b: string): number {\n const [aWithoutPatch, aContainsPatch] = removeComposerSpecificPatchPart(a);\n const [bWithoutPatch, bContainsPatch] = removeComposerSpecificPatchPart(b);\n\n if (aContainsPatch === bContainsPatch) {\n // If both [a and b] contain patch version or both [a and b] do not contain patch version, then npm comparison deliveres correct results\n return npm.sortVersions(composer2npm(a), composer2npm(b));\n } else if (\n npm.equals(composer2npm(aWithoutPatch), composer2npm(bWithoutPatch))\n ) {\n // If only one [a or b] contains patch version and the parts without patch versions are equal, then the version with patch is greater (this is the case where npm comparison fails)\n return aContainsPatch ? 1 : -1;\n } else {\n // All other cases can be compared correctly by npm\n return npm.sortVersions(composer2npm(a), composer2npm(b));\n }\n}\n\nfunction isCompatible(version: string): boolean {\n return isVersion(version);\n}\n\nexport const api: VersioningApi = {\n equals,\n getMajor,\n getMinor,\n getPatch,\n isCompatible,\n isGreaterThan,\n isLessThanRange,\n isSingleVersion,\n isStable,\n isValid,\n isVersion,\n matches,\n getSatisfyingVersion,\n minSatisfyingVersion,\n getNewValue,\n sortVersions,\n subset,\n intersects,\n};\nexport default api;\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/modules/versioning/composer/index.ts"],"names":[],"mappings":";;;AAyMA,0BAEC;AAED,8BAEC;;AA/MD,kEAAkC;AAClC,4DAA4B;AAC5B,+CAA0C;AAC1C,4CAAyC;AAEzC,+CAA4C;AAC5C,gCAAoC;AAGvB,QAAA,EAAE,GAAG,UAAU,CAAC;AAChB,QAAA,WAAW,GAAG,UAAU,CAAC;AACzB,QAAA,IAAI,GAAG;IAClB,kDAAkD;IAClD,gDAAgD;IAChD,sDAAsD;IACtD,uBAAuB;CACxB,CAAC;AACW,QAAA,cAAc,GAAG,IAAI,CAAC;AACtB,QAAA,wBAAwB,GAAoB;IACvD,MAAM;IACN,OAAO;IACP,KAAK;IACL,SAAS;IACT,iBAAiB;CAClB,CAAC;AAEF,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,YAAY,GAAG,KAAK,CAA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M;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,aAAa;IACb,eAAe;IACf,eAAe;IACf,QAAQ;IACR,OAAO;IACP,SAAS;IACT,OAAO;IACP,oBAAoB;IACpB,oBAAoB;IACpB,WAAW;IACX,YAAY;IACZ,MAAM;IACN,UAAU;CACX,CAAC;AACF,kBAAe,WAAG,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport semver from 'semver';\nimport { parseRange } from 'semver-utils';\nimport { logger } from '../../../logger';\nimport type { RangeStrategy } from '../../../types/versioning';\nimport { regEx } from '../../../util/regex';\nimport { api as npm } from '../npm';\nimport type { NewValueConfig, VersioningApi } from '../types';\n\nexport const id = 'composer';\nexport const displayName = 'Composer';\nexport const urls = [\n 'https://getcomposer.org/doc/articles/versions.md',\n 'https://packagist.org/packages/composer/semver',\n 'https://madewithlove.be/tilde-and-caret-constraints/',\n 'https://semver.mwl.be',\n];\nexport const supportsRanges = true;\nexport const supportedRangeStrategies: RangeStrategy[] = [\n 'bump',\n 'widen',\n 'pin',\n 'replace',\n 'update-lockfile',\n];\n\nfunction getVersionParts(input: string): [string, string] {\n const versionParts = input.split('-');\n if (versionParts.length === 1) {\n return [input, ''];\n }\n\n return [versionParts[0], '-' + versionParts[1]];\n}\n\nfunction padZeroes(input: string): string {\n const [output, stability] = getVersionParts(input);\n\n const sections = output.split('.');\n while (sections.length < 3) {\n sections.push('0');\n }\n return sections.join('.') + stability;\n}\n\nfunction convertStabilityModifier(input: string): string {\n // Handle stability modifiers.\n const versionParts = input.split('@');\n if (versionParts.length === 1) {\n return input;\n }\n\n // 1.0@beta2 to 1.0-beta.2\n const stability = versionParts[1].replace(\n regEx(/(?:^|\\s)(beta|alpha|rc)([1-9][0-9]*)(?: |$)/gi),\n '$1.$2',\n );\n\n // If there is a stability part, npm semver expects the version\n // to be full\n return padZeroes(versionParts[0]) + '-' + stability;\n}\n\nfunction normalizeVersion(input: string): string {\n let output = input;\n output = output.replace(regEx(/(^|>|>=|\\^|~)v/i), '$1');\n return convertStabilityModifier(output);\n}\n\n/**\n * @param versions Version list in any format, it recognizes the specific patch format x.x.x-pXX\n * @param range Range in composer format\n * @param minMode If true, it will calculate minSatisfyingVersion, if false, it calculates the maxSatisfyingVersion\n * @returns min or max satisfyingVersion from the input\n */\nfunction calculateSatisfyingVersionIntenal(\n versions: string[],\n range: string,\n minMode: boolean,\n): string | null {\n // Because composer -p versions are considered stable, we have to remove the suffix for the npm.XXX functions.\n const versionsMapped = versions.map((x) => {\n return {\n origianl: x,\n cleaned: removeComposerSpecificPatchPart(x),\n npmVariant: composer2npm(removeComposerSpecificPatchPart(x)[0]),\n };\n });\n\n const npmVersions = versionsMapped.map((x) => x.npmVariant);\n const npmVersion = minMode\n ? npm.minSatisfyingVersion(npmVersions, composer2npm(range))\n : npm.getSatisfyingVersion(npmVersions, composer2npm(range));\n\n if (!npmVersion) {\n return null;\n }\n\n // After we find the npm versions, we select from them back in the mapping the possible patches.\n const candidates = versionsMapped\n .filter((x) => x.npmVariant === npmVersion)\n .sort((a, b) => (minMode ? 1 : -1) * sortVersions(a.origianl, b.origianl));\n\n return candidates[0].origianl;\n}\n\n/**\n * @param intput Version in any format, it recognizes the specific patch format x.x.x-pXX\n * @returns If input contains the specific patch, it returns the input with removed the patch and true, otherwise it retunrs the same string and false.\n */\nfunction removeComposerSpecificPatchPart(input: string): [string, boolean] {\n // the regex is based on the original from composer implementation https://github.com/composer/semver/blob/fa1ec24f0ab1efe642671ec15c51a3ab879f59bf/src/VersionParser.php#L137\n const pattern = /^v?\\d+(\\.\\d+(\\.\\d+(\\.\\d+)?)?)?(?<suffix>-p[1-9]\\d*)$/gi;\n const match = pattern.exec(input);\n\n return match\n ? [input.replace(match.groups!.suffix, ''), true]\n : [input, false];\n}\n\nfunction composer2npm(input: string): string {\n return input\n .split(regEx(/\\s*\\|\\|?\\s*/g))\n .map((part): string => {\n const cleanInput = normalizeVersion(part);\n if (npm.isVersion(cleanInput)) {\n return cleanInput;\n }\n if (npm.isVersion(padZeroes(cleanInput))) {\n return padZeroes(cleanInput);\n }\n const [versionId, stability] = getVersionParts(cleanInput);\n let output = versionId;\n\n // ~4 to ^4 and ~4.1 to ^4.1\n output = output.replace(\n regEx(/(?:^|\\s)~([1-9][0-9]*(?:\\.[0-9]*)?)(?: |$)/g),\n '^$1',\n );\n // ~0.4 to >=0.4 <1\n output = output.replace(\n regEx(/(?:^|\\s)~(0\\.[1-9][0-9]*)(?: |$)/g),\n '>=$1 <1',\n );\n\n // add extra digits to <8-DEV and <8.0-DEV\n output = output\n .replace(regEx(/^(<\\d+(\\.\\d+)?)$/g), '$1.0')\n .replace(regEx(/^(<\\d+(\\.\\d+)?)$/g), '$1.0');\n\n return output + stability;\n })\n .map((part) => part.replace(/([a-z])([0-9])/gi, '$1.$2'))\n .join(' || ');\n}\n\nfunction equals(a: string, b: string): boolean {\n return npm.equals(composer2npm(a), composer2npm(b));\n}\n\nfunction getMajor(version: string): number | null {\n const semverVersion = semver.coerce(composer2npm(version));\n return semverVersion ? npm.getMajor(semverVersion) : null;\n}\n\nfunction getMinor(version: string): number | null {\n const semverVersion = semver.coerce(composer2npm(version));\n return semverVersion ? npm.getMinor(semverVersion) : null;\n}\n\nfunction getPatch(version: string): number | null {\n const semverVersion = semver.coerce(composer2npm(version));\n\n // This returns only the numbers without the optional `-pXX` patch version supported by composer. Fixing that would require a bigger\n // refactoring, because the API supports only numbers.\n return semverVersion ? npm.getPatch(semverVersion) : null;\n}\n\nfunction isGreaterThan(a: string, b: string): boolean {\n return sortVersions(a, b) === 1;\n}\n\nfunction isLessThanRange(version: string, range: string): boolean {\n return !!npm.isLessThanRange?.(composer2npm(version), composer2npm(range));\n}\n\nfunction isSingleVersion(input: string): boolean {\n return !!input && npm.isSingleVersion(composer2npm(input));\n}\n\nfunction isStable(version: string): boolean {\n if (version) {\n // Composer considers patches `-pXX` as stable: https://github.com/composer/semver/blob/fa1ec24f0ab1efe642671ec15c51a3ab879f59bf/src/VersionParser.php#L568 but npm not.\n // In order to be able to use the standard npm.isStable function, we remove the potential patch version for the check.\n const [withoutPatch] = removeComposerSpecificPatchPart(version);\n return npm.isStable(composer2npm(withoutPatch));\n }\n\n return false;\n}\n\nexport function isValid(input: string): boolean {\n return !!input && npm.isValid(composer2npm(input));\n}\n\nexport function isVersion(input: string): boolean {\n return !!input && npm.isVersion(composer2npm(input));\n}\n\nfunction matches(version: string, range: string): boolean {\n return npm.matches(composer2npm(version), composer2npm(range));\n}\n\nfunction getSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return calculateSatisfyingVersionIntenal(versions, range, false);\n}\n\nfunction minSatisfyingVersion(\n versions: string[],\n range: string,\n): string | null {\n return calculateSatisfyingVersionIntenal(versions, range, true);\n}\n\nfunction subset(subRange: string, superRange: string): boolean | undefined {\n try {\n return npm.subset!(composer2npm(subRange), composer2npm(superRange));\n } catch (err) {\n logger.trace({ err }, 'composer.subset error');\n return false;\n }\n}\n\nfunction intersects(subRange: string, superRange: string): boolean {\n try {\n return npm.intersects!(composer2npm(subRange), composer2npm(superRange));\n } catch (err) {\n logger.trace({ err }, 'composer.intersects error');\n return false;\n }\n}\n\nfunction getNewValue({\n currentValue,\n rangeStrategy,\n currentVersion,\n newVersion,\n}: NewValueConfig): string | null {\n if (rangeStrategy === 'pin') {\n return newVersion;\n }\n if (rangeStrategy === 'update-lockfile') {\n if (matches(newVersion, currentValue)) {\n return currentValue;\n }\n return getNewValue({\n currentValue,\n rangeStrategy: 'replace',\n currentVersion,\n newVersion,\n });\n }\n const currentMajor = currentVersion ? getMajor(currentVersion) : null;\n const toMajor = getMajor(newVersion);\n const toMinor = getMinor(newVersion);\n let newValue: string | null = null;\n if (isVersion(currentValue)) {\n newValue = newVersion;\n } else if (regEx(/^[~^](0\\.[1-9][0-9]*)$/).test(currentValue)) {\n const operator = currentValue.substring(0, 1);\n // handle ~0.4 case first\n if (toMajor === 0) {\n // TODO: types (#22198)\n newValue = `${operator}0.${toMinor!}`;\n } else {\n // TODO: types (#22198)\n newValue = `${operator}${toMajor!}.0`;\n }\n } else if (regEx(/^[~^]([0-9]*)$/).test(currentValue)) {\n // handle ~4 case\n const operator = currentValue.substring(0, 1);\n // TODO: types (#22198)\n newValue = `${operator}${toMajor!}`;\n } else if (\n toMajor &&\n regEx(/^[~^]([0-9]*(?:\\.[0-9]*)?)$/).test(currentValue)\n ) {\n const operator = currentValue.substring(0, 1);\n if (rangeStrategy === 'bump') {\n newValue = `${operator}${newVersion}`;\n } else if (\n (is.number(currentMajor) && toMajor > currentMajor) ||\n !toMinor\n ) {\n // handle ~4.1 case\n newValue = `${operator}${toMajor}.0`;\n } else {\n newValue = `${operator}${toMajor}.${toMinor}`;\n }\n } else if (\n currentVersion &&\n npm.isVersion(padZeroes(normalizeVersion(newVersion))) &&\n npm.isValid(normalizeVersion(currentValue)) &&\n composer2npm(currentValue) === normalizeVersion(currentValue)\n ) {\n newValue = npm.getNewValue({\n currentValue: normalizeVersion(currentValue),\n rangeStrategy,\n currentVersion: padZeroes(normalizeVersion(currentVersion)),\n newVersion: padZeroes(normalizeVersion(newVersion)),\n });\n }\n\n if (rangeStrategy === 'widen' && matches(newVersion, currentValue)) {\n newValue = currentValue;\n } else {\n const hasOr = currentValue.includes(' || ');\n if (hasOr || rangeStrategy === 'widen') {\n const splitValues = currentValue.split('||');\n const lastValue = splitValues[splitValues.length - 1];\n const replacementValue = getNewValue({\n currentValue: lastValue.trim(),\n rangeStrategy: 'replace',\n currentVersion,\n newVersion,\n });\n if (rangeStrategy === 'replace') {\n newValue = replacementValue;\n } else if (replacementValue) {\n const parsedRange = parseRange(replacementValue);\n const element = parsedRange[parsedRange.length - 1];\n if (element.operator?.startsWith('<')) {\n const splitCurrent = currentValue.split(element.operator);\n splitCurrent.pop();\n newValue = splitCurrent.join(element.operator) + replacementValue;\n } else {\n newValue = currentValue + ' || ' + replacementValue;\n }\n }\n }\n }\n\n if (!newValue) {\n logger.warn(\n { currentValue, rangeStrategy, currentVersion, newVersion },\n 'Unsupported composer value',\n );\n newValue = newVersion;\n }\n if (currentValue.split('.')[0].includes('v')) {\n newValue = newValue.replace(regEx(/([0-9])/), 'v$1');\n }\n\n // Preserve original min-stability specifier\n if (currentValue.includes('@')) {\n newValue += '@' + currentValue.split('@')[1];\n }\n\n return newValue;\n}\n\nfunction sortVersions(a: string, b: string): number {\n const [aWithoutPatch, aContainsPatch] = removeComposerSpecificPatchPart(a);\n const [bWithoutPatch, bContainsPatch] = removeComposerSpecificPatchPart(b);\n\n if (aContainsPatch === bContainsPatch) {\n // If both [a and b] contain patch version or both [a and b] do not contain patch version, then npm comparison deliveres correct results\n return npm.sortVersions(composer2npm(a), composer2npm(b));\n } else if (\n npm.equals(composer2npm(aWithoutPatch), composer2npm(bWithoutPatch))\n ) {\n // If only one [a or b] contains patch version and the parts without patch versions are equal, then the version with patch is greater (this is the case where npm comparison fails)\n return aContainsPatch ? 1 : -1;\n } else {\n // All other cases can be compared correctly by npm\n return npm.sortVersions(composer2npm(a), composer2npm(b));\n }\n}\n\nfunction isCompatible(version: string): boolean {\n return isVersion(version);\n}\n\nfunction isBreaking(current: string, version: string): boolean {\n return npm.isBreaking!(composer2npm(current), composer2npm(version));\n}\n\nexport const api: VersioningApi = {\n equals,\n getMajor,\n getMinor,\n getPatch,\n isBreaking,\n isCompatible,\n isGreaterThan,\n isLessThanRange,\n isSingleVersion,\n isStable,\n isValid,\n isVersion,\n matches,\n getSatisfyingVersion,\n minSatisfyingVersion,\n getNewValue,\n sortVersions,\n subset,\n intersects,\n};\nexport default api;\n"]}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { VersioningApi } from '../types';
|
2
|
+
export declare const id = "lambda-node";
|
3
|
+
export declare const displayName = "Lambda Node.js Runtime";
|
4
|
+
export declare const urls: never[];
|
5
|
+
export declare const supportsRanges = false;
|
6
|
+
export declare function isStable(version: string): boolean;
|
7
|
+
export declare const api: VersioningApi;
|
8
|
+
export default api;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.api = exports.supportsRanges = exports.urls = exports.displayName = exports.id = void 0;
|
4
|
+
exports.isStable = isStable;
|
5
|
+
const luxon_1 = require("luxon");
|
6
|
+
const node_1 = require("../node");
|
7
|
+
const schedule_1 = require("./schedule");
|
8
|
+
exports.id = 'lambda-node';
|
9
|
+
exports.displayName = 'Lambda Node.js Runtime';
|
10
|
+
exports.urls = [];
|
11
|
+
exports.supportsRanges = false;
|
12
|
+
function isStable(version) {
|
13
|
+
const schedule = (0, schedule_1.findLambdaScheduleForVersion)(version);
|
14
|
+
if (schedule === null) {
|
15
|
+
return false;
|
16
|
+
}
|
17
|
+
if (typeof schedule.support === 'string') {
|
18
|
+
return luxon_1.DateTime.local() < luxon_1.DateTime.fromISO(schedule.support);
|
19
|
+
}
|
20
|
+
return true;
|
21
|
+
}
|
22
|
+
exports.api = {
|
23
|
+
...node_1.api,
|
24
|
+
isStable,
|
25
|
+
};
|
26
|
+
exports.default = exports.api;
|
27
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/modules/versioning/lambda-node/index.ts"],"names":[],"mappings":";;;AAUA,4BAYC;AAtBD,iCAAiC;AACjC,kCAAyC;AAEzC,yCAA0D;AAE7C,QAAA,EAAE,GAAG,aAAa,CAAC;AACnB,QAAA,WAAW,GAAG,wBAAwB,CAAC;AACvC,QAAA,IAAI,GAAG,EAAE,CAAC;AACV,QAAA,cAAc,GAAG,KAAK,CAAC;AAEpC,SAAgB,QAAQ,CAAC,OAAe;IACtC,MAAM,QAAQ,GAAG,IAAA,uCAA4B,EAAC,OAAO,CAAC,CAAC;IAEvD,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzC,OAAO,gBAAQ,CAAC,KAAK,EAAE,GAAG,gBAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAEY,QAAA,GAAG,GAAkB;IAChC,GAAG,UAAO;IACV,QAAQ;CACT,CAAC;AAEF,kBAAe,WAAG,CAAC","sourcesContent":["import { DateTime } from 'luxon';\nimport { api as nodeApi } from '../node';\nimport type { VersioningApi } from '../types';\nimport { findLambdaScheduleForVersion } from './schedule';\n\nexport const id = 'lambda-node';\nexport const displayName = 'Lambda Node.js Runtime';\nexport const urls = [];\nexport const supportsRanges = false;\n\nexport function isStable(version: string): boolean {\n const schedule = findLambdaScheduleForVersion(version);\n\n if (schedule === null) {\n return false;\n }\n\n if (typeof schedule.support === 'string') {\n return DateTime.local() < DateTime.fromISO(schedule.support);\n }\n\n return true;\n}\n\nexport const api: VersioningApi = {\n ...nodeApi,\n isStable,\n};\n\nexport default api;\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
interface LambdaSchedule {
|
2
|
+
cycle: string;
|
3
|
+
/**
|
4
|
+
* Either `true` if currently in support or a string indicating the date at which support will end
|
5
|
+
*/
|
6
|
+
support: true | string;
|
7
|
+
}
|
8
|
+
export type LambdaData = Record<string, LambdaSchedule>;
|
9
|
+
export declare function findLambdaScheduleForVersion(version: string): LambdaSchedule | null;
|
10
|
+
export {};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.findLambdaScheduleForVersion = findLambdaScheduleForVersion;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const data_files_generated_1 = tslib_1.__importDefault(require("../../../data-files.generated"));
|
6
|
+
const regex_1 = require("../../../util/regex");
|
7
|
+
const node_1 = require("../node");
|
8
|
+
const lambdaSchedule = JSON.parse(data_files_generated_1.default.get('data/lambda-node-js-schedule.json'));
|
9
|
+
function findLambdaScheduleForVersion(version) {
|
10
|
+
const majorVersionMatch = (0, regex_1.regEx)(/^v?([0-9]+)\./).exec(version);
|
11
|
+
if (!majorVersionMatch) {
|
12
|
+
return null;
|
13
|
+
}
|
14
|
+
if (!(0, node_1.isStable)(version)) {
|
15
|
+
return null;
|
16
|
+
}
|
17
|
+
return lambdaSchedule[majorVersionMatch[1]] ?? null;
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=schedule.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../../../lib/modules/versioning/lambda-node/schedule.ts"],"names":[],"mappings":";;AAmBA,oEAcC;;AAjCD,iGAAsD;AACtD,+CAA4C;AAC5C,kCAAmC;AAanC,MAAM,cAAc,GAAe,IAAI,CAAC,KAAK,CAC3C,8BAAS,CAAC,GAAG,CAAC,mCAAmC,CAAE,CACpD,CAAC;AAEF,SAAgB,4BAA4B,CAC1C,OAAe;IAEf,MAAM,iBAAiB,GAAG,IAAA,aAAK,EAAC,eAAe,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE/D,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,IAAA,eAAQ,EAAC,OAAO,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,cAAc,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACtD,CAAC","sourcesContent":["import dataFiles from '../../../data-files.generated';\nimport { regEx } from '../../../util/regex';\nimport { isStable } from '../node';\n\ninterface LambdaSchedule {\n cycle: string;\n\n /**\n * Either `true` if currently in support or a string indicating the date at which support will end\n */\n support: true | string;\n}\n\nexport type LambdaData = Record<string, LambdaSchedule>;\n\nconst lambdaSchedule: LambdaData = JSON.parse(\n dataFiles.get('data/lambda-node-js-schedule.json')!,\n);\n\nexport function findLambdaScheduleForVersion(\n version: string,\n): LambdaSchedule | null {\n const majorVersionMatch = regEx(/^v?([0-9]+)\\./).exec(version);\n\n if (!majorVersionMatch) {\n return null;\n }\n\n if (!isStable(version)) {\n return null;\n }\n\n return lambdaSchedule[majorVersionMatch[1]] ?? null;\n}\n"]}
|
@@ -4,6 +4,7 @@ exports.api = exports.isVersion = exports.isValid = exports.supportedRangeStrate
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const semver_1 = tslib_1.__importDefault(require("semver"));
|
6
6
|
const semver_stable_1 = tslib_1.__importDefault(require("semver-stable"));
|
7
|
+
const semver_2 = require("../semver");
|
7
8
|
const range_1 = require("./range");
|
8
9
|
exports.id = 'npm';
|
9
10
|
exports.displayName = 'npm';
|
@@ -36,6 +37,7 @@ exports.api = {
|
|
36
37
|
getMinor,
|
37
38
|
getNewValue: range_1.getNewValue,
|
38
39
|
getPatch,
|
40
|
+
isBreaking: semver_2.isBreaking,
|
39
41
|
isCompatible: exports.isVersion,
|
40
42
|
isGreaterThan,
|
41
43
|
isLessThanRange,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/modules/versioning/npm/index.ts"],"names":[],"mappings":";;;;AAAA,4DAA4B;AAC5B,0EAAmC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/modules/versioning/npm/index.ts"],"names":[],"mappings":";;;;AAAA,4DAA4B;AAC5B,0EAAmC;AAEnC,sCAAuC;AAEvC,mCAAsC;AAEzB,QAAA,EAAE,GAAG,KAAK,CAAC;AACX,QAAA,WAAW,GAAG,KAAK,CAAC;AACpB,QAAA,IAAI,GAAG;IAClB,qBAAqB;IACrB,sCAAsC;IACtC,kDAAkD;IAClD,2BAA2B;CAC5B,CAAC;AACW,QAAA,cAAc,GAAG,IAAI,CAAC;AACtB,QAAA,wBAAwB,GAAoB;IACvD,MAAM;IACN,OAAO;IACP,KAAK;IACL,SAAS;CACV,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\nimport stable from 'semver-stable';\nimport type { RangeStrategy } from '../../../types/versioning';\nimport { isBreaking } from '../semver';\nimport type { VersioningApi } from '../types';\nimport { getNewValue } from './range';\n\nexport const id = 'npm';\nexport const displayName = 'npm';\nexport const urls = [\n 'https://semver.org/',\n 'https://www.npmjs.com/package/semver',\n 'https://docs.npmjs.com/about-semantic-versioning',\n 'https://semver.npmjs.com/',\n];\nexport const supportsRanges = true;\nexport const supportedRangeStrategies: RangeStrategy[] = [\n 'bump',\n 'widen',\n 'pin',\n 'replace',\n];\n\nconst {\n compare: sortVersions,\n maxSatisfying: getSatisfyingVersion,\n minSatisfying: minSatisfyingVersion,\n major: getMajor,\n minor: getMinor,\n patch: getPatch,\n satisfies: matches,\n valid,\n validRange,\n ltr: isLessThanRange,\n gt: isGreaterThan,\n eq: equals,\n subset,\n intersects,\n} = semver;\n\n// If this is left as an alias, inputs like \"17.04.0\" throw errors\nexport const isValid = (input: string): boolean => !!validRange(input);\nexport const isVersion = (input: string): boolean => !!valid(input);\n\nfunction isSingleVersion(constraint: string): boolean {\n return (\n isVersion(constraint) ||\n (constraint?.startsWith('=') && isVersion(constraint.substring(1).trim()))\n );\n}\n\nexport const api: VersioningApi = {\n equals,\n getMajor,\n getMinor,\n getNewValue,\n getPatch,\n isBreaking,\n isCompatible: isVersion,\n isGreaterThan,\n isLessThanRange,\n isSingleVersion,\n isStable: stable.is,\n isValid,\n isVersion,\n matches,\n getSatisfyingVersion,\n minSatisfyingVersion,\n sortVersions,\n subset,\n intersects,\n};\n\nexport default api;\n"]}
|
@@ -196,6 +196,10 @@ function getNewValue({ currentValue, rangeStrategy, currentVersion, newVersion,
|
|
196
196
|
const newMajor = toVersionMajor + 1;
|
197
197
|
res = `<${newMajor}.0.0`;
|
198
198
|
}
|
199
|
+
else if (currentValue.endsWith('.0')) {
|
200
|
+
const newMinor = toVersionMinor + 1;
|
201
|
+
res = `<${toVersionMajor}.${newMinor}${element.patch ? '.0' : ''}`;
|
202
|
+
}
|
199
203
|
else if (element.patch) {
|
200
204
|
// TODO: types (#22198)
|
201
205
|
res = `<${increment(newVersion, 'patch')}`;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"range.js","sourceRoot":"","sources":["../../../../lib/modules/versioning/npm/range.ts"],"names":[],"mappings":";;AAgEA,kCA6LC;;AA7PD,kEAAkC;AAClC,4DAA4B;AAC5B,wEAAuC;AACvC,4CAAyC;AACzC,+CAA4C;AAC5C,6CAAkD;AAGlD,MAAM,EACJ,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,SAAS,EAChB,KAAK,EACL,KAAK,EACL,KAAK,EACL,UAAU,EACV,SAAS,GACV,GAAG,gBAAM,CAAC;AAEX,SAAS,iBAAiB,CAAC,QAAgB,EAAE,QAAgB;IAC3D,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IAErC,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,CAAC,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,EAAE,CAAC;IAEvB,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,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I,CAAC;YACjD,CAAC;YACD,IAAI,OAAO,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;gBAC1B,OAAO,GAAG,cAAc,IAAI,cAAc,IAAI,CAAC;YACjD,CAAC;YACD,OAAO,GAAG,cAAc,IAAI,cAAc,EAAE,CAAC;QAC/C,CAAC;QACD,OAAO,GAAG,cAAc,EAAE,CAAC;IAC7B,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport semver from 'semver';\nimport semverUtils from 'semver-utils';\nimport { logger } from '../../../logger';\nimport { regEx } from '../../../util/regex';\nimport { isSemVerXRange } from '../semver/common';\nimport type { NewValueConfig } from '../types';\n\nconst {\n inc: increment,\n valid: isVersion,\n major,\n minor,\n patch,\n prerelease,\n satisfies,\n} = semver;\n\nfunction replaceCaretValue(oldValue: string, newValue: string): string {\n const toVersionMajor = major(newValue);\n const toVersionMinor = minor(newValue);\n const toVersionPatch = patch(newValue);\n\n const currentMajor = major(oldValue);\n const currentMinor = minor(oldValue);\n const currentPatch = patch(oldValue);\n\n const oldTuple = [currentMajor, currentMinor, currentPatch];\n const newTuple = [toVersionMajor, toVersionMinor, toVersionPatch];\n const resultTuple = [];\n\n let leadingZero = true;\n let needReplace = false;\n for (let idx = 0; idx < 3; idx += 1) {\n const oldVal = oldTuple[idx];\n const newVal = newTuple[idx];\n\n let leadingDigit = false;\n if (oldVal !== 0 || newVal !== 0) {\n if (leadingZero) {\n leadingZero = false;\n leadingDigit = true;\n }\n }\n\n if (leadingDigit && newVal > oldVal) {\n needReplace = true;\n }\n\n if (!needReplace && newVal < oldVal) {\n return newValue;\n }\n\n resultTuple.push(leadingDigit ? newVal : 0);\n }\n\n return needReplace ? resultTuple.join('.') : oldValue;\n}\n\nfunction stripV(value: string): string {\n return value.replace(/^v/, '');\n}\n\n// TODO: #22198\nexport function getNewValue({\n currentValue,\n rangeStrategy,\n currentVersion,\n newVersion,\n}: NewValueConfig): string | null {\n if (\n !['pin', 'update-lockfile'].includes(rangeStrategy) &&\n isSemVerXRange(currentValue)\n ) {\n return null;\n }\n if (rangeStrategy === 'pin' || isVersion(currentValue)) {\n return newVersion;\n }\n if (rangeStrategy === 'update-lockfile') {\n if (satisfies(newVersion, currentValue)) {\n return currentValue;\n }\n return getNewValue({\n currentValue,\n rangeStrategy: 'replace',\n currentVersion,\n newVersion,\n });\n }\n const parsedRange = semverUtils.parseRange(currentValue);\n const element = parsedRange[parsedRange.length - 1];\n if (rangeStrategy === 'widen') {\n if (satisfies(newVersion, currentValue)) {\n return currentValue;\n }\n const newValue = getNewValue({\n currentValue,\n rangeStrategy: 'replace',\n currentVersion,\n newVersion,\n });\n if (element.operator?.startsWith('<')) {\n // TODO fix this\n const splitCurrent = currentValue.split(element.operator);\n splitCurrent.pop();\n // TODO: types (#22198)\n return `${splitCurrent.join(element.operator)}${newValue!}`;\n }\n if (parsedRange.length > 1) {\n const previousElement = parsedRange[parsedRange.length - 2];\n if (previousElement.operator === '-') {\n const splitCurrent = currentValue.split('-');\n splitCurrent.pop();\n // TODO: types (#22198)\n return `${splitCurrent.join('-')}- ${newValue!}`;\n }\n if (element.operator?.startsWith('>')) {\n logger.warn(`Complex ranges ending in greater than are not supported`);\n return null;\n }\n }\n // TODO: types (#22198)\n return `${currentValue} || ${newValue!}`;\n }\n const toVersionMajor = major(newVersion);\n const toVersionMinor = minor(newVersion);\n const toVersionPatch = patch(newVersion);\n const toNewVersion = prerelease(newVersion);\n const suffix = toNewVersion ? `-${toNewVersion[0]}` : '';\n // Simple range\n if (rangeStrategy === 'bump') {\n if (parsedRange.length === 1) {\n if (!element.operator) {\n return stripV(newVersion);\n }\n if (element.operator === '^') {\n return `^${stripV(newVersion)}`;\n }\n if (element.operator === '~') {\n return `~${stripV(newVersion)}`;\n }\n if (element.operator === '=') {\n return `=${stripV(newVersion)}`;\n }\n if (element.operator === '>=') {\n return currentValue.includes('>= ')\n ? `>= ${stripV(newVersion)}`\n : `>=${stripV(newVersion)}`;\n }\n if (element.operator.startsWith('<')) {\n return currentValue;\n }\n } else {\n return semverUtils\n .parseRange(currentValue)\n .map((x) => x.semver)\n .filter(is.string)\n .map((subRange) => {\n const bumpedSubRange = getNewValue({\n currentValue: subRange,\n rangeStrategy: 'bump',\n currentVersion,\n newVersion,\n });\n if (bumpedSubRange && satisfies(newVersion, bumpedSubRange)) {\n return bumpedSubRange;\n }\n\n return getNewValue({\n currentValue: subRange,\n rangeStrategy: 'replace',\n currentVersion,\n newVersion,\n });\n })\n .filter((x) => x !== null && x !== '')\n .join(' ');\n }\n logger.debug(\n 'Unsupported range type for rangeStrategy=bump: ' + currentValue,\n );\n return null;\n }\n if (element.operator === '~>') {\n return `~> ${toVersionMajor}.${toVersionMinor}.0`;\n }\n if (element.operator === '^') {\n if (suffix.length || !currentVersion) {\n return `^${toVersionMajor}.${toVersionMinor}.${toVersionPatch}${suffix}`;\n }\n return `^${replaceCaretValue(currentVersion, newVersion)}`;\n }\n if (element.operator === '=') {\n return `=${stripV(newVersion)}`;\n }\n if (element.operator === '~') {\n if (suffix.length) {\n return `~${toVersionMajor}.${toVersionMinor}.${toVersionPatch}${suffix}`;\n }\n return `~${toVersionMajor}.${toVersionMinor}.0`;\n }\n if (element.operator === '<=') {\n let res;\n if (!!element.patch || suffix.length) {\n res = `<=${stripV(newVersion)}`;\n } else if (element.minor) {\n res = `<=${toVersionMajor}.${toVersionMinor}`;\n } else {\n res = `<=${toVersionMajor}`;\n }\n if (currentValue.includes('<= ')) {\n res = res.replace('<=', '<= ');\n }\n return res;\n }\n if (element.operator === '<') {\n let res;\n if (currentValue.endsWith('.0.0')) {\n const newMajor = toVersionMajor + 1;\n res = `<${newMajor}.0.0`;\n } else if (element.patch) {\n // TODO: types (#22198)\n res = `<${increment(newVersion, 'patch')!}`;\n } else if (element.minor) {\n res = `<${toVersionMajor}.${toVersionMinor + 1}`;\n } else {\n res = `<${toVersionMajor + 1}`;\n }\n if (currentValue.includes('< ')) {\n res = res.replace(regEx(/</g), '< ');\n }\n return res;\n }\n if (!element.operator) {\n if (element.minor) {\n if (element.minor === 'x') {\n return `${toVersionMajor}.x`;\n }\n if (element.minor === '*') {\n return `${toVersionMajor}.*`;\n }\n if (element.patch === 'x') {\n return `${toVersionMajor}.${toVersionMinor}.x`;\n }\n if (element.patch === '*') {\n return `${toVersionMajor}.${toVersionMinor}.*`;\n }\n return `${toVersionMajor}.${toVersionMinor}`;\n }\n return `${toVersionMajor}`;\n }\n return newVersion;\n}\n"]}
|
1
|
+
{"version":3,"file":"range.js","sourceRoot":"","sources":["../../../../lib/modules/versioning/npm/range.ts"],"names":[],"mappings":";;AAgEA,kCAgMC;;AAhQD,kEAAkC;AAClC,4DAA4B;AAC5B,wEAAuC;AACvC,4CAAyC;AACzC,+CAA4C;AAC5C,6CAAkD;AAGlD,MAAM,EACJ,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,SAAS,EAChB,KAAK,EACL,KAAK,EACL,KAAK,EACL,UAAU,EACV,SAAS,GACV,GAAG,gBAAM,CAAC;AAEX,SAAS,iBAAiB,CAAC,QAAgB,EAAE,QAAgB;IAC3D,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IAErC,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,CAAC,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,EAAE,CAAC;IAEvB,IAAI,WAAW,GAAG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AAE,IAAI,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtB,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,IAAI,OAAO,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;gBAC1B,OAAO,GAAG,cAAc,IAAI,CAAC;YAC/B,CAAC;YACD,IAAI,OAAO,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;gBAC1B,OAAO,GAAG,cAAc,IAAI,CAAC;YAC/B,CAAC;YACD,IAAI,OAAO,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;gBAC1B,OAAO,GAAG,cAAc,IAAI,cAAc,IAAI,CAAC;YACjD,CAAC;YACD,IAAI,OAAO,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;gBAC1B,OAAO,GAAG,cAAc,IAAI,cAAc,IAAI,CAAC;YACjD,CAAC;YACD,OAAO,GAAG,cAAc,IAAI,cAAc,EAAE,CAAC;QAC/C,CAAC;QACD,OAAO,GAAG,cAAc,EAAE,CAAC;IAC7B,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport semver from 'semver';\nimport semverUtils from 'semver-utils';\nimport { logger } from '../../../logger';\nimport { regEx } from '../../../util/regex';\nimport { isSemVerXRange } from '../semver/common';\nimport type { NewValueConfig } from '../types';\n\nconst {\n inc: increment,\n valid: isVersion,\n major,\n minor,\n patch,\n prerelease,\n satisfies,\n} = semver;\n\nfunction replaceCaretValue(oldValue: string, newValue: string): string {\n const toVersionMajor = major(newValue);\n const toVersionMinor = minor(newValue);\n const toVersionPatch = patch(newValue);\n\n const currentMajor = major(oldValue);\n const currentMinor = minor(oldValue);\n const currentPatch = patch(oldValue);\n\n const oldTuple = [currentMajor, currentMinor, currentPatch];\n const newTuple = [toVersionMajor, toVersionMinor, toVersionPatch];\n const resultTuple = [];\n\n let leadingZero = true;\n let needReplace = false;\n for (let idx = 0; idx < 3; idx += 1) {\n const oldVal = oldTuple[idx];\n const newVal = newTuple[idx];\n\n let leadingDigit = false;\n if (oldVal !== 0 || newVal !== 0) {\n if (leadingZero) {\n leadingZero = false;\n leadingDigit = true;\n }\n }\n\n if (leadingDigit && newVal > oldVal) {\n needReplace = true;\n }\n\n if (!needReplace && newVal < oldVal) {\n return newValue;\n }\n\n resultTuple.push(leadingDigit ? newVal : 0);\n }\n\n return needReplace ? resultTuple.join('.') : oldValue;\n}\n\nfunction stripV(value: string): string {\n return value.replace(/^v/, '');\n}\n\n// TODO: #22198\nexport function getNewValue({\n currentValue,\n rangeStrategy,\n currentVersion,\n newVersion,\n}: NewValueConfig): string | null {\n if (\n !['pin', 'update-lockfile'].includes(rangeStrategy) &&\n isSemVerXRange(currentValue)\n ) {\n return null;\n }\n if (rangeStrategy === 'pin' || isVersion(currentValue)) {\n return newVersion;\n }\n if (rangeStrategy === 'update-lockfile') {\n if (satisfies(newVersion, currentValue)) {\n return currentValue;\n }\n return getNewValue({\n currentValue,\n rangeStrategy: 'replace',\n currentVersion,\n newVersion,\n });\n }\n const parsedRange = semverUtils.parseRange(currentValue);\n const element = parsedRange[parsedRange.length - 1];\n if (rangeStrategy === 'widen') {\n if (satisfies(newVersion, currentValue)) {\n return currentValue;\n }\n const newValue = getNewValue({\n currentValue,\n rangeStrategy: 'replace',\n currentVersion,\n newVersion,\n });\n if (element.operator?.startsWith('<')) {\n // TODO fix this\n const splitCurrent = currentValue.split(element.operator);\n splitCurrent.pop();\n // TODO: types (#22198)\n return `${splitCurrent.join(element.operator)}${newValue!}`;\n }\n if (parsedRange.length > 1) {\n const previousElement = parsedRange[parsedRange.length - 2];\n if (previousElement.operator === '-') {\n const splitCurrent = currentValue.split('-');\n splitCurrent.pop();\n // TODO: types (#22198)\n return `${splitCurrent.join('-')}- ${newValue!}`;\n }\n if (element.operator?.startsWith('>')) {\n logger.warn(`Complex ranges ending in greater than are not supported`);\n return null;\n }\n }\n // TODO: types (#22198)\n return `${currentValue} || ${newValue!}`;\n }\n const toVersionMajor = major(newVersion);\n const toVersionMinor = minor(newVersion);\n const toVersionPatch = patch(newVersion);\n const toNewVersion = prerelease(newVersion);\n const suffix = toNewVersion ? `-${toNewVersion[0]}` : '';\n // Simple range\n if (rangeStrategy === 'bump') {\n if (parsedRange.length === 1) {\n if (!element.operator) {\n return stripV(newVersion);\n }\n if (element.operator === '^') {\n return `^${stripV(newVersion)}`;\n }\n if (element.operator === '~') {\n return `~${stripV(newVersion)}`;\n }\n if (element.operator === '=') {\n return `=${stripV(newVersion)}`;\n }\n if (element.operator === '>=') {\n return currentValue.includes('>= ')\n ? `>= ${stripV(newVersion)}`\n : `>=${stripV(newVersion)}`;\n }\n if (element.operator.startsWith('<')) {\n return currentValue;\n }\n } else {\n return semverUtils\n .parseRange(currentValue)\n .map((x) => x.semver)\n .filter(is.string)\n .map((subRange) => {\n const bumpedSubRange = getNewValue({\n currentValue: subRange,\n rangeStrategy: 'bump',\n currentVersion,\n newVersion,\n });\n if (bumpedSubRange && satisfies(newVersion, bumpedSubRange)) {\n return bumpedSubRange;\n }\n\n return getNewValue({\n currentValue: subRange,\n rangeStrategy: 'replace',\n currentVersion,\n newVersion,\n });\n })\n .filter((x) => x !== null && x !== '')\n .join(' ');\n }\n logger.debug(\n 'Unsupported range type for rangeStrategy=bump: ' + currentValue,\n );\n return null;\n }\n if (element.operator === '~>') {\n return `~> ${toVersionMajor}.${toVersionMinor}.0`;\n }\n if (element.operator === '^') {\n if (suffix.length || !currentVersion) {\n return `^${toVersionMajor}.${toVersionMinor}.${toVersionPatch}${suffix}`;\n }\n return `^${replaceCaretValue(currentVersion, newVersion)}`;\n }\n if (element.operator === '=') {\n return `=${stripV(newVersion)}`;\n }\n if (element.operator === '~') {\n if (suffix.length) {\n return `~${toVersionMajor}.${toVersionMinor}.${toVersionPatch}${suffix}`;\n }\n return `~${toVersionMajor}.${toVersionMinor}.0`;\n }\n if (element.operator === '<=') {\n let res;\n if (!!element.patch || suffix.length) {\n res = `<=${stripV(newVersion)}`;\n } else if (element.minor) {\n res = `<=${toVersionMajor}.${toVersionMinor}`;\n } else {\n res = `<=${toVersionMajor}`;\n }\n if (currentValue.includes('<= ')) {\n res = res.replace('<=', '<= ');\n }\n return res;\n }\n if (element.operator === '<') {\n let res;\n if (currentValue.endsWith('.0.0')) {\n const newMajor = toVersionMajor + 1;\n res = `<${newMajor}.0.0`;\n } else if (currentValue.endsWith('.0')) {\n const newMinor = toVersionMinor + 1;\n res = `<${toVersionMajor}.${newMinor}${element.patch ? '.0' : ''}`;\n } else if (element.patch) {\n // TODO: types (#22198)\n res = `<${increment(newVersion, 'patch')!}`;\n } else if (element.minor) {\n res = `<${toVersionMajor}.${toVersionMinor + 1}`;\n } else {\n res = `<${toVersionMajor + 1}`;\n }\n if (currentValue.includes('< ')) {\n res = res.replace(regEx(/</g), '< ');\n }\n return res;\n }\n if (!element.operator) {\n if (element.minor) {\n if (element.minor === 'x') {\n return `${toVersionMajor}.x`;\n }\n if (element.minor === '*') {\n return `${toVersionMajor}.*`;\n }\n if (element.patch === 'x') {\n return `${toVersionMajor}.${toVersionMinor}.x`;\n }\n if (element.patch === '*') {\n return `${toVersionMajor}.${toVersionMinor}.*`;\n }\n return `${toVersionMajor}.${toVersionMinor}`;\n }\n return `${toVersionMajor}`;\n }\n return newVersion;\n}\n"]}
|
@@ -55,7 +55,7 @@ function matches(version, range) {
|
|
55
55
|
if (isVersion(range)) {
|
56
56
|
return equals(version, range);
|
57
57
|
}
|
58
|
-
return isValid(range) && satisfies(version, range);
|
58
|
+
return isValid(range) && satisfies(version, range, { prereleases: true });
|
59
59
|
}
|
60
60
|
exports.api = {
|
61
61
|
equals,
|