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 1 commit
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
2 changes: 1 addition & 1 deletion lib/datasource/galaxy-collection/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pMap from 'p-map';
import { logger } from '../../logger';
import { cache } from '../../util/cache/package/decorator';
import type { HttpResponse } from '../../util/http';
Expand Down Expand Up @@ -72,6 +71,7 @@ export class GalaxyCollectionDatasource extends Datasource {
});

let newestVersionDetails: VersionsDetailResult;
const pMap = (await import('p-map')).default;
// asynchronously get release details
const enrichedReleases: Release[] = await pMap(
releases,
Expand Down
4 changes: 3 additions & 1 deletion lib/datasource/terraform-provider/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pMap from 'p-map';
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 +191,9 @@ export class TerraformProviderDatasource extends TerraformDatasource {
);
return null;
}

const pMap = (await import('p-map')).default;

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

static async calculateHashes(builds: TerraformBuild[]): Promise<string[]> {
const pMap = (await import('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
3 changes: 2 additions & 1 deletion lib/manager/terraform/lockfile/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pMap from 'p-map';
import { GetPkgReleasesConfig, getPkgReleases } from '../../../datasource';
import { TerraformProviderDatasource } from '../../../datasource/terraform-provider';
import { logger } from '../../../logger';
Expand All @@ -17,6 +16,8 @@ import {
async function updateAllLocks(
locks: ProviderLock[]
): Promise<ProviderLockUpdate[]> {
const pMap = (await import('p-map')).default;

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

Expand All @@ -11,6 +10,7 @@ async function embedChangelog(upgrade: BranchUpgradeConfig): Promise<void> {
export async function embedChangelogs(
branchUpgrades: Record<string, BranchUpgradeConfig[]>
): Promise<void> {
const pMap = (await import('p-map')).default;
const upgrades = [];
for (const branchName of Object.keys(branchUpgrades)) {
for (const upgrade of branchUpgrades[branchName]) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,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
42 changes: 37 additions & 5 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 @@ -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 @@ -4891,6 +4911,11 @@ indent-string@^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 +7451,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