Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use import() to enable update of p-map #11147

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/datasource/galaxy-collection/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pMap from 'p-map';
import inclusion from 'inclusion';
import { logger } from '../../logger';
import { cache } from '../../util/cache/package/decorator';
import type { HttpResponse } from '../../util/http';
Expand Down Expand Up @@ -72,6 +72,8 @@ export class GalaxyCollectionDatasource extends Datasource {
});

let newestVersionDetails: VersionsDetailResult;
const pMap: typeof import('p-map')['default'] = (await inclusion('p-map'))
.default;
// asynchronously get release details
const enrichedReleases: Release[] = await pMap(
releases,
Expand Down
6 changes: 5 additions & 1 deletion lib/datasource/terraform-provider/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pMap from 'p-map';
import inclusion from 'inclusion';
import { logger } from '../../logger';
import { ExternalHostError } from '../../types/errors/external-host-error';
import { cache } from '../../util/cache/package/decorator';
Expand Down Expand Up @@ -192,6 +192,10 @@ export class TerraformProviderDatasource extends TerraformDatasource {
);
return null;
}

const pMap: typeof import('p-map')['default'] = (await inclusion('p-map'))
.default;

const result = await pMap(
builds.platforms,
async (platform) => {
Expand Down
4 changes: 3 additions & 1 deletion lib/manager/terraform/lockfile/hash.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import crypto from 'crypto';
import extract from 'extract-zip';
import pMap from 'p-map';
import inclusion from 'inclusion';
import { join } from 'upath';
import { TerraformProviderDatasource } from '../../../datasource/terraform-provider';
import type { TerraformBuild } from '../../../datasource/terraform-provider/types';
Expand Down Expand Up @@ -95,6 +95,8 @@ export class TerraformProviderHash {
}

static async calculateHashes(builds: TerraformBuild[]): Promise<string[]> {
const pMap: typeof import('p-map')['default'] = (await inclusion('p-map'))
.default;
const cacheDir = await ensureCacheDir('./others/terraform');

// for each build download ZIP, extract content and generate hash for all containing files
Expand Down
5 changes: 4 additions & 1 deletion lib/manager/terraform/lockfile/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pMap from 'p-map';
import inclusion from 'inclusion';
import { GetPkgReleasesConfig, getPkgReleases } from '../../../datasource';
import { TerraformProviderDatasource } from '../../../datasource/terraform-provider';
import { logger } from '../../../logger';
Expand All @@ -17,6 +17,9 @@ import {
async function updateAllLocks(
locks: ProviderLock[]
): Promise<ProviderLockUpdate[]> {
const pMap: typeof import('p-map')['default'] = (await inclusion('p-map'))
.default;

const updates = await pMap(
locks,
async (lock) => {
Expand Down
4 changes: 3 additions & 1 deletion lib/workers/repository/changelog/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pMap from 'p-map';
import inclusion from 'inclusion';
import { getChangeLogJSON } from '../../pr/changelog';
import type { BranchUpgradeConfig } from '../../types';

Expand All @@ -11,6 +11,8 @@ async function embedChangelog(upgrade: BranchUpgradeConfig): Promise<void> {
export async function embedChangelogs(
branchUpgrades: Record<string, BranchUpgradeConfig[]>
): Promise<void> {
const pMap: typeof import('p-map')['default'] = (await inclusion('p-map'))
.default;
const upgrades = [];
for (const branchName of Object.keys(branchUpgrades)) {
for (const upgrade of branchUpgrades[branchName]) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
"handy-redis": "2.2.2",
"hasha": "5.2.2",
"ignore": "5.1.8",
"inclusion": "1.0.0",
"ini": "2.0.0",
"js-yaml": "4.1.0",
"json-dup-key-validator": "1.0.3",
Expand All @@ -173,7 +174,7 @@
"moo": "0.5.1",
"node-html-parser": "3.3.6",
"p-all": "3.0.0",
"p-map": "4.0.0",
"p-map": "5.1.0",
"p-queue": "6.6.2",
"parse-diff": "0.8.1",
"parse-link-header": "1.0.1",
Expand Down
58 changes: 52 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2258,6 +2258,14 @@ aggregate-error@^3.0.0:
clean-stack "^2.0.0"
indent-string "^4.0.0"

aggregate-error@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-4.0.0.tgz#83dbdb53a0d500721281d22e19eee9bc352a89cd"
integrity sha512-8DGp7zUt1E9k0NE2q4jlXHk+V3ORErmwolEdRz9iV+LKJ40WhMHh92cxAvhqV2I+zEn/gotIoqoMs0NjF3xofg==
dependencies:
clean-stack "^4.0.0"
indent-string "^5.0.0"

ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4:
version "6.12.6"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4"
Expand Down Expand Up @@ -2837,7 +2845,7 @@ call-bind@^1.0.0, call-bind@^1.0.2:
function-bind "^1.1.1"
get-intrinsic "^1.0.2"

callsites@^3.0.0:
callsites@^3.0.0, callsites@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
Expand Down Expand Up @@ -2976,6 +2984,13 @@ clean-stack@^2.0.0:
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==

clean-stack@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-4.1.0.tgz#5ce5a2fd19a12aecdce8570daefddb7ac94b6b4e"
integrity sha512-dxXQYI7mfQVcaF12s6sjNFoZ6ZPDQuBBLp3QJ5156k9EvUFClUoZ11fo8HnLQO241DDVntHEug8MOuFO5PSfRg==
dependencies:
escape-string-regexp "5.0.0"

cli-columns@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/cli-columns/-/cli-columns-3.1.2.tgz#6732d972979efc2ae444a1f08e08fa139c96a18e"
Expand Down Expand Up @@ -3805,6 +3820,11 @@ escalade@^3.1.1:
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==

escape-string-regexp@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz#4683126b500b61762f2dbebace1806e8be31b1c8"
integrity sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==

escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
Expand Down Expand Up @@ -4886,11 +4906,23 @@ imurmurhash@^0.1.4:
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=

inclusion@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/inclusion/-/inclusion-1.0.0.tgz#4f3331ae18b6e27807fcbc3f81204eb81230bdc9"
integrity sha512-5rnJkax1rtkMWCDGeRLFQJIZCKMrCTrH89mm4l3JfpnKC0tEvL7SuasSiutr6vNfBG31YoVmlo79Wwqif48azA==
dependencies:
parent-module "^2.0.0"

indent-string@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251"
integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==

indent-string@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-5.0.0.tgz#4fd2980fccaf8622d14c64d694f4cf33c81951a5"
integrity sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==

infer-owner@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467"
Expand Down Expand Up @@ -7426,18 +7458,25 @@ p-locate@^5.0.0:
dependencies:
p-limit "^3.0.2"

p-map@4.0.0, p-map@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b"
integrity sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==
p-map@5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-5.1.0.tgz#1c31bdfc492910098bdb4e63d099efbdd9b37755"
integrity sha512-hDTnBRGPXM4hUkmV4Nbe9ZyFnqUAHFYq5S/3+P38TRf0KbmkQuRSzfGM+JngEJsvB0m6nHvhsSv5E6VsGSB2zA==
dependencies:
aggregate-error "^3.0.0"
aggregate-error "^4.0.0"

p-map@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175"
integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==

p-map@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b"
integrity sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==
dependencies:
aggregate-error "^3.0.0"

p-queue@6.6.2:
version "6.6.2"
resolved "https://registry.yarnpkg.com/p-queue/-/p-queue-6.6.2.tgz#2068a9dcf8e67dd0ec3e7a2bcb76810faa85e426"
Expand Down Expand Up @@ -7508,6 +7547,13 @@ parent-module@^1.0.0:
dependencies:
callsites "^3.0.0"

parent-module@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-2.0.0.tgz#fa71f88ff1a50c27e15d8ff74e0e3a9523bf8708"
integrity sha512-uo0Z9JJeWzv8BG+tRcapBKNJ0dro9cLyczGzulS6EfeyAdeC9sbojtW6XwvYxJkEne9En+J2XEl4zyglVeIwFg==
dependencies:
callsites "^3.1.0"

parse-conflict-json@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/parse-conflict-json/-/parse-conflict-json-1.1.1.tgz#54ec175bde0f2d70abf6be79e0e042290b86701b"
Expand Down