renovate 40.0.0-next.2 → 40.0.0-next.20
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/legacy.js +0 -1
- package/dist/config/decrypt/legacy.js.map +1 -1
- package/dist/config/decrypt.d.ts +3 -1
- package/dist/config/decrypt.js +56 -13
- package/dist/config/decrypt.js.map +1 -1
- package/dist/config/migrate-validate.js +3 -2
- package/dist/config/migrate-validate.js.map +1 -1
- package/dist/config/migration.js +2 -1
- package/dist/config/migration.js.map +1 -1
- package/dist/config/migrations/custom/rebase-stale-prs-migration.js +1 -1
- package/dist/config/migrations/custom/rebase-stale-prs-migration.js.map +1 -1
- package/dist/config/options/index.js +3 -3
- package/dist/config/options/index.js.map +1 -1
- package/dist/config/parse.js +2 -2
- package/dist/config/parse.js.map +1 -1
- package/dist/config/presets/gitea/index.js +0 -1
- package/dist/config/presets/gitea/index.js.map +1 -1
- package/dist/config/presets/github/index.js +0 -1
- package/dist/config/presets/github/index.js.map +1 -1
- package/dist/config/presets/gitlab/index.js +1 -1
- package/dist/config/presets/gitlab/index.js.map +1 -1
- package/dist/config/presets/http/index.js +1 -2
- package/dist/config/presets/http/index.js.map +1 -1
- package/dist/config/presets/index.js +0 -7
- package/dist/config/presets/index.js.map +1 -1
- package/dist/config/presets/internal/custom-managers.js +3 -4
- package/dist/config/presets/internal/custom-managers.js.map +1 -1
- package/dist/config/presets/internal/index.js +1 -3
- package/dist/config/presets/internal/index.js.map +1 -1
- package/dist/config/schema.d.ts +2 -2
- package/dist/config/validation.js +3 -5
- package/dist/config/validation.js.map +1 -1
- package/dist/config-validator.js +0 -1
- package/dist/config-validator.js.map +1 -1
- package/dist/constants/category.js +0 -1
- package/dist/constants/category.js.map +1 -1
- package/dist/data/monorepo.json +2 -1
- package/dist/instrumentation/index.js +5 -3
- package/dist/instrumentation/index.js.map +1 -1
- package/dist/instrumentation/utils.js +1 -1
- package/dist/instrumentation/utils.js.map +1 -1
- package/dist/logger/cmd-serializer.js +0 -1
- package/dist/logger/cmd-serializer.js.map +1 -1
- package/dist/logger/config-serializer.js +0 -1
- package/dist/logger/config-serializer.js.map +1 -1
- package/dist/logger/index.js +0 -3
- package/dist/logger/index.js.map +1 -1
- package/dist/logger/once.js +4 -2
- package/dist/logger/once.js.map +1 -1
- package/dist/logger/pretty-stdout.js +0 -1
- package/dist/logger/pretty-stdout.js.map +1 -1
- package/dist/logger/renovate-logger.js +1 -1
- package/dist/logger/renovate-logger.js.map +1 -1
- package/dist/logger/utils.js +6 -11
- package/dist/logger/utils.js.map +1 -1
- package/dist/modules/datasource/artifactory/index.js +1 -1
- package/dist/modules/datasource/artifactory/index.js.map +1 -1
- package/dist/modules/datasource/azure-pipelines-tasks/index.js +11 -1
- package/dist/modules/datasource/azure-pipelines-tasks/index.js.map +1 -1
- package/dist/modules/datasource/azure-pipelines-tasks/schema.d.ts +16 -0
- package/dist/modules/datasource/azure-pipelines-tasks/schema.js +2 -0
- package/dist/modules/datasource/azure-pipelines-tasks/schema.js.map +1 -1
- package/dist/modules/datasource/crate/index.js +1 -1
- package/dist/modules/datasource/crate/index.js.map +1 -1
- package/dist/modules/datasource/custom/formats/html.js +1 -1
- package/dist/modules/datasource/custom/formats/html.js.map +1 -1
- package/dist/modules/datasource/custom/formats/yaml.js +1 -1
- package/dist/modules/datasource/custom/formats/yaml.js.map +1 -1
- package/dist/modules/datasource/custom/schema.d.ts +5 -5
- package/dist/modules/datasource/deb/index.js +1 -1
- package/dist/modules/datasource/deb/index.js.map +1 -1
- package/dist/modules/datasource/deno/schema.d.ts +8 -8
- package/dist/modules/datasource/docker/common.js +1 -1
- package/dist/modules/datasource/docker/common.js.map +1 -1
- package/dist/modules/datasource/docker/index.js +5 -3
- package/dist/modules/datasource/docker/index.js.map +1 -1
- package/dist/modules/datasource/docker/schema.d.ts +32 -32
- package/dist/modules/datasource/galaxy/schema.d.ts +1 -1
- package/dist/modules/datasource/galaxy-collection/schema.d.ts +3 -3
- package/dist/modules/datasource/gitea-releases/schema.d.ts +4 -4
- package/dist/modules/datasource/gitea-tags/schema.d.ts +4 -4
- package/dist/modules/datasource/github-release-attachments/index.js +2 -2
- package/dist/modules/datasource/github-release-attachments/index.js.map +1 -1
- package/dist/modules/datasource/go/base.js +1 -1
- package/dist/modules/datasource/go/base.js.map +1 -1
- package/dist/modules/datasource/go/releases-goproxy.js +1 -1
- package/dist/modules/datasource/go/releases-goproxy.js.map +1 -1
- package/dist/modules/datasource/golang-version/index.js +1 -1
- package/dist/modules/datasource/golang-version/index.js.map +1 -1
- package/dist/modules/datasource/hex/schema.d.ts +11 -11
- package/dist/modules/datasource/hexpm-bob/index.js +1 -1
- package/dist/modules/datasource/hexpm-bob/index.js.map +1 -1
- package/dist/modules/datasource/index.js +2 -2
- package/dist/modules/datasource/index.js.map +1 -1
- package/dist/modules/datasource/maven/util.js +1 -1
- package/dist/modules/datasource/maven/util.js.map +1 -1
- package/dist/modules/datasource/nuget/v2.js +1 -1
- package/dist/modules/datasource/nuget/v2.js.map +1 -1
- package/dist/modules/datasource/nuget/v3.js +1 -1
- package/dist/modules/datasource/nuget/v3.js.map +1 -1
- package/dist/modules/datasource/packagist/schema.d.ts +30 -30
- package/dist/modules/datasource/pod/index.js +1 -1
- package/dist/modules/datasource/pod/index.js.map +1 -1
- package/dist/modules/datasource/pypi/index.js +1 -1
- package/dist/modules/datasource/pypi/index.js.map +1 -1
- package/dist/modules/datasource/ruby-version/index.js +1 -1
- package/dist/modules/datasource/ruby-version/index.js.map +1 -1
- package/dist/modules/datasource/rubygems/index.js +1 -1
- package/dist/modules/datasource/rubygems/index.js.map +1 -1
- package/dist/modules/datasource/rubygems/versions-endpoint-cache.js +2 -2
- package/dist/modules/datasource/rubygems/versions-endpoint-cache.js.map +1 -1
- package/dist/modules/datasource/terraform-provider/index.js +1 -1
- package/dist/modules/datasource/terraform-provider/index.js.map +1 -1
- package/dist/modules/datasource/unity3d/index.d.ts +4 -1
- package/dist/modules/datasource/unity3d/index.js +36 -42
- package/dist/modules/datasource/unity3d/index.js.map +1 -1
- package/dist/modules/datasource/unity3d/schema.d.ts +47 -0
- package/dist/modules/datasource/unity3d/schema.js +17 -0
- package/dist/modules/datasource/unity3d/schema.js.map +1 -0
- package/dist/modules/manager/argocd/schema.d.ts +10 -10
- package/dist/modules/manager/azure-pipelines/schema.d.ts +10 -10
- package/dist/modules/manager/batect/schema.d.ts +6 -6
- package/dist/modules/manager/batect-wrapper/artifacts.js +1 -1
- package/dist/modules/manager/batect-wrapper/artifacts.js.map +1 -1
- package/dist/modules/manager/bazel/rules/docker.d.ts +9 -9
- package/dist/modules/manager/bazel/rules/git.d.ts +10 -10
- package/dist/modules/manager/bazel/rules/git.js +7 -1
- package/dist/modules/manager/bazel/rules/git.js.map +1 -1
- package/dist/modules/manager/bazel/rules/go.d.ts +5 -5
- package/dist/modules/manager/bazel/rules/oci.d.ts +3 -3
- package/dist/modules/manager/bazel-module/parser/fragments.d.ts +40 -40
- package/dist/modules/manager/bazel-module/parser/maven.d.ts +27 -27
- package/dist/modules/manager/bazel-module/parser/oci.d.ts +17 -17
- package/dist/modules/manager/bazel-module/rules.d.ts +40 -40
- package/dist/modules/manager/bundler/artifacts.js.map +1 -1
- package/dist/modules/manager/cargo/schema.d.ts +100 -100
- package/dist/modules/manager/circleci/schema.d.ts +6 -6
- package/dist/modules/manager/composer/schema.d.ts +40 -40
- package/dist/modules/manager/composer/utils.js +9 -6
- package/dist/modules/manager/composer/utils.js.map +1 -1
- package/dist/modules/manager/crossplane/schema.d.ts +2 -2
- package/dist/modules/manager/custom/jsonata/index.js +4 -0
- package/dist/modules/manager/custom/jsonata/index.js.map +1 -1
- package/dist/modules/manager/custom/jsonata/schema.d.ts +7 -7
- package/dist/modules/manager/devbox/artifacts.d.ts +1 -1
- package/dist/modules/manager/devbox/artifacts.js +29 -11
- package/dist/modules/manager/devbox/artifacts.js.map +1 -1
- package/dist/modules/manager/fingerprint.generated.js +68 -68
- package/dist/modules/manager/fingerprint.generated.js.map +1 -1
- package/dist/modules/manager/fleet/schema.d.ts +12 -12
- package/dist/modules/manager/flux/schema.d.ts +50 -50
- package/dist/modules/manager/glasskube/schema.d.ts +8 -8
- package/dist/modules/manager/gradle-wrapper/artifacts.js +1 -1
- package/dist/modules/manager/gradle-wrapper/artifacts.js.map +1 -1
- package/dist/modules/manager/maven/extract.js +3 -1
- package/dist/modules/manager/maven/extract.js.map +1 -1
- package/dist/modules/manager/mise/extract.js +1 -1
- package/dist/modules/manager/mise/extract.js.map +1 -1
- package/dist/modules/manager/nix/schema.d.ts +24 -24
- package/dist/modules/manager/npm/schema.d.ts +13 -13
- package/dist/modules/manager/nuget/schema.d.ts +8 -8
- package/dist/modules/manager/ocb/schema.d.ts +6 -6
- package/dist/modules/manager/pep621/schema.d.ts +55 -55
- package/dist/modules/manager/pep621/utils.js +1 -1
- package/dist/modules/manager/pep621/utils.js.map +1 -1
- package/dist/modules/manager/poetry/artifacts.js +3 -3
- package/dist/modules/manager/poetry/artifacts.js.map +1 -1
- package/dist/modules/manager/poetry/extract.js +2 -1
- package/dist/modules/manager/poetry/extract.js.map +1 -1
- package/dist/modules/manager/poetry/schema.d.ts +48 -48
- package/dist/modules/manager/sveltos/schema.d.ts +12 -12
- package/dist/modules/manager/terraform/lockfile/hash.d.ts +1 -1
- package/dist/modules/manager/vendir/schema.d.ts +27 -27
- package/dist/modules/platform/api.d.ts +1 -1
- package/dist/modules/platform/bitbucket/index.d.ts +1 -0
- package/dist/modules/platform/bitbucket/index.js +6 -1
- package/dist/modules/platform/bitbucket/index.js.map +1 -1
- package/dist/modules/platform/bitbucket/schema.d.ts +17 -17
- package/dist/modules/platform/bitbucket-server/index.d.ts +1 -1
- package/dist/modules/platform/bitbucket-server/index.js +13 -11
- package/dist/modules/platform/bitbucket-server/index.js.map +1 -1
- package/dist/modules/platform/bitbucket-server/schema.d.ts +75 -0
- package/dist/modules/platform/bitbucket-server/schema.js +14 -1
- package/dist/modules/platform/bitbucket-server/schema.js.map +1 -1
- package/dist/modules/platform/bitbucket-server/types.d.ts +2 -1
- package/dist/modules/platform/bitbucket-server/types.js.map +1 -1
- package/dist/modules/platform/bitbucket-server/utils.d.ts +0 -2
- package/dist/modules/platform/bitbucket-server/utils.js +1 -51
- package/dist/modules/platform/bitbucket-server/utils.js.map +1 -1
- package/dist/modules/platform/gerrit/client.js +1 -1
- package/dist/modules/platform/gerrit/client.js.map +1 -1
- package/dist/modules/platform/gitea/index.d.ts +1 -0
- package/dist/modules/platform/gitea/index.js +11 -0
- package/dist/modules/platform/gitea/index.js.map +1 -1
- package/dist/modules/platform/gitea/schema.d.ts +8 -8
- package/dist/modules/platform/github/common.d.ts +2 -0
- package/dist/modules/platform/github/common.js +16 -0
- package/dist/modules/platform/github/common.js.map +1 -1
- package/dist/modules/platform/github/index.d.ts +1 -1
- package/dist/modules/platform/github/index.js +6 -4
- package/dist/modules/platform/github/index.js.map +1 -1
- package/dist/modules/platform/github/issue.d.ts +12 -12
- package/dist/modules/platform/github/schema.d.ts +65 -65
- package/dist/modules/platform/gitlab/index.d.ts +1 -0
- package/dist/modules/platform/gitlab/index.js +9 -0
- package/dist/modules/platform/gitlab/index.js.map +1 -1
- package/dist/modules/platform/scm.d.ts +1 -1
- package/dist/modules/versioning/composer/index.js +10 -0
- package/dist/modules/versioning/composer/index.js.map +1 -1
- package/dist/modules/versioning/npm/index.js +2 -1
- package/dist/modules/versioning/npm/index.js.map +1 -1
- package/dist/modules/versioning/schema.js +1 -1
- package/dist/modules/versioning/schema.js.map +1 -1
- package/dist/modules/versioning/types.d.ts +4 -0
- package/dist/modules/versioning/types.js.map +1 -1
- package/dist/proxy.js +2 -1
- package/dist/proxy.js.map +1 -1
- package/dist/renovate.js +2 -2
- package/dist/renovate.js.map +1 -1
- package/dist/util/cache/package/decorator.js +2 -2
- package/dist/util/cache/package/decorator.js.map +1 -1
- package/dist/util/cache/package/redis.js +0 -1
- package/dist/util/cache/package/redis.js.map +1 -1
- package/dist/util/cache/repository/impl/base.d.ts +1 -1
- package/dist/util/exec/containerbase.js +12 -12
- package/dist/util/exec/containerbase.js.map +1 -1
- package/dist/util/github/graphql/query-adapters/releases-query-adapter.d.ts +5 -5
- package/dist/util/http/auth.js +0 -1
- package/dist/util/http/auth.js.map +1 -1
- package/dist/util/http/bitbucket-server.d.ts +5 -4
- package/dist/util/http/bitbucket-server.js +17 -20
- package/dist/util/http/bitbucket-server.js.map +1 -1
- package/dist/util/http/bitbucket.d.ts +6 -5
- package/dist/util/http/bitbucket.js +30 -31
- package/dist/util/http/bitbucket.js.map +1 -1
- package/dist/util/http/cache/abstract-http-cache-provider.js +1 -1
- package/dist/util/http/cache/abstract-http-cache-provider.js.map +1 -1
- package/dist/util/http/cache/schema.d.ts +2 -2
- package/dist/util/http/errors.d.ts +2 -0
- package/dist/util/http/errors.js +8 -0
- package/dist/util/http/errors.js.map +1 -0
- package/dist/util/http/gerrit.d.ts +6 -4
- package/dist/util/http/gerrit.js +11 -12
- package/dist/util/http/gerrit.js.map +1 -1
- package/dist/util/http/gitea.d.ts +5 -4
- package/dist/util/http/gitea.js +12 -13
- package/dist/util/http/gitea.js.map +1 -1
- package/dist/util/http/github.d.ts +14 -8
- package/dist/util/http/github.js +64 -60
- package/dist/util/http/github.js.map +1 -1
- package/dist/util/http/gitlab.d.ts +7 -5
- package/dist/util/http/gitlab.js +56 -46
- package/dist/util/http/gitlab.js.map +1 -1
- package/dist/util/http/got.d.ts +9 -0
- package/dist/util/http/got.js +54 -0
- package/dist/util/http/got.js.map +1 -0
- package/dist/util/http/host-rules.d.ts +2 -1
- package/dist/util/http/host-rules.js.map +1 -1
- package/dist/util/http/http.d.ts +93 -0
- package/dist/util/http/http.js +339 -0
- package/dist/util/http/http.js.map +1 -0
- package/dist/util/http/index.d.ts +6 -74
- package/dist/util/http/index.js +5 -359
- package/dist/util/http/index.js.map +1 -1
- package/dist/util/http/legacy.js +4 -1
- package/dist/util/http/legacy.js.map +1 -1
- package/dist/util/http/types.d.ts +9 -16
- package/dist/util/http/types.js.map +1 -1
- package/dist/util/string.d.ts +15 -0
- package/dist/util/string.js +75 -0
- package/dist/util/string.js.map +1 -1
- package/dist/util/toml.d.ts +1 -0
- package/dist/util/toml.js +6 -0
- package/dist/util/toml.js.map +1 -1
- package/dist/util/url.js +3 -8
- package/dist/util/url.js.map +1 -1
- package/dist/util/yaml.js +2 -6
- package/dist/util/yaml.js.map +1 -1
- package/dist/workers/global/config/parse/env.js +3 -2
- package/dist/workers/global/config/parse/env.js.map +1 -1
- package/dist/workers/global/config/parse/file.js +19 -9
- package/dist/workers/global/config/parse/file.js.map +1 -1
- package/dist/workers/global/config/parse/host-rules-from-env.js +6 -2
- package/dist/workers/global/config/parse/host-rules-from-env.js.map +1 -1
- package/dist/workers/repository/cache.js +0 -1
- package/dist/workers/repository/cache.js.map +1 -1
- package/dist/workers/repository/onboarding/pr/config-description.js +3 -1
- package/dist/workers/repository/onboarding/pr/config-description.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/bitbucket/index.js +1 -1
- package/dist/workers/repository/update/pr/changelog/bitbucket/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/gitlab/index.js +1 -1
- package/dist/workers/repository/update/pr/changelog/gitlab/index.js.map +1 -1
- package/package.json +44 -49
- package/renovate-schema.json +2 -1
@@ -7,14 +7,14 @@ declare const UvGitSource: z.ZodObject<{
|
|
7
7
|
branch: z.ZodOptional<z.ZodString>;
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
9
9
|
git: string;
|
10
|
-
rev?: string | undefined;
|
11
|
-
tag?: string | undefined;
|
12
10
|
branch?: string | undefined;
|
11
|
+
tag?: string | undefined;
|
12
|
+
rev?: string | undefined;
|
13
13
|
}, {
|
14
14
|
git: string;
|
15
|
-
rev?: string | undefined;
|
16
|
-
tag?: string | undefined;
|
17
15
|
branch?: string | undefined;
|
16
|
+
tag?: string | undefined;
|
17
|
+
rev?: string | undefined;
|
18
18
|
}>;
|
19
19
|
export type UvGitSource = z.infer<typeof UvGitSource>;
|
20
20
|
export declare const PyProjectSchema: z.ZodObject<{
|
@@ -24,13 +24,13 @@ export declare const PyProjectSchema: z.ZodObject<{
|
|
24
24
|
dependencies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
25
25
|
'optional-dependencies': z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
26
26
|
}, "strip", z.ZodTypeAny, {
|
27
|
-
version?: string | undefined;
|
28
27
|
dependencies?: string[] | undefined;
|
28
|
+
version?: string | undefined;
|
29
29
|
'requires-python'?: string | undefined;
|
30
30
|
'optional-dependencies'?: Record<string, string[]> | undefined;
|
31
31
|
}, {
|
32
|
-
version?: unknown;
|
33
32
|
dependencies?: string[] | undefined;
|
33
|
+
version?: unknown;
|
34
34
|
'requires-python'?: string | undefined;
|
35
35
|
'optional-dependencies'?: Record<string, string[]> | undefined;
|
36
36
|
}>>;
|
@@ -104,9 +104,9 @@ export declare const PyProjectSchema: z.ZodObject<{
|
|
104
104
|
index: string;
|
105
105
|
} | {
|
106
106
|
git: string;
|
107
|
-
rev?: string | undefined;
|
108
|
-
tag?: string | undefined;
|
109
107
|
branch?: string | undefined;
|
108
|
+
tag?: string | undefined;
|
109
|
+
rev?: string | undefined;
|
110
110
|
} | {
|
111
111
|
url: string;
|
112
112
|
} | {
|
@@ -120,30 +120,24 @@ export declare const PyProjectSchema: z.ZodObject<{
|
|
120
120
|
default: z.ZodDefault<z.ZodBoolean>;
|
121
121
|
explicit: z.ZodDefault<z.ZodBoolean>;
|
122
122
|
}, "strip", z.ZodTypeAny, {
|
123
|
-
name: string;
|
124
|
-
explicit: boolean;
|
125
123
|
default: boolean;
|
124
|
+
name: string;
|
126
125
|
url: string;
|
126
|
+
explicit: boolean;
|
127
127
|
}, {
|
128
128
|
name: string;
|
129
129
|
url: string;
|
130
|
-
explicit?: boolean | undefined;
|
131
130
|
default?: boolean | undefined;
|
131
|
+
explicit?: boolean | undefined;
|
132
132
|
}>, "many">>;
|
133
133
|
}, "strip", z.ZodTypeAny, {
|
134
|
-
index?: {
|
135
|
-
name: string;
|
136
|
-
explicit: boolean;
|
137
|
-
default: boolean;
|
138
|
-
url: string;
|
139
|
-
}[] | undefined;
|
140
134
|
sources?: Record<string, {
|
141
135
|
index: string;
|
142
136
|
} | {
|
143
137
|
git: string;
|
144
|
-
rev?: string | undefined;
|
145
|
-
tag?: string | undefined;
|
146
138
|
branch?: string | undefined;
|
139
|
+
tag?: string | undefined;
|
140
|
+
rev?: string | undefined;
|
147
141
|
} | {
|
148
142
|
url: string;
|
149
143
|
} | {
|
@@ -152,31 +146,31 @@ export declare const PyProjectSchema: z.ZodObject<{
|
|
152
146
|
workspace: true;
|
153
147
|
}> | undefined;
|
154
148
|
'dev-dependencies'?: string[] | undefined;
|
155
|
-
}, {
|
156
149
|
index?: {
|
150
|
+
default: boolean;
|
157
151
|
name: string;
|
158
152
|
url: string;
|
159
|
-
explicit
|
160
|
-
default?: boolean | undefined;
|
153
|
+
explicit: boolean;
|
161
154
|
}[] | undefined;
|
155
|
+
}, {
|
162
156
|
sources?: Record<string, any> | undefined;
|
163
157
|
'dev-dependencies'?: string[] | undefined;
|
164
|
-
}>>;
|
165
|
-
}, "strip", z.ZodTypeAny, {
|
166
|
-
uv?: {
|
167
158
|
index?: {
|
168
159
|
name: string;
|
169
|
-
explicit: boolean;
|
170
|
-
default: boolean;
|
171
160
|
url: string;
|
161
|
+
default?: boolean | undefined;
|
162
|
+
explicit?: boolean | undefined;
|
172
163
|
}[] | undefined;
|
164
|
+
}>>;
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
166
|
+
uv?: {
|
173
167
|
sources?: Record<string, {
|
174
168
|
index: string;
|
175
169
|
} | {
|
176
170
|
git: string;
|
177
|
-
rev?: string | undefined;
|
178
|
-
tag?: string | undefined;
|
179
171
|
branch?: string | undefined;
|
172
|
+
tag?: string | undefined;
|
173
|
+
rev?: string | undefined;
|
180
174
|
} | {
|
181
175
|
url: string;
|
182
176
|
} | {
|
@@ -185,6 +179,12 @@ export declare const PyProjectSchema: z.ZodObject<{
|
|
185
179
|
workspace: true;
|
186
180
|
}> | undefined;
|
187
181
|
'dev-dependencies'?: string[] | undefined;
|
182
|
+
index?: {
|
183
|
+
default: boolean;
|
184
|
+
name: string;
|
185
|
+
url: string;
|
186
|
+
explicit: boolean;
|
187
|
+
}[] | undefined;
|
188
188
|
} | undefined;
|
189
189
|
pdm?: {
|
190
190
|
source?: {
|
@@ -202,14 +202,14 @@ export declare const PyProjectSchema: z.ZodObject<{
|
|
202
202
|
} | undefined;
|
203
203
|
}, {
|
204
204
|
uv?: {
|
205
|
+
sources?: Record<string, any> | undefined;
|
206
|
+
'dev-dependencies'?: string[] | undefined;
|
205
207
|
index?: {
|
206
208
|
name: string;
|
207
209
|
url: string;
|
208
|
-
explicit?: boolean | undefined;
|
209
210
|
default?: boolean | undefined;
|
211
|
+
explicit?: boolean | undefined;
|
210
212
|
}[] | undefined;
|
211
|
-
sources?: Record<string, any> | undefined;
|
212
|
-
'dev-dependencies'?: string[] | undefined;
|
213
213
|
} | undefined;
|
214
214
|
pdm?: {
|
215
215
|
source?: {
|
@@ -228,26 +228,25 @@ export declare const PyProjectSchema: z.ZodObject<{
|
|
228
228
|
}>>;
|
229
229
|
}, "strip", z.ZodTypeAny, {
|
230
230
|
project?: {
|
231
|
-
version?: string | undefined;
|
232
231
|
dependencies?: string[] | undefined;
|
232
|
+
version?: string | undefined;
|
233
233
|
'requires-python'?: string | undefined;
|
234
234
|
'optional-dependencies'?: Record<string, string[]> | undefined;
|
235
235
|
} | undefined;
|
236
|
+
'build-system'?: {
|
237
|
+
requires?: string[] | undefined;
|
238
|
+
'build-backend'?: string | undefined;
|
239
|
+
} | undefined;
|
240
|
+
'dependency-groups'?: Record<string, string[]> | undefined;
|
236
241
|
tool?: {
|
237
242
|
uv?: {
|
238
|
-
index?: {
|
239
|
-
name: string;
|
240
|
-
explicit: boolean;
|
241
|
-
default: boolean;
|
242
|
-
url: string;
|
243
|
-
}[] | undefined;
|
244
243
|
sources?: Record<string, {
|
245
244
|
index: string;
|
246
245
|
} | {
|
247
246
|
git: string;
|
248
|
-
rev?: string | undefined;
|
249
|
-
tag?: string | undefined;
|
250
247
|
branch?: string | undefined;
|
248
|
+
tag?: string | undefined;
|
249
|
+
rev?: string | undefined;
|
251
250
|
} | {
|
252
251
|
url: string;
|
253
252
|
} | {
|
@@ -256,6 +255,12 @@ export declare const PyProjectSchema: z.ZodObject<{
|
|
256
255
|
workspace: true;
|
257
256
|
}> | undefined;
|
258
257
|
'dev-dependencies'?: string[] | undefined;
|
258
|
+
index?: {
|
259
|
+
default: boolean;
|
260
|
+
name: string;
|
261
|
+
url: string;
|
262
|
+
explicit: boolean;
|
263
|
+
}[] | undefined;
|
259
264
|
} | undefined;
|
260
265
|
pdm?: {
|
261
266
|
source?: {
|
@@ -272,28 +277,28 @@ export declare const PyProjectSchema: z.ZodObject<{
|
|
272
277
|
} | undefined> | undefined;
|
273
278
|
} | undefined;
|
274
279
|
} | undefined;
|
275
|
-
'build-system'?: {
|
276
|
-
requires?: string[] | undefined;
|
277
|
-
'build-backend'?: string | undefined;
|
278
|
-
} | undefined;
|
279
|
-
'dependency-groups'?: Record<string, string[]> | undefined;
|
280
280
|
}, {
|
281
281
|
project?: {
|
282
|
-
version?: unknown;
|
283
282
|
dependencies?: string[] | undefined;
|
283
|
+
version?: unknown;
|
284
284
|
'requires-python'?: string | undefined;
|
285
285
|
'optional-dependencies'?: Record<string, string[]> | undefined;
|
286
286
|
} | undefined;
|
287
|
+
'build-system'?: {
|
288
|
+
requires?: string[] | undefined;
|
289
|
+
'build-backend'?: string | undefined;
|
290
|
+
} | undefined;
|
291
|
+
'dependency-groups'?: Record<string, any[]> | undefined;
|
287
292
|
tool?: {
|
288
293
|
uv?: {
|
294
|
+
sources?: Record<string, any> | undefined;
|
295
|
+
'dev-dependencies'?: string[] | undefined;
|
289
296
|
index?: {
|
290
297
|
name: string;
|
291
298
|
url: string;
|
292
|
-
explicit?: boolean | undefined;
|
293
299
|
default?: boolean | undefined;
|
300
|
+
explicit?: boolean | undefined;
|
294
301
|
}[] | undefined;
|
295
|
-
sources?: Record<string, any> | undefined;
|
296
|
-
'dev-dependencies'?: string[] | undefined;
|
297
302
|
} | undefined;
|
298
303
|
pdm?: {
|
299
304
|
source?: {
|
@@ -310,11 +315,6 @@ export declare const PyProjectSchema: z.ZodObject<{
|
|
310
315
|
} | undefined> | undefined;
|
311
316
|
} | undefined;
|
312
317
|
} | undefined;
|
313
|
-
'build-system'?: {
|
314
|
-
requires?: string[] | undefined;
|
315
|
-
'build-backend'?: string | undefined;
|
316
|
-
} | undefined;
|
317
|
-
'dependency-groups'?: Record<string, any[]> | undefined;
|
318
318
|
}>;
|
319
319
|
export declare const PdmLockfileSchema: z.ZodEffects<z.ZodEffects<z.ZodPipeline<z.ZodEffects<z.ZodString, unknown, string>, z.ZodObject<{
|
320
320
|
package: z.ZodEffects<z.ZodArray<z.ZodAny, "many">, {
|
@@ -108,7 +108,7 @@ function parseDependencyList(depType, list) {
|
|
108
108
|
}
|
109
109
|
function parsePyProject(packageFile, content) {
|
110
110
|
try {
|
111
|
-
const jsonMap = (0, toml_1.parse)(content);
|
111
|
+
const jsonMap = (0, toml_1.parse)((0, toml_1.massage)(content));
|
112
112
|
return schema_1.PyProjectSchema.parse(jsonMap);
|
113
113
|
}
|
114
114
|
catch (err) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/modules/manager/pep621/utils.ts"],"names":[],"mappings":";;;AAyBA,kCAuCC;AAED,8DA0BC;AAED,gEAmBC;AAED,kDAgBC;AAED,wCAcC;;AAnJD,kEAAkC;AAClC,4CAAyC;AACzC,+CAA4C;AAC5C,
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/modules/manager/pep621/utils.ts"],"names":[],"mappings":";;;AAyBA,kCAuCC;A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QACjB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,cAAc,CAC5B,WAAmB,EACnB,OAAe;IAEf,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAA,YAAS,EAAC,IAAA,cAAW,EAAC,OAAO,CAAC,CAAC,CAAC;QAChD,OAAO,wBAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAM,CAAC,KAAK,CACV,EAAE,WAAW,EAAE,GAAG,EAAE,EACpB,6CAA6C,CAC9C,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { logger } from '../../../logger';\nimport { regEx } from '../../../util/regex';\nimport { massage as massageToml, parse as parseToml } from '../../../util/toml';\nimport { PypiDatasource } from '../../datasource/pypi';\nimport { normalizePythonDepName } from '../../datasource/pypi/common';\nimport type { PackageDependency } from '../types';\nimport type { PyProject } from './schema';\nimport { PyProjectSchema } from './schema';\nimport type { Pep508ParseResult, Pep621ManagerData } from './types';\n\nconst pep508Regex = regEx(\n /^(?<packageName>[A-Z0-9._-]+)\\s*(\\[(?<extras>[A-Z0-9\\s,._-]+)\\])?\\s*(?<currentValue>[^;]+)?(;\\s*(?<marker>.*))?/i,\n);\n\nexport const depTypes = {\n dependencies: 'project.dependencies',\n optionalDependencies: 'project.optional-dependencies',\n dependencyGroups: 'dependency-groups',\n pdmDevDependencies: 'tool.pdm.dev-dependencies',\n uvDevDependencies: 'tool.uv.dev-dependencies',\n uvSources: 'tool.uv.sources',\n buildSystemRequires: 'build-system.requires',\n};\n\nexport function parsePEP508(\n value: string | null | undefined,\n): Pep508ParseResult | null {\n if (is.nullOrUndefined(value)) {\n return null;\n }\n\n const regExpExec = pep508Regex.exec(value);\n if (\n is.nullOrUndefined(regExpExec) ||\n is.nullOrUndefined(regExpExec?.groups)\n ) {\n logger.trace(`Pep508 could not be extracted`);\n return null;\n }\n\n const result: Pep508ParseResult = {\n packageName: regExpExec.groups.packageName,\n };\n if (is.nonEmptyString(regExpExec.groups.currentValue)) {\n if (\n regExpExec.groups.currentValue.startsWith('(') &&\n regExpExec.groups.currentValue.endsWith(')')\n ) {\n result.currentValue = regExpExec.groups.currentValue.slice(1, -1).trim();\n } else {\n result.currentValue = regExpExec.groups.currentValue;\n }\n }\n\n if (is.nonEmptyString(regExpExec.groups.marker)) {\n result.marker = regExpExec.groups.marker;\n }\n if (is.nonEmptyString(regExpExec.groups.extras)) {\n // trim to remove allowed whitespace between brackets\n result.extras = regExpExec.groups.extras.split(',').map((e) => e.trim());\n }\n\n return result;\n}\n\nexport function pep508ToPackageDependency(\n depType: string,\n value: string,\n): PackageDependency | null {\n const parsed = parsePEP508(value);\n if (is.nullOrUndefined(parsed)) {\n return null;\n }\n\n const dep: PackageDependency = {\n packageName: normalizePythonDepName(parsed.packageName),\n depName: parsed.packageName,\n datasource: PypiDatasource.id,\n depType,\n };\n\n if (is.nullOrUndefined(parsed.currentValue)) {\n dep.skipReason = 'unspecified-version';\n } else {\n dep.currentValue = parsed.currentValue;\n\n if (parsed.currentValue.startsWith('==')) {\n dep.currentVersion = parsed.currentValue.replace(regEx(/^==\\s*/), '');\n }\n }\n return dep;\n}\n\nexport function parseDependencyGroupRecord(\n depType: string,\n records: Record<string, string[]> | null | undefined,\n): PackageDependency[] {\n if (is.nullOrUndefined(records)) {\n return [];\n }\n\n const deps: PackageDependency<Pep621ManagerData>[] = [];\n for (const [depGroup, pep508Strings] of Object.entries(records)) {\n for (const dep of parseDependencyList(depType, pep508Strings)) {\n deps.push({\n ...dep,\n depName: dep.packageName!,\n managerData: { depGroup },\n });\n }\n }\n return deps;\n}\n\nexport function parseDependencyList(\n depType: string,\n list: string[] | null | undefined,\n): PackageDependency[] {\n if (is.nullOrUndefined(list)) {\n return [];\n }\n\n const deps: PackageDependency[] = [];\n for (const element of list) {\n const dep = pep508ToPackageDependency(depType, element);\n if (is.truthy(dep)) {\n deps.push(dep);\n }\n }\n return deps;\n}\n\nexport function parsePyProject(\n packageFile: string,\n content: string,\n): PyProject | null {\n try {\n const jsonMap = parseToml(massageToml(content));\n return PyProjectSchema.parse(jsonMap);\n } catch (err) {\n logger.debug(\n { packageFile, err },\n `Failed to parse and validate pyproject file`,\n );\n return null;\n }\n}\n"]}
|
@@ -21,7 +21,7 @@ const util_1 = require("../../datasource/util");
|
|
21
21
|
const schema_1 = require("./schema");
|
22
22
|
function getPythonConstraint(pyProjectContent, existingLockFileContent) {
|
23
23
|
// Read Python version from `pyproject.toml` first as it could have been updated
|
24
|
-
const pyprojectPythonConstraint = result_1.Result.parse(pyProjectContent, schema_1.PoetrySchemaToml.transform(({ packageFileContent }) => packageFileContent.deps.find((dep) => dep.depName === 'python')
|
24
|
+
const pyprojectPythonConstraint = result_1.Result.parse((0, toml_1.massage)(pyProjectContent), schema_1.PoetrySchemaToml.transform(({ packageFileContent }) => packageFileContent.deps.find((dep) => dep.depName === 'python')
|
25
25
|
?.currentValue)).unwrapOrNull();
|
26
26
|
if (pyprojectPythonConstraint) {
|
27
27
|
logger_1.logger.debug('Using python version from pyproject.toml');
|
@@ -48,7 +48,7 @@ function getPoetryRequirement(pyProjectContent, existingLockFileContent) {
|
|
48
48
|
logger_1.logger.debug(`Using poetry version ${lockfilePoetryConstraint} from poetry.lock metadata`);
|
49
49
|
return lockfilePoetryConstraint;
|
50
50
|
}
|
51
|
-
const { val: pyprojectPoetryConstraint } = result_1.Result.parse(pyProjectContent, schema_1.PoetrySchemaToml.transform(({ poetryRequirement }) => poetryRequirement)).unwrap();
|
51
|
+
const { val: pyprojectPoetryConstraint } = result_1.Result.parse((0, toml_1.massage)(pyProjectContent), schema_1.PoetrySchemaToml.transform(({ poetryRequirement }) => poetryRequirement)).unwrap();
|
52
52
|
if (pyprojectPoetryConstraint) {
|
53
53
|
logger_1.logger.debug(`Using poetry version ${pyprojectPoetryConstraint} from pyproject.toml`);
|
54
54
|
return pyprojectPoetryConstraint;
|
@@ -58,7 +58,7 @@ function getPoetryRequirement(pyProjectContent, existingLockFileContent) {
|
|
58
58
|
function getPoetrySources(content, fileName) {
|
59
59
|
let pyprojectFile;
|
60
60
|
try {
|
61
|
-
pyprojectFile = (0, toml_1.parse)(content);
|
61
|
+
pyprojectFile = (0, toml_1.parse)((0, toml_1.massage)(content));
|
62
62
|
}
|
63
63
|
catch (err) {
|
64
64
|
logger_1.logger.debug({ err }, 'Error parsing pyproject.toml file');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../../lib/modules/manager/poetry/artifacts.ts"],"names":[],"mappings":";;AA0BA,kDA4BC;AAED,oDAsCC;AAyED,0CAiGC;;AAxQD,kEAAkC;AAClC,iCAA8B;AAC9B,sEAAoE;AACpE,4CAAyC;AAEzC,6CAA0C;AAE1C,yCAM0B;AAC1B,iDAAoE;AACpE,yDAAgD;AAChD,+CAA4C;AAC5C,iDAA8C;AAC9C,6CAAwD;AACxD,2CAA6C;AAC7C,gDAAuD;AACvD,gDAA8D;AAE9D,qCAAsD;AAGtD,SAAgB,mBAAmB,CACjC,gBAAwB,EACxB,uBAA+B;IAE/B,gFAAgF;IAChF,MAAM,yBAAyB,GAAG,eAAM,CAAC,KAAK,CAC5C,gBAAgB,EAChB,yBAAgB,CAAC,SAAS,CACxB,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE,CACzB,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC;QAC7D,EAAE,YAAY,CACnB,CACF,CAAC,YAAY,EAAE,CAAC;IACjB,IAAI,yBAAyB,EAAE,CAAC;QAC9B,eAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QACzD,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,MAAM,wBAAwB,GAAG,eAAM,CAAC,KAAK,CA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BAAiB,EAAE,MAAM,CAAC,GAAG;YAC7B,eAAe,EAAE;gBACf,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE;gBACpD,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE;aACrD;SACF,CAAC;QACF,MAAM,IAAA,WAAI,EAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QAC7B,MAAM,oBAAoB,GAAG,MAAM,IAAA,kBAAa,EAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACvE,IAAI,uBAAuB,KAAK,oBAAoB,EAAE,CAAC;YACrD,eAAM,CAAC,KAAK,CAAC,GAAG,YAAY,eAAe,CAAC,CAAC;YAC7C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,eAAM,CAAC,KAAK,CAAC,qBAAqB,YAAY,EAAE,CAAC,CAAC;QAClD,OAAO;YACL;gBACE,IAAI,EAAE;oBACJ,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,YAAY;oBAClB,QAAQ,EAAE,oBAAoB;iBAC/B;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,qBAAqB;QACrB,IAAI,GAAG,CAAC,OAAO,KAAK,gCAAe,EAAE,CAAC;YACpC,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,eAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,oBAAoB,YAAY,OAAO,CAAC,CAAC;QAC/D,OAAO;YACL;gBACE,aAAa,EAAE;oBACb,QAAQ,EAAE,YAAY;oBACtB,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;iBACvD;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages';\nimport { logger } from '../../../logger';\nimport type { HostRule } from '../../../types';\nimport { exec } from '../../../util/exec';\nimport type { ExecOptions } from '../../../util/exec/types';\nimport {\n deleteLocalFile,\n ensureCacheDir,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs';\nimport { getGitEnvironmentVariables } from '../../../util/git/auth';\nimport { find } from '../../../util/host-rules';\nimport { regEx } from '../../../util/regex';\nimport { Result } from '../../../util/result';\nimport { parse as parseToml } from '../../../util/toml';\nimport { parseUrl } from '../../../util/url';\nimport { PypiDatasource } from '../../datasource/pypi';\nimport { getGoogleAuthHostRule } from '../../datasource/util';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types';\nimport { Lockfile, PoetrySchemaToml } from './schema';\nimport type { PoetryFile, PoetrySource } from './types';\n\nexport function getPythonConstraint(\n pyProjectContent: string,\n existingLockFileContent: string,\n): string | null {\n // Read Python version from `pyproject.toml` first as it could have been updated\n const pyprojectPythonConstraint = Result.parse(\n pyProjectContent,\n PoetrySchemaToml.transform(\n ({ packageFileContent }) =>\n packageFileContent.deps.find((dep) => dep.depName === 'python')\n ?.currentValue,\n ),\n ).unwrapOrNull();\n if (pyprojectPythonConstraint) {\n logger.debug('Using python version from pyproject.toml');\n return pyprojectPythonConstraint;\n }\n\n const lockfilePythonConstraint = Result.parse(\n existingLockFileContent,\n Lockfile.transform(({ pythonVersions }) => pythonVersions),\n ).unwrapOrNull();\n if (lockfilePythonConstraint) {\n logger.debug('Using python version from poetry.lock');\n return lockfilePythonConstraint;\n }\n\n return null;\n}\n\nexport function getPoetryRequirement(\n pyProjectContent: string,\n existingLockFileContent: string,\n): undefined | string | null {\n // Read Poetry version from first line of poetry.lock\n const firstLine = existingLockFileContent.split('\\n')[0];\n const poetryVersionMatch = /by Poetry ([\\d\\\\.]+)/.exec(firstLine);\n if (poetryVersionMatch?.[1]) {\n const poetryVersion = poetryVersionMatch[1];\n logger.debug(\n `Using poetry version ${poetryVersion} from poetry.lock header`,\n );\n return poetryVersion;\n }\n\n const { val: lockfilePoetryConstraint } = Result.parse(\n existingLockFileContent,\n Lockfile.transform(({ poetryConstraint }) => poetryConstraint),\n ).unwrap();\n if (lockfilePoetryConstraint) {\n logger.debug(\n `Using poetry version ${lockfilePoetryConstraint} from poetry.lock metadata`,\n );\n return lockfilePoetryConstraint;\n }\n\n const { val: pyprojectPoetryConstraint } = Result.parse(\n pyProjectContent,\n PoetrySchemaToml.transform(({ poetryRequirement }) => poetryRequirement),\n ).unwrap();\n if (pyprojectPoetryConstraint) {\n logger.debug(\n `Using poetry version ${pyprojectPoetryConstraint} from pyproject.toml`,\n );\n return pyprojectPoetryConstraint;\n }\n\n return null;\n}\n\nfunction getPoetrySources(content: string, fileName: string): PoetrySource[] {\n let pyprojectFile: PoetryFile;\n try {\n pyprojectFile = parseToml(content) as PoetryFile;\n } catch (err) {\n logger.debug({ err }, 'Error parsing pyproject.toml file');\n return [];\n }\n if (!pyprojectFile.tool?.poetry) {\n logger.debug(`${fileName} contains no poetry section`);\n return [];\n }\n\n const sources = pyprojectFile.tool?.poetry?.source ?? [];\n const sourceArray: PoetrySource[] = [];\n for (const source of sources) {\n if (source.name && source.url) {\n sourceArray.push({ name: source.name, url: source.url });\n }\n }\n return sourceArray;\n}\n\nasync function getMatchingHostRule(url: string | undefined): Promise<HostRule> {\n const scopedMatch = find({ hostType: PypiDatasource.id, url });\n const hostRule = is.nonEmptyObject(scopedMatch) ? scopedMatch : find({ url });\n if (hostRule && Object.keys(hostRule).length !== 0) {\n return hostRule;\n }\n\n const parsedUrl = parseUrl(url);\n if (!parsedUrl) {\n logger.once.debug(`Failed to parse URL ${url}`);\n return {};\n }\n\n if (parsedUrl.hostname.endsWith('.pkg.dev')) {\n const hostRule = await getGoogleAuthHostRule();\n if (hostRule && Object.keys(hostRule).length !== 0) {\n return hostRule;\n }\n logger.once.debug(`Could not get Google access token (url=${url})`);\n }\n\n return {};\n}\n\nasync function getSourceCredentialVars(\n pyprojectContent: string,\n packageFileName: string,\n): Promise<NodeJS.ProcessEnv> {\n const poetrySources = getPoetrySources(pyprojectContent, packageFileName);\n const envVars: NodeJS.ProcessEnv = {};\n\n for (const source of poetrySources) {\n const matchingHostRule = await getMatchingHostRule(source.url);\n const formattedSourceName = source.name\n .replace(regEx(/(\\.|-)+/g), '_')\n .toUpperCase();\n if (matchingHostRule.username) {\n envVars[`POETRY_HTTP_BASIC_${formattedSourceName}_USERNAME`] =\n matchingHostRule.username;\n }\n if (matchingHostRule.password) {\n envVars[`POETRY_HTTP_BASIC_${formattedSourceName}_PASSWORD`] =\n matchingHostRule.password;\n }\n }\n return envVars;\n}\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`poetry.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (!is.nonEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('No updated poetry deps - returning null');\n return null;\n }\n // Try poetry.lock first\n let lockFileName = getSiblingFileName(packageFileName, 'poetry.lock');\n let existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n // Try pyproject.lock next\n lockFileName = getSiblingFileName(packageFileName, 'pyproject.lock');\n existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.debug(`No lock file found`);\n return null;\n }\n }\n logger.debug(`Updating ${lockFileName}`);\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n const cmd: string[] = [];\n if (isLockFileMaintenance) {\n await deleteLocalFile(lockFileName);\n cmd.push('poetry update --lock --no-interaction');\n } else {\n cmd.push(\n `poetry update --lock --no-interaction ${updatedDeps\n .map((dep) => dep.depName)\n .filter(is.string)\n .map((dep) => quote(dep))\n .join(' ')}`,\n );\n }\n const pythonConstraint =\n config?.constraints?.python ??\n getPythonConstraint(newPackageFileContent, existingLockFileContent);\n const poetryConstraint =\n config.constraints?.poetry ??\n getPoetryRequirement(newPackageFileContent, existingLockFileContent);\n const extraEnv = {\n ...(await getSourceCredentialVars(\n newPackageFileContent,\n packageFileName,\n )),\n ...getGitEnvironmentVariables(['poetry']),\n PIP_CACHE_DIR: await ensureCacheDir('pip'),\n };\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv,\n docker: {},\n userConfiguredEnv: config.env,\n toolConstraints: [\n { toolName: 'python', constraint: pythonConstraint },\n { toolName: 'poetry', constraint: poetryConstraint },\n ],\n };\n await exec(cmd, execOptions);\n const newPoetryLockContent = await readLocalFile(lockFileName, 'utf8');\n if (existingLockFileContent === newPoetryLockContent) {\n logger.debug(`${lockFileName} is unchanged`);\n return null;\n }\n logger.debug(`Returning updated ${lockFileName}`);\n return [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: newPoetryLockContent,\n },\n },\n ];\n } catch (err) {\n // istanbul ignore if\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.debug({ err }, `Failed to update ${lockFileName} file`);\n return [\n {\n artifactError: {\n lockFile: lockFileName,\n stderr: `${String(err.stdout)}\\n${String(err.stderr)}`,\n },\n },\n ];\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../../lib/modules/manager/poetry/artifacts.ts"],"names":[],"mappings":";;AA0BA,kDA4BC;AAED,oDAsCC;AAyED,0CAiGC;;AAxQD,kEAAkC;AAClC,iCAA8B;AAC9B,sEAAoE;AACpE,4CAAyC;AAEzC,6CAA0C;AAE1C,yCAM0B;AAC1B,iDAAoE;AACpE,yDAAgD;AAChD,+CAA4C;AAC5C,iDAA8C;AAC9C,6CAAgF;AAChF,2CAA6C;AAC7C,gDAAuD;AACvD,gDAA8D;AAE9D,qCAAsD;AAGtD,SAAgB,mBAAmB,CACjC,gBAAwB,EACxB,uBAA+B;IAE/B,gFAAgF;IAChF,MAAM,yBAAyB,GAAG,eAAM,CAAC,KAAK,CAC5C,IAAA,cAAW,EAAC,gBAAgB,CAA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,gCAAe,EAAE,CAAC;YACpC,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,eAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,oBAAoB,YAAY,OAAO,CAAC,CAAC;QAC/D,OAAO;YACL;gBACE,aAAa,EAAE;oBACb,QAAQ,EAAE,YAAY;oBACtB,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;iBACvD;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { quote } from 'shlex';\nimport { TEMPORARY_ERROR } from '../../../constants/error-messages';\nimport { logger } from '../../../logger';\nimport type { HostRule } from '../../../types';\nimport { exec } from '../../../util/exec';\nimport type { ExecOptions } from '../../../util/exec/types';\nimport {\n deleteLocalFile,\n ensureCacheDir,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../util/fs';\nimport { getGitEnvironmentVariables } from '../../../util/git/auth';\nimport { find } from '../../../util/host-rules';\nimport { regEx } from '../../../util/regex';\nimport { Result } from '../../../util/result';\nimport { massage as massageToml, parse as parseToml } from '../../../util/toml';\nimport { parseUrl } from '../../../util/url';\nimport { PypiDatasource } from '../../datasource/pypi';\nimport { getGoogleAuthHostRule } from '../../datasource/util';\nimport type { UpdateArtifact, UpdateArtifactsResult } from '../types';\nimport { Lockfile, PoetrySchemaToml } from './schema';\nimport type { PoetryFile, PoetrySource } from './types';\n\nexport function getPythonConstraint(\n pyProjectContent: string,\n existingLockFileContent: string,\n): string | null {\n // Read Python version from `pyproject.toml` first as it could have been updated\n const pyprojectPythonConstraint = Result.parse(\n massageToml(pyProjectContent),\n PoetrySchemaToml.transform(\n ({ packageFileContent }) =>\n packageFileContent.deps.find((dep) => dep.depName === 'python')\n ?.currentValue,\n ),\n ).unwrapOrNull();\n if (pyprojectPythonConstraint) {\n logger.debug('Using python version from pyproject.toml');\n return pyprojectPythonConstraint;\n }\n\n const lockfilePythonConstraint = Result.parse(\n existingLockFileContent,\n Lockfile.transform(({ pythonVersions }) => pythonVersions),\n ).unwrapOrNull();\n if (lockfilePythonConstraint) {\n logger.debug('Using python version from poetry.lock');\n return lockfilePythonConstraint;\n }\n\n return null;\n}\n\nexport function getPoetryRequirement(\n pyProjectContent: string,\n existingLockFileContent: string,\n): undefined | string | null {\n // Read Poetry version from first line of poetry.lock\n const firstLine = existingLockFileContent.split('\\n')[0];\n const poetryVersionMatch = /by Poetry ([\\d\\\\.]+)/.exec(firstLine);\n if (poetryVersionMatch?.[1]) {\n const poetryVersion = poetryVersionMatch[1];\n logger.debug(\n `Using poetry version ${poetryVersion} from poetry.lock header`,\n );\n return poetryVersion;\n }\n\n const { val: lockfilePoetryConstraint } = Result.parse(\n existingLockFileContent,\n Lockfile.transform(({ poetryConstraint }) => poetryConstraint),\n ).unwrap();\n if (lockfilePoetryConstraint) {\n logger.debug(\n `Using poetry version ${lockfilePoetryConstraint} from poetry.lock metadata`,\n );\n return lockfilePoetryConstraint;\n }\n\n const { val: pyprojectPoetryConstraint } = Result.parse(\n massageToml(pyProjectContent),\n PoetrySchemaToml.transform(({ poetryRequirement }) => poetryRequirement),\n ).unwrap();\n if (pyprojectPoetryConstraint) {\n logger.debug(\n `Using poetry version ${pyprojectPoetryConstraint} from pyproject.toml`,\n );\n return pyprojectPoetryConstraint;\n }\n\n return null;\n}\n\nfunction getPoetrySources(content: string, fileName: string): PoetrySource[] {\n let pyprojectFile: PoetryFile;\n try {\n pyprojectFile = parseToml(massageToml(content)) as PoetryFile;\n } catch (err) {\n logger.debug({ err }, 'Error parsing pyproject.toml file');\n return [];\n }\n if (!pyprojectFile.tool?.poetry) {\n logger.debug(`${fileName} contains no poetry section`);\n return [];\n }\n\n const sources = pyprojectFile.tool?.poetry?.source ?? [];\n const sourceArray: PoetrySource[] = [];\n for (const source of sources) {\n if (source.name && source.url) {\n sourceArray.push({ name: source.name, url: source.url });\n }\n }\n return sourceArray;\n}\n\nasync function getMatchingHostRule(url: string | undefined): Promise<HostRule> {\n const scopedMatch = find({ hostType: PypiDatasource.id, url });\n const hostRule = is.nonEmptyObject(scopedMatch) ? scopedMatch : find({ url });\n if (hostRule && Object.keys(hostRule).length !== 0) {\n return hostRule;\n }\n\n const parsedUrl = parseUrl(url);\n if (!parsedUrl) {\n logger.once.debug(`Failed to parse URL ${url}`);\n return {};\n }\n\n if (parsedUrl.hostname.endsWith('.pkg.dev')) {\n const hostRule = await getGoogleAuthHostRule();\n if (hostRule && Object.keys(hostRule).length !== 0) {\n return hostRule;\n }\n logger.once.debug(`Could not get Google access token (url=${url})`);\n }\n\n return {};\n}\n\nasync function getSourceCredentialVars(\n pyprojectContent: string,\n packageFileName: string,\n): Promise<NodeJS.ProcessEnv> {\n const poetrySources = getPoetrySources(pyprojectContent, packageFileName);\n const envVars: NodeJS.ProcessEnv = {};\n\n for (const source of poetrySources) {\n const matchingHostRule = await getMatchingHostRule(source.url);\n const formattedSourceName = source.name\n .replace(regEx(/(\\.|-)+/g), '_')\n .toUpperCase();\n if (matchingHostRule.username) {\n envVars[`POETRY_HTTP_BASIC_${formattedSourceName}_USERNAME`] =\n matchingHostRule.username;\n }\n if (matchingHostRule.password) {\n envVars[`POETRY_HTTP_BASIC_${formattedSourceName}_PASSWORD`] =\n matchingHostRule.password;\n }\n }\n return envVars;\n}\n\nexport async function updateArtifacts({\n packageFileName,\n updatedDeps,\n newPackageFileContent,\n config,\n}: UpdateArtifact): Promise<UpdateArtifactsResult[] | null> {\n logger.debug(`poetry.updateArtifacts(${packageFileName})`);\n const { isLockFileMaintenance } = config;\n\n if (!is.nonEmptyArray(updatedDeps) && !isLockFileMaintenance) {\n logger.debug('No updated poetry deps - returning null');\n return null;\n }\n // Try poetry.lock first\n let lockFileName = getSiblingFileName(packageFileName, 'poetry.lock');\n let existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n // Try pyproject.lock next\n lockFileName = getSiblingFileName(packageFileName, 'pyproject.lock');\n existingLockFileContent = await readLocalFile(lockFileName, 'utf8');\n if (!existingLockFileContent) {\n logger.debug(`No lock file found`);\n return null;\n }\n }\n logger.debug(`Updating ${lockFileName}`);\n try {\n await writeLocalFile(packageFileName, newPackageFileContent);\n const cmd: string[] = [];\n if (isLockFileMaintenance) {\n await deleteLocalFile(lockFileName);\n cmd.push('poetry update --lock --no-interaction');\n } else {\n cmd.push(\n `poetry update --lock --no-interaction ${updatedDeps\n .map((dep) => dep.depName)\n .filter(is.string)\n .map((dep) => quote(dep))\n .join(' ')}`,\n );\n }\n const pythonConstraint =\n config?.constraints?.python ??\n getPythonConstraint(newPackageFileContent, existingLockFileContent);\n const poetryConstraint =\n config.constraints?.poetry ??\n getPoetryRequirement(newPackageFileContent, existingLockFileContent);\n const extraEnv = {\n ...(await getSourceCredentialVars(\n newPackageFileContent,\n packageFileName,\n )),\n ...getGitEnvironmentVariables(['poetry']),\n PIP_CACHE_DIR: await ensureCacheDir('pip'),\n };\n\n const execOptions: ExecOptions = {\n cwdFile: packageFileName,\n extraEnv,\n docker: {},\n userConfiguredEnv: config.env,\n toolConstraints: [\n { toolName: 'python', constraint: pythonConstraint },\n { toolName: 'poetry', constraint: poetryConstraint },\n ],\n };\n await exec(cmd, execOptions);\n const newPoetryLockContent = await readLocalFile(lockFileName, 'utf8');\n if (existingLockFileContent === newPoetryLockContent) {\n logger.debug(`${lockFileName} is unchanged`);\n return null;\n }\n logger.debug(`Returning updated ${lockFileName}`);\n return [\n {\n file: {\n type: 'addition',\n path: lockFileName,\n contents: newPoetryLockContent,\n },\n },\n ];\n } catch (err) {\n // istanbul ignore if\n if (err.message === TEMPORARY_ERROR) {\n throw err;\n }\n logger.debug({ err }, `Failed to update ${lockFileName} file`);\n return [\n {\n artifactError: {\n lockFile: lockFileName,\n stderr: `${String(err.stdout)}\\n${String(err.stderr)}`,\n },\n },\n ];\n }\n}\n"]}
|
@@ -7,11 +7,12 @@ const logger_1 = require("../../../logger");
|
|
7
7
|
const filter_map_1 = require("../../../util/filter-map");
|
8
8
|
const fs_1 = require("../../../util/fs");
|
9
9
|
const result_1 = require("../../../util/result");
|
10
|
+
const toml_1 = require("../../../util/toml");
|
10
11
|
const github_releases_1 = require("../../datasource/github-releases");
|
11
12
|
const schema_1 = require("./schema");
|
12
13
|
async function extractPackageFile(content, packageFile) {
|
13
14
|
logger_1.logger.trace(`poetry.extractPackageFile(${packageFile})`);
|
14
|
-
const { val: res, err } = result_1.Result.parse(content, schema_1.PoetrySchemaToml.transform(({ packageFileContent }) => packageFileContent)).unwrap();
|
15
|
+
const { val: res, err } = result_1.Result.parse((0, toml_1.massage)(content), schema_1.PoetrySchemaToml.transform(({ packageFileContent }) => packageFileContent)).unwrap();
|
15
16
|
if (err) {
|
16
17
|
logger_1.logger.debug({ packageFile, err }, `Poetry: error parsing pyproject.toml`);
|
17
18
|
return null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../../../lib/modules/manager/poetry/extract.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../../../lib/modules/manager/poetry/extract.ts"],"names":[],"mappings":";;AAcA,gDAsEC;;AApFD,kEAAkC;AAClC,4CAAyC;AACzC,yDAAqD;AACrD,yCAI0B;AAC1B,iDAA8C;AAC9C,6CAA4D;AAC5D,sEAA4E;AAE5E,qCAAsD;AAE/C,KAAK,UAAU,kBAAkB,CACtC,OAAe,EACf,WAAmB;IAEnB,eAAM,CAAC,KAAK,CAAC,6BAA6B,WAAW,GAAG,CAAC,CAAC;IAC1D,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,eAAM,CAAC,KAAK,CACpC,IAAA,cAAW,EAAC,OAAO,CAAC,EACpB,yBAAgB,CAAC,SAAS,CAAC,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAC3E,CAA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AI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,oBAAoB,GAAwB,EAAE,CAAC;IAErD,IAAI,YAAE,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC;QACrC,oBAAoB,CAAC,MAAM,GAAG,aAAa,CAAC;IAC9C,CAAC;IACD,GAAG,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IAEhD,wBAAwB;IACxB,IAAI,QAAQ,GAAG,IAAA,uBAAkB,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC9D,uBAAuB;IACvB,IAAI,MAAM,IAAA,oBAAe,EAAC,QAAQ,CAAC,EAAE,CAAC;QACpC,GAAG,CAAC,SAAS,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;SAAM,CAAC;QACN,0BAA0B;QAC1B,QAAQ,GAAG,IAAA,uBAAkB,EAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;QAC7D,IAAI,MAAM,IAAA,oBAAe,EAAC,QAAQ,CAAC,EAAE,CAAC;YACpC,GAAG,CAAC,SAAS,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { logger } from '../../../logger';\nimport { filterMap } from '../../../util/filter-map';\nimport {\n getSiblingFileName,\n localPathExists,\n readLocalFile,\n} from '../../../util/fs';\nimport { Result } from '../../../util/result';\nimport { massage as massageToml } from '../../../util/toml';\nimport { GithubReleasesDatasource } from '../../datasource/github-releases';\nimport type { PackageFileContent } from '../types';\nimport { Lockfile, PoetrySchemaToml } from './schema';\n\nexport async function extractPackageFile(\n content: string,\n packageFile: string,\n): Promise<PackageFileContent | null> {\n logger.trace(`poetry.extractPackageFile(${packageFile})`);\n const { val: res, err } = Result.parse(\n massageToml(content),\n PoetrySchemaToml.transform(({ packageFileContent }) => packageFileContent),\n ).unwrap();\n if (err) {\n logger.debug({ packageFile, err }, `Poetry: error parsing pyproject.toml`);\n return null;\n }\n\n const lockfileName = getSiblingFileName(packageFile, 'poetry.lock');\n const lockContents = (await readLocalFile(lockfileName, 'utf8'))!;\n const lockfileMapping = Result.parse(\n lockContents,\n Lockfile.transform(({ lock }) => lock),\n ).unwrapOr({});\n\n let pythonVersion: string | undefined;\n filterMap(res.deps, (dep) => {\n if (dep.depName === 'python') {\n if (dep.currentValue) {\n pythonVersion = dep.currentValue;\n }\n return {\n ...dep,\n // We use containerbase python as source, as there are a lot docker tags which can cause\n // issues with poetry versioning.\n packageName: 'containerbase/python-prebuild',\n datasource: GithubReleasesDatasource.id,\n commitMessageTopic: 'Python',\n registryUrls: null,\n };\n }\n\n const packageName = dep.packageName ?? dep.depName;\n if (packageName && packageName in lockfileMapping) {\n dep.lockedVersion = lockfileMapping[packageName];\n }\n\n return dep;\n });\n\n if (!res.deps.length) {\n return null;\n }\n\n const extractedConstraints: Record<string, any> = {};\n\n if (is.nonEmptyString(pythonVersion)) {\n extractedConstraints.python = pythonVersion;\n }\n res.extractedConstraints = extractedConstraints;\n\n // Try poetry.lock first\n let lockFile = getSiblingFileName(packageFile, 'poetry.lock');\n // istanbul ignore next\n if (await localPathExists(lockFile)) {\n res.lockFiles = [lockFile];\n } else {\n // Try pyproject.lock next\n lockFile = getSiblingFileName(packageFile, 'pyproject.lock');\n if (await localPathExists(lockFile)) {\n res.lockFiles = [lockFile];\n }\n }\n return res;\n}\n"]}
|