diff --git a/lib/modules/manager/pub/extract.spec.ts b/lib/modules/manager/pub/extract.spec.ts index ce33cd01f376b6..d9897408abea6e 100644 --- a/lib/modules/manager/pub/extract.spec.ts +++ b/lib/modules/manager/pub/extract.spec.ts @@ -42,7 +42,13 @@ describe('modules/manager/pub/extract', () => { dependencies: meta: 'something' foo: 1.0.0 + transmogrify: + hosted: + name: transmogrify + url: https://some-package-server.com + version: ^1.4.0 bar: + hosted: 'some-url' version: 1.1.0 baz: non-sense: true @@ -68,12 +74,20 @@ describe('modules/manager/pub/extract', () => { datasource: dartDatasource, skipReason, }, + { + currentValue: '^1.4.0', + depName: 'transmogrify', + depType: dependenciesDepType, + datasource: dartDatasource, + registryUrls: ['https://some-package-server.com'], + }, { currentValue: '1.1.0', depName: 'bar', depType: dependenciesDepType, datasource: dartDatasource, skipReason, + registryUrls: ['some-url'], }, { currentValue: '', diff --git a/lib/modules/manager/pub/extract.ts b/lib/modules/manager/pub/extract.ts index 87d37223e818ce..f83cbdf320c737 100644 --- a/lib/modules/manager/pub/extract.ts +++ b/lib/modules/manager/pub/extract.ts @@ -31,10 +31,19 @@ function extractFromSection( let currentValue = sectionContent[depName]; let skipReason: SkipReason | undefined; + let registryUrls: string[] | undefined; if (!is.string(currentValue)) { const version = currentValue.version; const path = currentValue.path; + const hosted = currentValue.hosted; + + if (is.string(hosted)) { + registryUrls = [hosted]; + } else if (is.string(hosted?.url)) { + registryUrls = [hosted.url]; + } + if (version) { currentValue = version; } else if (path) { @@ -50,6 +59,7 @@ function extractFromSection( depType: sectionKey, currentValue, datasource: DartDatasource.id, + ...(registryUrls && { registryUrls }), skipReason, }); } diff --git a/lib/modules/manager/pub/schema.ts b/lib/modules/manager/pub/schema.ts index 667cc063b5c3c0..f7c57158dc7e58 100644 --- a/lib/modules/manager/pub/schema.ts +++ b/lib/modules/manager/pub/schema.ts @@ -5,7 +5,14 @@ const PubspecDependencySchema = LooseRecord( z.string(), z.union([ z.string(), - z.object({ version: z.string().optional(), path: z.string().optional() }), + z.object({ + version: z.string().optional(), + path: z.string().optional(), + hosted: z.union([ + z.string().optional(), + z.object({ name: z.string().optional(), url: z.string().optional() }), + ]), + }), ]), );