🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@backstage/cli-node

Package Overview
Dependencies
Maintainers
3
Versions
528
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/cli-node - npm Package Compare versions

Comparing version
0.0.0-nightly-20260217031303
to
0.0.0-nightly-20260224031247
+55
dist/concurrency/concurrency.cjs.js
'use strict';
var os = require('node:os');
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
var os__default = /*#__PURE__*/_interopDefaultCompat(os);
const defaultConcurrency = Math.max(Math.ceil(os__default.default.cpus().length / 2), 1);
const CONCURRENCY_ENV_VAR = "BACKSTAGE_CLI_CONCURRENCY";
const DEPRECATED_CONCURRENCY_ENV_VAR = "BACKSTAGE_CLI_BUILD_PARALLEL";
function parseConcurrencyOption(value) {
if (value === void 0 || value === null) {
return defaultConcurrency;
} else if (typeof value === "boolean") {
return value ? defaultConcurrency : 1;
} else if (typeof value === "number" && Number.isInteger(value)) {
if (value < 1) {
return 1;
}
return value;
} else if (typeof value === "string") {
if (value === "true") {
return parseConcurrencyOption(true);
} else if (value === "false") {
return parseConcurrencyOption(false);
}
const parsed = Number(value);
if (Number.isInteger(parsed)) {
return parseConcurrencyOption(parsed);
}
}
throw Error(
`Concurrency option value '${value}' is not a boolean or integer`
);
}
let hasWarnedDeprecation = false;
function getEnvironmentConcurrency() {
if (process.env[CONCURRENCY_ENV_VAR] !== void 0) {
return parseConcurrencyOption(process.env[CONCURRENCY_ENV_VAR]);
}
if (process.env[DEPRECATED_CONCURRENCY_ENV_VAR] !== void 0) {
if (!hasWarnedDeprecation) {
hasWarnedDeprecation = true;
console.warn(
`The ${DEPRECATED_CONCURRENCY_ENV_VAR} environment variable is deprecated, use ${CONCURRENCY_ENV_VAR} instead`
);
}
return parseConcurrencyOption(process.env[DEPRECATED_CONCURRENCY_ENV_VAR]);
}
return defaultConcurrency;
}
exports.getEnvironmentConcurrency = getEnvironmentConcurrency;
//# sourceMappingURL=concurrency.cjs.js.map
{"version":3,"file":"concurrency.cjs.js","sources":["../../src/concurrency/concurrency.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport os from 'node:os';\n\nconst defaultConcurrency = Math.max(Math.ceil(os.cpus().length / 2), 1);\n\nconst CONCURRENCY_ENV_VAR = 'BACKSTAGE_CLI_CONCURRENCY';\nconst DEPRECATED_CONCURRENCY_ENV_VAR = 'BACKSTAGE_CLI_BUILD_PARALLEL';\n\ntype ConcurrencyOption = boolean | string | number | null | undefined;\n\nfunction parseConcurrencyOption(value: ConcurrencyOption): number {\n if (value === undefined || value === null) {\n return defaultConcurrency;\n } else if (typeof value === 'boolean') {\n return value ? defaultConcurrency : 1;\n } else if (typeof value === 'number' && Number.isInteger(value)) {\n if (value < 1) {\n return 1;\n }\n return value;\n } else if (typeof value === 'string') {\n if (value === 'true') {\n return parseConcurrencyOption(true);\n } else if (value === 'false') {\n return parseConcurrencyOption(false);\n }\n const parsed = Number(value);\n if (Number.isInteger(parsed)) {\n return parseConcurrencyOption(parsed);\n }\n }\n\n throw Error(\n `Concurrency option value '${value}' is not a boolean or integer`,\n );\n}\n\nlet hasWarnedDeprecation = false;\n\n/** @internal */\nexport function getEnvironmentConcurrency() {\n if (process.env[CONCURRENCY_ENV_VAR] !== undefined) {\n return parseConcurrencyOption(process.env[CONCURRENCY_ENV_VAR]);\n }\n if (process.env[DEPRECATED_CONCURRENCY_ENV_VAR] !== undefined) {\n if (!hasWarnedDeprecation) {\n hasWarnedDeprecation = true;\n console.warn(\n `The ${DEPRECATED_CONCURRENCY_ENV_VAR} environment variable is deprecated, use ${CONCURRENCY_ENV_VAR} instead`,\n );\n }\n return parseConcurrencyOption(process.env[DEPRECATED_CONCURRENCY_ENV_VAR]);\n }\n return defaultConcurrency;\n}\n"],"names":["os"],"mappings":";;;;;;;;AAkBA,MAAM,kBAAA,GAAqB,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,IAAA,CAAKA,mBAAA,CAAG,IAAA,EAAK,CAAE,MAAA,GAAS,CAAC,CAAA,EAAG,CAAC,CAAA;AAEtE,MAAM,mBAAA,GAAsB,2BAAA;AAC5B,MAAM,8BAAA,GAAiC,8BAAA;AAIvC,SAAS,uBAAuB,KAAA,EAAkC;AAChE,EAAA,IAAI,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,IAAA,EAAM;AACzC,IAAA,OAAO,kBAAA;AAAA,EACT,CAAA,MAAA,IAAW,OAAO,KAAA,KAAU,SAAA,EAAW;AACrC,IAAA,OAAO,QAAQ,kBAAA,GAAqB,CAAA;AAAA,EACtC,WAAW,OAAO,KAAA,KAAU,YAAY,MAAA,CAAO,SAAA,CAAU,KAAK,CAAA,EAAG;AAC/D,IAAA,IAAI,QAAQ,CAAA,EAAG;AACb,MAAA,OAAO,CAAA;AAAA,IACT;AACA,IAAA,OAAO,KAAA;AAAA,EACT,CAAA,MAAA,IAAW,OAAO,KAAA,KAAU,QAAA,EAAU;AACpC,IAAA,IAAI,UAAU,MAAA,EAAQ;AACpB,MAAA,OAAO,uBAAuB,IAAI,CAAA;AAAA,IACpC,CAAA,MAAA,IAAW,UAAU,OAAA,EAAS;AAC5B,MAAA,OAAO,uBAAuB,KAAK,CAAA;AAAA,IACrC;AACA,IAAA,MAAM,MAAA,GAAS,OAAO,KAAK,CAAA;AAC3B,IAAA,IAAI,MAAA,CAAO,SAAA,CAAU,MAAM,CAAA,EAAG;AAC5B,MAAA,OAAO,uBAAuB,MAAM,CAAA;AAAA,IACtC;AAAA,EACF;AAEA,EAAA,MAAM,KAAA;AAAA,IACJ,6BAA6B,KAAK,CAAA,6BAAA;AAAA,GACpC;AACF;AAEA,IAAI,oBAAA,GAAuB,KAAA;AAGpB,SAAS,yBAAA,GAA4B;AAC1C,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,mBAAmB,CAAA,KAAM,MAAA,EAAW;AAClD,IAAA,OAAO,sBAAA,CAAuB,OAAA,CAAQ,GAAA,CAAI,mBAAmB,CAAC,CAAA;AAAA,EAChE;AACA,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,8BAA8B,CAAA,KAAM,MAAA,EAAW;AAC7D,IAAA,IAAI,CAAC,oBAAA,EAAsB;AACzB,MAAA,oBAAA,GAAuB,IAAA;AACvB,MAAA,OAAA,CAAQ,IAAA;AAAA,QACN,CAAA,IAAA,EAAO,8BAA8B,CAAA,yCAAA,EAA4C,mBAAmB,CAAA,QAAA;AAAA,OACtG;AAAA,IACF;AACA,IAAA,OAAO,sBAAA,CAAuB,OAAA,CAAQ,GAAA,CAAI,8BAA8B,CAAC,CAAA;AAAA,EAC3E;AACA,EAAA,OAAO,kBAAA;AACT;;;;"}
'use strict';
var concurrency = require('./concurrency.cjs.js');
async function runConcurrentTasks(options) {
const { concurrencyFactor = 1, items, worker } = options;
const concurrency$1 = concurrency.getEnvironmentConcurrency();
const sharedIterator = items[Symbol.iterator]();
const sharedIterable = {
[Symbol.iterator]: () => sharedIterator
};
const workerCount = Math.max(Math.floor(concurrencyFactor * concurrency$1), 1);
await Promise.all(
Array(workerCount).fill(0).map(async () => {
for (const value of sharedIterable) {
await worker(value);
}
})
);
}
exports.runConcurrentTasks = runConcurrentTasks;
//# sourceMappingURL=runConcurrentTasks.cjs.js.map
{"version":3,"file":"runConcurrentTasks.cjs.js","sources":["../../src/concurrency/runConcurrentTasks.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getEnvironmentConcurrency } from './concurrency';\n\n/**\n * Options for {@link runConcurrentTasks}.\n *\n * @public\n */\nexport type ConcurrentTasksOptions<TItem> = {\n /**\n * Decides the number of concurrent workers by multiplying\n * this with the configured concurrency.\n *\n * Defaults to 1.\n */\n concurrencyFactor?: number;\n items: Iterable<TItem>;\n worker: (item: TItem) => Promise<void>;\n};\n\n/**\n * Runs items through a worker function concurrently across multiple async workers.\n *\n * @public\n */\nexport async function runConcurrentTasks<TItem>(\n options: ConcurrentTasksOptions<TItem>,\n): Promise<void> {\n const { concurrencyFactor = 1, items, worker } = options;\n const concurrency = getEnvironmentConcurrency();\n\n const sharedIterator = items[Symbol.iterator]();\n const sharedIterable = {\n [Symbol.iterator]: () => sharedIterator,\n };\n\n const workerCount = Math.max(Math.floor(concurrencyFactor * concurrency), 1);\n await Promise.all(\n Array(workerCount)\n .fill(0)\n .map(async () => {\n for (const value of sharedIterable) {\n await worker(value);\n }\n }),\n );\n}\n"],"names":["concurrency","getEnvironmentConcurrency"],"mappings":";;;;AAwCA,eAAsB,mBACpB,OAAA,EACe;AACf,EAAA,MAAM,EAAE,iBAAA,GAAoB,CAAA,EAAG,KAAA,EAAO,QAAO,GAAI,OAAA;AACjD,EAAA,MAAMA,gBAAcC,qCAAA,EAA0B;AAE9C,EAAA,MAAM,cAAA,GAAiB,KAAA,CAAM,MAAA,CAAO,QAAQ,CAAA,EAAE;AAC9C,EAAA,MAAM,cAAA,GAAiB;AAAA,IACrB,CAAC,MAAA,CAAO,QAAQ,GAAG,MAAM;AAAA,GAC3B;AAEA,EAAA,MAAM,WAAA,GAAc,KAAK,GAAA,CAAI,IAAA,CAAK,MAAM,iBAAA,GAAoBD,aAAW,GAAG,CAAC,CAAA;AAC3E,EAAA,MAAM,OAAA,CAAQ,GAAA;AAAA,IACZ,MAAM,WAAW,CAAA,CACd,KAAK,CAAC,CAAA,CACN,IAAI,YAAY;AACf,MAAA,KAAA,MAAW,SAAS,cAAA,EAAgB;AAClC,QAAA,MAAM,OAAO,KAAK,CAAA;AAAA,MACpB;AAAA,IACF,CAAC;AAAA,GACL;AACF;;;;"}
'use strict';
var node_worker_threads = require('node:worker_threads');
var concurrency = require('./concurrency.cjs.js');
async function runWorkerQueueThreads(options) {
const items = Array.from(options.items);
const workerFactory = options.workerFactory;
const workerData = options.context;
const threadCount = Math.min(concurrency.getEnvironmentConcurrency(), items.length);
const iterator = items[Symbol.iterator]();
const results = new Array();
let itemIndex = 0;
await Promise.all(
Array(threadCount).fill(0).map(async () => {
const thread = new node_worker_threads.Worker(`(${workerQueueThread})(${workerFactory})`, {
eval: true,
workerData
});
return new Promise((resolve, reject) => {
thread.on("message", (message) => {
if (message.type === "start" || message.type === "result") {
if (message.type === "result") {
results[message.index] = message.result;
}
const { value, done } = iterator.next();
if (done) {
thread.postMessage({ type: "done" });
} else {
thread.postMessage({
type: "item",
index: itemIndex,
item: value
});
itemIndex += 1;
}
} else if (message.type === "error") {
const error = new Error(message.error.message);
error.name = message.error.name;
error.stack = message.error.stack;
reject(error);
}
});
thread.on("error", reject);
thread.on("exit", (code) => {
if (code !== 0) {
reject(new Error(`Worker thread exited with code ${code}`));
} else {
resolve();
}
});
});
})
);
return { results };
}
function workerQueueThread(workerFuncFactory) {
const { parentPort, workerData } = require("node:worker_threads");
Promise.resolve().then(() => workerFuncFactory(workerData)).then(
(workerFunc) => {
parentPort.on("message", async (message) => {
if (message.type === "done") {
parentPort.close();
return;
}
if (message.type === "item") {
try {
const result = await workerFunc(message.item);
parentPort.postMessage({
type: "result",
index: message.index,
result
});
} catch (error) {
parentPort.postMessage({ type: "error", error });
}
}
});
parentPort.postMessage({ type: "start" });
},
(error) => parentPort.postMessage({ type: "error", error })
);
}
exports.runWorkerQueueThreads = runWorkerQueueThreads;
//# sourceMappingURL=runWorkerQueueThreads.cjs.js.map
{"version":3,"file":"runWorkerQueueThreads.cjs.js","sources":["../../src/concurrency/runWorkerQueueThreads.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErrorLike } from '@backstage/errors';\nimport { Worker } from 'node:worker_threads';\nimport { getEnvironmentConcurrency } from './concurrency';\n\ntype WorkerThreadMessage =\n | {\n type: 'done';\n }\n | {\n type: 'item';\n index: number;\n item: unknown;\n }\n | {\n type: 'start';\n }\n | {\n type: 'result';\n index: number;\n result: unknown;\n }\n | {\n type: 'error';\n error: ErrorLike;\n };\n\n/**\n * Options for {@link runWorkerQueueThreads}.\n *\n * @public\n */\nexport type WorkerQueueThreadsOptions<TItem, TResult, TContext> = {\n /** The items to process */\n items: Iterable<TItem>;\n /**\n * A function that will be called within each worker thread at startup,\n * which should return the worker function that will be called for each item.\n *\n * This function must be defined as an arrow function or using the\n * function keyword, and must be entirely self contained, not referencing\n * any variables outside of its scope. This is because the function source\n * is stringified and evaluated in the worker thread.\n *\n * To pass data to the worker, use the `context` option and `items`, but\n * note that they are both copied by value into the worker thread, except for\n * types that are explicitly shareable across threads, such as `SharedArrayBuffer`.\n */\n workerFactory: (\n context: TContext,\n ) =>\n | ((item: TItem) => Promise<TResult>)\n | Promise<(item: TItem) => Promise<TResult>>;\n /** Context data supplied to each worker factory */\n context?: TContext;\n};\n\n/**\n * Spawns one or more worker threads using the `worker_threads` module.\n * Each thread processes one item at a time from the provided `options.items`.\n *\n * @public\n */\nexport async function runWorkerQueueThreads<TItem, TResult, TContext>(\n options: WorkerQueueThreadsOptions<TItem, TResult, TContext>,\n): Promise<{ results: TResult[] }> {\n const items = Array.from(options.items);\n const workerFactory = options.workerFactory;\n const workerData = options.context;\n const threadCount = Math.min(getEnvironmentConcurrency(), items.length);\n\n const iterator = items[Symbol.iterator]();\n const results = new Array<TResult>();\n let itemIndex = 0;\n\n await Promise.all(\n Array(threadCount)\n .fill(0)\n .map(async () => {\n const thread = new Worker(`(${workerQueueThread})(${workerFactory})`, {\n eval: true,\n workerData,\n });\n\n return new Promise<void>((resolve, reject) => {\n thread.on('message', (message: WorkerThreadMessage) => {\n if (message.type === 'start' || message.type === 'result') {\n if (message.type === 'result') {\n results[message.index] = message.result as TResult;\n }\n const { value, done } = iterator.next();\n if (done) {\n thread.postMessage({ type: 'done' });\n } else {\n thread.postMessage({\n type: 'item',\n index: itemIndex,\n item: value,\n });\n itemIndex += 1;\n }\n } else if (message.type === 'error') {\n const error = new Error(message.error.message);\n error.name = message.error.name;\n error.stack = message.error.stack;\n reject(error);\n }\n });\n\n thread.on('error', reject);\n thread.on('exit', (code: number) => {\n if (code !== 0) {\n reject(new Error(`Worker thread exited with code ${code}`));\n } else {\n resolve();\n }\n });\n });\n }),\n );\n\n return { results };\n}\n\n/* istanbul ignore next */\nfunction workerQueueThread(\n workerFuncFactory: (\n data: unknown,\n ) => Promise<(item: unknown) => Promise<unknown>>,\n) {\n const { parentPort, workerData } = require('node:worker_threads');\n\n Promise.resolve()\n .then(() => workerFuncFactory(workerData))\n .then(\n workerFunc => {\n parentPort.on('message', async (message: WorkerThreadMessage) => {\n if (message.type === 'done') {\n parentPort.close();\n return;\n }\n if (message.type === 'item') {\n try {\n const result = await workerFunc(message.item);\n parentPort.postMessage({\n type: 'result',\n index: message.index,\n result,\n });\n } catch (error) {\n parentPort.postMessage({ type: 'error', error });\n }\n }\n });\n\n parentPort.postMessage({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AAK,MAAM,iBAAA,CAAkB,UAAU,CAAC,CAAA,CACxC,IAAA;AAAA,IACC,CAAA,UAAA,KAAc;AACZ,MAAA,UAAA,CAAW,EAAA,CAAG,SAAA,EAAW,OAAO,OAAA,KAAiC;AAC/D,QAAA,IAAI,OAAA,CAAQ,SAAS,MAAA,EAAQ;AAC3B,UAAA,UAAA,CAAW,KAAA,EAAM;AACjB,UAAA;AAAA,QACF;AACA,QAAA,IAAI,OAAA,CAAQ,SAAS,MAAA,EAAQ;AAC3B,UAAA,IAAI;AACF,YAAA,MAAM,MAAA,GAAS,MAAM,UAAA,CAAW,OAAA,CAAQ,IAAI,CAAA;AAC5C,YAAA,UAAA,CAAW,WAAA,CAAY;AAAA,cACrB,IAAA,EAAM,QAAA;AAAA,cACN,OAAO,OAAA,CAAQ,KAAA;AAAA,cACf;AAAA,aACD,CAAA;AAAA,UACH,SAAS,KAAA,EAAO;AACd,YAAA,UAAA,CAAW,WAAA,CAAY,EAAE,IAAA,EAAM,OAAA,EAAS,OAAO,CAAA;AAAA,UACjD;AAAA,QACF;AAAA,MACF,CAAC,CAAA;AAED,MAAA,UAAA,CAAW,WAAA,CAAY,EAAE,IAAA,EAAM,OAAA,EAAS,CAAA;AAAA,IAC1C,CAAA;AAAA,IACA,WAAS,UAAA,CAAW,WAAA,CAAY,EAAE,IAAA,EAAM,OAAA,EAAS,OAAO;AAAA,GAC1D;AACJ;;;;"}
+12
-4
# @backstage/cli-node
## 0.0.0-nightly-20260217031303
## 0.0.0-nightly-20260224031247
### Patch Changes
- 06c2015: Added `runConcurrentTasks` and `runWorkerQueueThreads` utilities, moved from the `@backstage/cli` internal code.
- Updated dependencies
- @backstage/cli-common@0.1.18
- @backstage/errors@1.2.7
- @backstage/types@1.2.2
## 0.2.18
### Patch Changes
- 7455dae: Use node prefix on native imports

@@ -11,5 +21,3 @@ - 5e3ef57: Added support for the new `peerModules` metadata field in `package.json`. This field allows plugin packages to declare modules that should be installed alongside them for cross-plugin integrations. The field is validated by `backstage-cli repo fix --publish`.

- Updated dependencies
- @backstage/cli-common@0.0.0-nightly-20260217031303
- @backstage/errors@1.2.7
- @backstage/types@1.2.2
- @backstage/cli-common@0.1.18

@@ -16,0 +24,0 @@ ## 0.2.18-next.1

@@ -7,2 +7,4 @@ 'use strict';

var Lockfile = require('./monorepo/Lockfile.cjs.js');
var runConcurrentTasks = require('./concurrency/runConcurrentTasks.cjs.js');
var runWorkerQueueThreads = require('./concurrency/runWorkerQueueThreads.cjs.js');
var PackageRoles = require('./roles/PackageRoles.cjs.js');

@@ -17,3 +19,5 @@

exports.Lockfile = Lockfile.Lockfile;
exports.runConcurrentTasks = runConcurrentTasks.runConcurrentTasks;
exports.runWorkerQueueThreads = runWorkerQueueThreads.runWorkerQueueThreads;
exports.PackageRoles = PackageRoles.PackageRoles;
//# sourceMappingURL=index.cjs.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}

@@ -311,3 +311,61 @@ import { Package } from '@manypkg/get-packages';

export { GitUtils, Lockfile, PackageGraph, PackageRoles, isMonoRepo, packageFeatureType };
export type { BackstagePackage, BackstagePackageFeatureType, BackstagePackageJson, LockfileDiff, LockfileDiffEntry, LockfileQueryEntry, PackageGraphNode, PackageOutputType, PackagePlatform, PackageRole, PackageRoleInfo };
/**
* Options for {@link runConcurrentTasks}.
*
* @public
*/
type ConcurrentTasksOptions<TItem> = {
/**
* Decides the number of concurrent workers by multiplying
* this with the configured concurrency.
*
* Defaults to 1.
*/
concurrencyFactor?: number;
items: Iterable<TItem>;
worker: (item: TItem) => Promise<void>;
};
/**
* Runs items through a worker function concurrently across multiple async workers.
*
* @public
*/
declare function runConcurrentTasks<TItem>(options: ConcurrentTasksOptions<TItem>): Promise<void>;
/**
* Options for {@link runWorkerQueueThreads}.
*
* @public
*/
type WorkerQueueThreadsOptions<TItem, TResult, TContext> = {
/** The items to process */
items: Iterable<TItem>;
/**
* A function that will be called within each worker thread at startup,
* which should return the worker function that will be called for each item.
*
* This function must be defined as an arrow function or using the
* function keyword, and must be entirely self contained, not referencing
* any variables outside of its scope. This is because the function source
* is stringified and evaluated in the worker thread.
*
* To pass data to the worker, use the `context` option and `items`, but
* note that they are both copied by value into the worker thread, except for
* types that are explicitly shareable across threads, such as `SharedArrayBuffer`.
*/
workerFactory: (context: TContext) => ((item: TItem) => Promise<TResult>) | Promise<(item: TItem) => Promise<TResult>>;
/** Context data supplied to each worker factory */
context?: TContext;
};
/**
* Spawns one or more worker threads using the `worker_threads` module.
* Each thread processes one item at a time from the provided `options.items`.
*
* @public
*/
declare function runWorkerQueueThreads<TItem, TResult, TContext>(options: WorkerQueueThreadsOptions<TItem, TResult, TContext>): Promise<{
results: TResult[];
}>;
export { GitUtils, Lockfile, PackageGraph, PackageRoles, isMonoRepo, packageFeatureType, runConcurrentTasks, runWorkerQueueThreads };
export type { BackstagePackage, BackstagePackageFeatureType, BackstagePackageJson, ConcurrentTasksOptions, LockfileDiff, LockfileDiffEntry, LockfileQueryEntry, PackageGraphNode, PackageOutputType, PackagePlatform, PackageRole, PackageRoleInfo, WorkerQueueThreadsOptions };
{
"name": "@backstage/cli-node",
"version": "0.0.0-nightly-20260217031303",
"version": "0.0.0-nightly-20260224031247",
"description": "Node.js library for Backstage CLIs",

@@ -34,3 +34,3 @@ "backstage": {

"dependencies": {
"@backstage/cli-common": "0.0.0-nightly-20260217031303",
"@backstage/cli-common": "0.1.18",
"@backstage/errors": "1.2.7",

@@ -45,5 +45,5 @@ "@backstage/types": "1.2.2",

"devDependencies": {
"@backstage/backend-test-utils": "0.0.0-nightly-20260217031303",
"@backstage/cli": "0.0.0-nightly-20260217031303",
"@backstage/test-utils": "0.0.0-nightly-20260217031303"
"@backstage/backend-test-utils": "0.0.0-nightly-20260224031247",
"@backstage/cli": "0.0.0-nightly-20260224031247",
"@backstage/test-utils": "0.0.0-nightly-20260224031247"
},

@@ -50,0 +50,0 @@ "typesVersions": {