@virmator/core 14.32.1 → 14.34.0

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.
@@ -15,7 +15,7 @@ export const typeDocConfig: Partial<TypeDocOptions> = {
15
15
  intentionallyNotExported: [],
16
16
  defaultCategory: 'MISSING CATEGORY',
17
17
  categoryOrder: [
18
- 'Main',
18
+ 'Util',
19
19
  'Internal',
20
20
  ],
21
21
  };
@@ -5,9 +5,15 @@ import { type MonoRepoPackage, type UsedVirmatorPluginCommands, type VirmatorPlu
5
5
  /**
6
6
  * Extracts a 1d array of virmator plugin config files from previously calculated used commands and
7
7
  * resolved configs.
8
+ *
9
+ * @category Util
8
10
  */
9
11
  export declare function flattenConfigs(usedCommands: Readonly<UsedVirmatorPluginCommands<any>>, resolvedConfigs: Readonly<VirmatorPluginResolvedConfigs<any>>): VirmatorPluginResolvedConfigFile[];
10
- /** Copies a plugin's entire set of configs based on the used command. */
12
+ /**
13
+ * Copies a plugin's entire set of configs based on the used command.
14
+ *
15
+ * @category Util
16
+ */
11
17
  export declare function copyPluginConfigs({ usedCommands, resolvedConfigs, packageType, monoRepoPackages, log, filteredArgs, isCwdPackagePrivate, }: Readonly<{
12
18
  usedCommands: Readonly<UsedVirmatorPluginCommands>;
13
19
  resolvedConfigs: Readonly<VirmatorPluginResolvedConfigs<any>>;
@@ -19,7 +25,11 @@ export declare function copyPluginConfigs({ usedCommands, resolvedConfigs, packa
19
25
  /** `true` if the current package's `package.json` has `"private": true`. */
20
26
  isCwdPackagePrivate: boolean;
21
27
  }>): Promise<void>;
22
- /** Inputs for {@link copyConfigFile}. */
28
+ /**
29
+ * Inputs for {@link copyConfigFile}.
30
+ *
31
+ * @category Util
32
+ */
23
33
  export type CopyConfigFileParams = {
24
34
  config: Readonly<Pick<VirmatorPluginResolvedConfigFile, 'fullCopyFromPath' | 'fullCopyToPath'>>;
25
35
  log: Logger;
@@ -35,5 +45,9 @@ export type CopyConfigFileParams = {
35
45
  /** Package name when this is being run within a sub-package. */
36
46
  packageName: string;
37
47
  }>;
38
- /** Copies a single virmator plugin config file. */
48
+ /**
49
+ * Copies a single virmator plugin config file.
50
+ *
51
+ * @category Util
52
+ */
39
53
  export declare function copyConfigFile({ config, log, force, transform, packageName, }: Readonly<CopyConfigFileParams>): Promise<void>;
@@ -6,6 +6,8 @@ import { PackageType } from '../plugin/plugin-env.js';
6
6
  /**
7
7
  * Extracts a 1d array of virmator plugin config files from previously calculated used commands and
8
8
  * resolved configs.
9
+ *
10
+ * @category Util
9
11
  */
10
12
  export function flattenConfigs(usedCommands, resolvedConfigs) {
11
13
  return Object.entries(usedCommands).flatMap(([commandName, usedCommand,]) => {
@@ -20,7 +22,11 @@ export function flattenConfigs(usedCommands, resolvedConfigs) {
20
22
  ];
21
23
  });
22
24
  }
23
- /** Copies a plugin's entire set of configs based on the used command. */
25
+ /**
26
+ * Copies a plugin's entire set of configs based on the used command.
27
+ *
28
+ * @category Util
29
+ */
24
30
  export async function copyPluginConfigs({ usedCommands, resolvedConfigs, packageType, monoRepoPackages, log, filteredArgs, isCwdPackagePrivate = false, }) {
25
31
  const configs = flattenConfigs(usedCommands, resolvedConfigs).sort((a, b) => {
26
32
  return basename(a.copyToPath).localeCompare(basename(b.copyToPath));
@@ -66,7 +72,11 @@ export async function copyPluginConfigs({ usedCommands, resolvedConfigs, package
66
72
  }
67
73
  });
68
74
  }
69
- /** Copies a single virmator plugin config file. */
75
+ /**
76
+ * Copies a single virmator plugin config file.
77
+ *
78
+ * @category Util
79
+ */
70
80
  export async function copyConfigFile({ config, log, force = false, transform, packageName, }) {
71
81
  if (existsSync(config.fullCopyToPath) && !force) {
72
82
  return;
@@ -1,6 +1,10 @@
1
1
  import { type Logger, type PartialWithUndefined } from '@augment-vir/common';
2
2
  import { type VirmatorPlugin } from '../plugin/plugin.js';
3
- /** Params for executing a plugin command. */
3
+ /**
4
+ * Params for executing a plugin command.
5
+ *
6
+ * @category Util
7
+ */
4
8
  export type ExecuteCommandParams = {
5
9
  /**
6
10
  * An array of {@link VirmatorPlugin} definitions to use. There is no default list of plugins
@@ -55,5 +59,9 @@ export type ExecuteCommandParams = {
55
59
  */
56
60
  concurrency: number;
57
61
  }>;
58
- /** The entry point to virmator. Runs a virmator plugin command. */
62
+ /**
63
+ * The entry point to virmator. Runs a virmator plugin command.
64
+ *
65
+ * @category Util
66
+ */
59
67
  export declare function executeVirmatorCommand({ log: logParam, entryPointFilePath, cwd, ...params }: ExecuteCommandParams): Promise<void>;
@@ -142,7 +142,11 @@ function writeLog({ arg, log, logType, extraOptions, }) {
142
142
  log.plain(finalLog);
143
143
  }
144
144
  }
145
- /** The entry point to virmator. Runs a virmator plugin command. */
145
+ /**
146
+ * The entry point to virmator. Runs a virmator plugin command.
147
+ *
148
+ * @category Util
149
+ */
146
150
  export async function executeVirmatorCommand({ log: logParam, entryPointFilePath = '', cwd = process.cwd(), ...params }) {
147
151
  const log = logParam || logImport;
148
152
  const args = parseCliArgs({
@@ -3,7 +3,11 @@ import { type UsedVirmatorPluginCommands } from '../plugin/plugin-executor.js';
3
3
  import { type VirmatorPluginCliCommands } from '../plugin/plugin-init.js';
4
4
  import { type VirmatorPlugin } from '../plugin/plugin.js';
5
5
  import { type SetVirmatorFlags } from './virmator-flags.js';
6
- /** All supported sets of args for virmator. */
6
+ /**
7
+ * All supported sets of args for virmator.
8
+ *
9
+ * @category Util
10
+ */
7
11
  export type ParsedArgs = {
8
12
  virmatorFlags: SetVirmatorFlags;
9
13
  commands: [
@@ -14,22 +18,42 @@ export type ParsedArgs = {
14
18
  plugin: Readonly<VirmatorPlugin> | undefined;
15
19
  usedCommands: UsedVirmatorPluginCommands;
16
20
  };
17
- /** Arbitrarily nested arbitrary virmator plugin commands. */
21
+ /**
22
+ * Arbitrarily nested arbitrary virmator plugin commands.
23
+ *
24
+ * @category Util
25
+ */
18
26
  export type NestedSubCommands = Readonly<{
19
27
  [SubCommand in string]: NestedSubCommands;
20
28
  }>;
21
- /** A mapping from command strings to plugins. */
29
+ /**
30
+ * A mapping from command strings to plugins.
31
+ *
32
+ * @category Util
33
+ */
22
34
  export type PluginsMappedByCommand = Readonly<{
23
35
  [Command in string]: Readonly<{
24
36
  plugin: Readonly<VirmatorPlugin>;
25
37
  subCommands: NestedSubCommands;
26
38
  }>;
27
39
  }>;
28
- /** Map a set of plugins from their top level commands to the plugins themselves. */
40
+ /**
41
+ * Map a set of plugins from their top level commands to the plugins themselves.
42
+ *
43
+ * @category Util
44
+ */
29
45
  export declare function mapPluginsByCommand(plugins: ReadonlyArray<Readonly<VirmatorPlugin>>): PluginsMappedByCommand;
30
- /** Determine the path of used commands from a plugin's nested cli command definition. */
46
+ /**
47
+ * Determine the path of used commands from a plugin's nested cli command definition.
48
+ *
49
+ * @category Util
50
+ */
31
51
  export declare function calculateUsedCommands(pluginCliCommands: Readonly<VirmatorPluginCliCommands>, commands: ReadonlyArray<string>): UsedVirmatorPluginCommands;
32
- /** Parses a raw cli command into supported virmator args. */
52
+ /**
53
+ * Parses a raw cli command into supported virmator args.
54
+ *
55
+ * @category Util
56
+ */
33
57
  export declare function parseCliArgs({ cliCommand, entryPointFilePath, plugins, log, }: {
34
58
  plugins: ReadonlyArray<Readonly<VirmatorPlugin>>;
35
59
  cliCommand: string | ReadonlyArray<string>;
@@ -13,7 +13,11 @@ function extractNestedCommands(cliCommands) {
13
13
  }
14
14
  });
15
15
  }
16
- /** Map a set of plugins from their top level commands to the plugins themselves. */
16
+ /**
17
+ * Map a set of plugins from their top level commands to the plugins themselves.
18
+ *
19
+ * @category Util
20
+ */
17
21
  export function mapPluginsByCommand(plugins) {
18
22
  const mappedPlugins = {};
19
23
  plugins.forEach((plugin) => {
@@ -33,7 +37,11 @@ export function mapPluginsByCommand(plugins) {
33
37
  });
34
38
  return mappedPlugins;
35
39
  }
36
- /** Determine the path of used commands from a plugin's nested cli command definition. */
40
+ /**
41
+ * Determine the path of used commands from a plugin's nested cli command definition.
42
+ *
43
+ * @category Util
44
+ */
37
45
  export function calculateUsedCommands(pluginCliCommands, commands) {
38
46
  if (!check.isLengthAtLeast(commands, 1)) {
39
47
  return {};
@@ -51,7 +59,11 @@ export function calculateUsedCommands(pluginCliCommands, commands) {
51
59
  };
52
60
  return usedCommands;
53
61
  }
54
- /** Parses a raw cli command into supported virmator args. */
62
+ /**
63
+ * Parses a raw cli command into supported virmator args.
64
+ *
65
+ * @category Util
66
+ */
55
67
  export function parseCliArgs({ cliCommand, entryPointFilePath, plugins, log, }) {
56
68
  const rawArgs = check.isArray(cliCommand)
57
69
  ? cliCommand
@@ -2,6 +2,8 @@ import { type MaybePromise } from '@augment-vir/common';
2
2
  /**
3
3
  * Compiles and imports a TS file so it can be used within JS contexts. After the given callback is
4
4
  * executed, the compiled JS output is deleted.
5
+ *
6
+ * @category Util
5
7
  */
6
8
  export declare function withImportedTsFile<T>({ inputPath, outputPath }: {
7
9
  inputPath: string;
@@ -10,19 +12,29 @@ export declare function withImportedTsFile<T>({ inputPath, outputPath }: {
10
12
  /**
11
13
  * Compiles a TS file and provides its path so it can be used within JS contexts. After the given
12
14
  * callback is executed, the compiled JS output is deleted.
15
+ *
16
+ * @category Util
13
17
  */
14
18
  export declare function withCompiledTsFile<T>({ inputPath, outputPath }: {
15
19
  inputPath: string;
16
20
  outputPath?: string | undefined;
17
21
  }, moduleType: JsModuleType, callback: (configPath: string) => MaybePromise<T>): Promise<T>;
18
- /** Output JS module types. */
22
+ /**
23
+ * Output JS module types.
24
+ *
25
+ * @category Util
26
+ */
19
27
  export declare enum JsModuleType {
20
28
  /** CommonJS. */
21
29
  Cjs = "cjs",
22
30
  /** EcmaScript Module. */
23
31
  Esm = "esm"
24
32
  }
25
- /** Compiles a TS file to JS and returns its path. */
33
+ /**
34
+ * Compiles a TS file to JS and returns its path.
35
+ *
36
+ * @category Util
37
+ */
26
38
  export declare function compileTs({ inputPath, outputPath, moduleType, }: {
27
39
  inputPath: string;
28
40
  moduleType: JsModuleType;
@@ -6,6 +6,8 @@ import { findClosestNodeModulesDir } from '../augments/index.js';
6
6
  /**
7
7
  * Compiles and imports a TS file so it can be used within JS contexts. After the given callback is
8
8
  * executed, the compiled JS output is deleted.
9
+ *
10
+ * @category Util
9
11
  */
10
12
  export async function withImportedTsFile({ inputPath, outputPath }, moduleType, callback) {
11
13
  const compiledPath = await compileTs({
@@ -28,6 +30,8 @@ export async function withImportedTsFile({ inputPath, outputPath }, moduleType,
28
30
  /**
29
31
  * Compiles a TS file and provides its path so it can be used within JS contexts. After the given
30
32
  * callback is executed, the compiled JS output is deleted.
33
+ *
34
+ * @category Util
31
35
  */
32
36
  export async function withCompiledTsFile({ inputPath, outputPath }, moduleType, callback) {
33
37
  const compiledPath = await compileTs({
@@ -50,7 +54,11 @@ function createOutfilePath(inputFilePath, moduleType) {
50
54
  const nodeModulesDir = findClosestNodeModulesDir(import.meta.dirname);
51
55
  return join(nodeModulesDir, '.virmator', basename(inputFilePath).replace(/\.ts$/, moduleType === JsModuleType.Cjs ? '.cjs' : '.mjs'));
52
56
  }
53
- /** Output JS module types. */
57
+ /**
58
+ * Output JS module types.
59
+ *
60
+ * @category Util
61
+ */
54
62
  export var JsModuleType;
55
63
  (function (JsModuleType) {
56
64
  /** CommonJS. */
@@ -58,7 +66,11 @@ export var JsModuleType;
58
66
  /** EcmaScript Module. */
59
67
  JsModuleType["Esm"] = "esm";
60
68
  })(JsModuleType || (JsModuleType = {}));
61
- /** Compiles a TS file to JS and returns its path. */
69
+ /**
70
+ * Compiles a TS file to JS and returns its path.
71
+ *
72
+ * @category Util
73
+ */
62
74
  export async function compileTs({ inputPath, outputPath, moduleType, }) {
63
75
  const outfile = outputPath || createOutfilePath(inputPath, moduleType);
64
76
  await (await import('esbuild')).build({
@@ -9,12 +9,20 @@ declare const rawVirmatorFlags: {
9
9
  readonly doc: "Print the help message.";
10
10
  };
11
11
  };
12
- /** Supported virmator flags. */
12
+ /**
13
+ * Supported virmator flags.
14
+ *
15
+ * @category Util
16
+ */
13
17
  export declare const virmatorFlags: { [FlagName in keyof typeof rawVirmatorFlags]: {
14
18
  doc: string;
15
19
  name: FlagName;
16
20
  }; };
17
- /** Each supported virmator flag mapped to a boolean. */
21
+ /**
22
+ * Each supported virmator flag mapped to a boolean.
23
+ *
24
+ * @category Util
25
+ */
18
26
  export type SetVirmatorFlags = Partial<{
19
27
  -readonly [FlagName in keyof typeof virmatorFlags]: true;
20
28
  }>;
@@ -10,7 +10,11 @@ const rawVirmatorFlags = {
10
10
  doc: 'Print the help message.',
11
11
  },
12
12
  };
13
- /** Supported virmator flags. */
13
+ /**
14
+ * Supported virmator flags.
15
+ *
16
+ * @category Util
17
+ */
14
18
  export const virmatorFlags = mapObjectValues(rawVirmatorFlags, (flag, value) => {
15
19
  return {
16
20
  ...value,
@@ -1,7 +1,15 @@
1
- /** Finds the closest ancestor directory with a `package.json` file. */
1
+ /**
2
+ * Finds the closest ancestor directory with a `package.json` file.
3
+ *
4
+ * @category Util
5
+ */
2
6
  export declare function findClosestPackageDir({ requireWorkspaces, startDirPath, }: {
3
7
  startDirPath: string;
4
8
  requireWorkspaces: boolean;
5
9
  }): Promise<string>;
6
- /** Finds the closest ancestor `node_modules` directory. */
10
+ /**
11
+ * Finds the closest ancestor `node_modules` directory.
12
+ *
13
+ * @category Util
14
+ */
7
15
  export declare function findClosestNodeModulesDir(startDirPath: string): string;
@@ -2,7 +2,11 @@ import { assert, check } from '@augment-vir/assert';
2
2
  import { findAncestor, readJsonFile } from '@augment-vir/node';
3
3
  import { existsSync } from 'node:fs';
4
4
  import { join } from 'node:path';
5
- /** Finds the closest ancestor directory with a `package.json` file. */
5
+ /**
6
+ * Finds the closest ancestor directory with a `package.json` file.
7
+ *
8
+ * @category Util
9
+ */
6
10
  export async function findClosestPackageDir({ requireWorkspaces, startDirPath, }) {
7
11
  const ancestor = await findAncestor(startDirPath, async (dir) => {
8
12
  const jsonFilePath = join(dir, 'package.json');
@@ -20,7 +24,11 @@ export async function findClosestPackageDir({ requireWorkspaces, startDirPath, }
20
24
  assert.isDefined(ancestor, 'Failed to find ancestor package root.');
21
25
  return ancestor;
22
26
  }
23
- /** Finds the closest ancestor `node_modules` directory. */
27
+ /**
28
+ * Finds the closest ancestor `node_modules` directory.
29
+ *
30
+ * @category Util
31
+ */
24
32
  export function findClosestNodeModulesDir(startDirPath) {
25
33
  const ancestor = findAncestor(startDirPath, (dir) => {
26
34
  return existsSync(join(dir, 'node_modules'));
@@ -1,3 +1,7 @@
1
1
  import { type AnyObject } from '@augment-vir/common';
2
- /** Gets the nested value within an object with the provided chain of keys. */
2
+ /**
3
+ * Gets the nested value within an object with the provided chain of keys.
4
+ *
5
+ * @category Util
6
+ */
3
7
  export declare function accessAtKeys<T>(parent: Readonly<AnyObject> | undefined, keys: ReadonlyArray<PropertyKey>): T | undefined;
@@ -1,5 +1,9 @@
1
1
  import { check } from '@augment-vir/assert';
2
- /** Gets the nested value within an object with the provided chain of keys. */
2
+ /**
3
+ * Gets the nested value within an object with the provided chain of keys.
4
+ *
5
+ * @category Util
6
+ */
3
7
  export function accessAtKeys(parent, keys) {
4
8
  if (!parent) {
5
9
  return undefined;
@@ -1,3 +1,7 @@
1
1
  import { type ParsedCommandLine } from 'typescript';
2
- /** Parsed the nearest ancestor TS Config file, if one can be found. */
2
+ /**
3
+ * Parsed the nearest ancestor TS Config file, if one can be found.
4
+ *
5
+ * @category Util
6
+ */
3
7
  export declare function parseTsConfig(cwd: string): ParsedCommandLine | undefined;
@@ -2,7 +2,11 @@ import { log } from '@augment-vir/common';
2
2
  import { existsSync } from 'node:fs';
3
3
  import { dirname } from 'node:path';
4
4
  import { findConfigFile, parseJsonConfigFileContent, readConfigFile, sys, } from 'typescript';
5
- /** Parsed the nearest ancestor TS Config file, if one can be found. */
5
+ /**
6
+ * Parsed the nearest ancestor TS Config file, if one can be found.
7
+ *
8
+ * @category Util
9
+ */
6
10
  export function parseTsConfig(cwd) {
7
11
  try {
8
12
  // eslint-disable-next-line @typescript-eslint/unbound-method
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * An error that aborts execution but should not get stack traced: only the error message should get
3
3
  * logged.
4
+ *
5
+ * @category Util
4
6
  */
5
7
  export declare class VirmatorNoTraceError extends Error {
6
8
  readonly name = "VirmatorNoTraceError";
@@ -9,5 +11,7 @@ export declare class VirmatorNoTraceError extends Error {
9
11
  /**
10
12
  * Used for debugging. Set to `false` to see error traces. Should always be set back to `true` for
11
13
  * publishing.
14
+ *
15
+ * @category Util
12
16
  */
13
17
  export declare const hideNoTraceTraces: boolean;
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * An error that aborts execution but should not get stack traced: only the error message should get
3
3
  * logged.
4
+ *
5
+ * @category Util
4
6
  */
5
7
  export class VirmatorNoTraceError extends Error {
6
8
  name = 'VirmatorNoTraceError';
@@ -11,5 +13,7 @@ export class VirmatorNoTraceError extends Error {
11
13
  /**
12
14
  * Used for debugging. Set to `false` to see error traces. Should always be set back to `true` for
13
15
  * publishing.
16
+ *
17
+ * @category Util
14
18
  */
15
19
  export const hideNoTraceTraces = true;
@@ -1,6 +1,10 @@
1
1
  import { type RuntimeEnv } from '@augment-vir/common';
2
2
  import { type PackageType } from './plugin-env.js';
3
- /** Definition for a plugin's config file. */
3
+ /**
4
+ * Definition for a plugin's config file.
5
+ *
6
+ * @category Util
7
+ */
4
8
  export type VirmatorPluginConfigFile = {
5
9
  /**
6
10
  * The path from which the config file resides within the virmator plugin itself. Relative to
@@ -30,7 +34,11 @@ export type VirmatorPluginConfigFile = {
30
34
  skipPrivatePackages?: boolean | undefined;
31
35
  configFlags?: string[];
32
36
  };
33
- /** {@link VirmatorPluginConfigFile} but with resolved paths too. */
37
+ /**
38
+ * {@link VirmatorPluginConfigFile} but with resolved paths too.
39
+ *
40
+ * @category Util
41
+ */
34
42
  export type VirmatorPluginResolvedConfigFile = VirmatorPluginConfigFile & {
35
43
  /** Absolute path to the config's copy to location. */
36
44
  fullCopyToPath: string;
@@ -1,4 +1,8 @@
1
- /** The different npm package types that virmator supports. */
1
+ /**
2
+ * The different npm package types that virmator supports.
3
+ *
4
+ * @category Util
5
+ */
2
6
  export declare enum PackageType {
3
7
  /** The root of an npm mono repo package. */
4
8
  MonoRoot = "mono-root",
@@ -1,4 +1,8 @@
1
- /** The different npm package types that virmator supports. */
1
+ /**
2
+ * The different npm package types that virmator supports.
3
+ *
4
+ * @category Util
5
+ */
2
6
  export var PackageType;
3
7
  (function (PackageType) {
4
8
  /** The root of an npm mono repo package. */
@@ -4,7 +4,11 @@ import { type ColorKey } from 'runstorm';
4
4
  import { type VirmatorPluginResolvedConfigFile } from './plugin-configs.js';
5
5
  import { type PackageType } from './plugin-env.js';
6
6
  import { type IndividualPluginCommand, type PluginNpmDeps, type VirmatorPluginCliCommands, type VirmatorPluginInit } from './plugin-init.js';
7
- /** A picked nesting of commands based on which commands are currently in use. */
7
+ /**
8
+ * A picked nesting of commands based on which commands are currently in use.
9
+ *
10
+ * @category Util
11
+ */
8
12
  export type UsedVirmatorPluginCommands<Commands extends VirmatorPluginCliCommands = VirmatorPluginCliCommands> = Partial<Readonly<{
9
13
  [CliCommand in keyof Commands]: Readonly<Omit<IndividualPluginCommand, 'subCommands'> & {
10
14
  subCommands: Commands[CliCommand] extends {
@@ -12,7 +16,11 @@ export type UsedVirmatorPluginCommands<Commands extends VirmatorPluginCliCommand
12
16
  } ? UsedVirmatorPluginCommands<SubCommands> : EmptyObject;
13
17
  }>;
14
18
  }>>;
15
- /** The resolved configs from a virmator plugin. */
19
+ /**
20
+ * The resolved configs from a virmator plugin.
21
+ *
22
+ * @category Util
23
+ */
16
24
  export type VirmatorPluginResolvedConfigs<Commands extends VirmatorPluginCliCommands = VirmatorPluginCliCommands> = Readonly<{
17
25
  [Command in keyof Commands]: (Commands[Command]['configFiles'] extends infer Configs extends AnyObject ? {
18
26
  configs: {
@@ -26,7 +34,11 @@ export type VirmatorPluginResolvedConfigs<Commands extends VirmatorPluginCliComm
26
34
  subCommands?: never;
27
35
  });
28
36
  }>;
29
- /** An npm package nested within a mono repo. */
37
+ /**
38
+ * An npm package nested within a mono repo.
39
+ *
40
+ * @category Util
41
+ */
30
42
  export type MonoRepoPackage = {
31
43
  packageName: string;
32
44
  relativePath: string;
@@ -34,13 +46,21 @@ export type MonoRepoPackage = {
34
46
  /** `true` if the package's `package.json` has `"private": true`. */
35
47
  isPrivate: boolean;
36
48
  };
37
- /** Run a command per npm package nested within a mono repo. */
49
+ /**
50
+ * Run a command per npm package nested within a mono repo.
51
+ *
52
+ * @category Util
53
+ */
38
54
  export type RunPerPackage = (generateCliCommandString: (params: {
39
55
  packageCwd: string;
40
56
  packageName: string;
41
57
  color: ColorKey;
42
58
  }) => MaybePromise<string | undefined>, maxProcesses?: number | undefined | 'tree') => Promise<void>;
43
- /** Extra, optional options for a plugin's `runShellCommand` param. */
59
+ /**
60
+ * Extra, optional options for a plugin's `runShellCommand` param.
61
+ *
62
+ * @category Util
63
+ */
44
64
  export type ExtraRunShellCommandOptions = {
45
65
  /** Optional prefix before every log. */
46
66
  logPrefix: string | undefined;
@@ -60,14 +80,26 @@ export type ExtraRunShellCommandOptions = {
60
80
  */
61
81
  prefixCommandOnly: boolean;
62
82
  };
63
- /** A parsed `package.json` with `name` and `version` properties required. */
83
+ /**
84
+ * A parsed `package.json` with `name` and `version` properties required.
85
+ *
86
+ * @category Util
87
+ */
64
88
  export type ValidPackageJson = SetRequired<PackageJson, 'name' | 'version'>;
65
- /** A generic virmator plugin definition. */
89
+ /**
90
+ * A generic virmator plugin definition.
91
+ *
92
+ * @category Util
93
+ */
66
94
  export type VirmatorPlugin<Commands extends VirmatorPluginCliCommands = any> = Readonly<VirmatorPluginInit<NoInfer<Commands>> & {
67
95
  pluginPackageRootPath: string;
68
96
  executor: VirmatorPluginExecutor<NoInfer<Commands>>;
69
97
  }>;
70
- /** All parameters required by a virmator plugin definition's executor. */
98
+ /**
99
+ * All parameters required by a virmator plugin definition's executor.
100
+ *
101
+ * @category Util
102
+ */
71
103
  export type VirmatorPluginExecutorParams<Commands extends VirmatorPluginCliCommands = VirmatorPluginCliCommands> = Readonly<{
72
104
  cliInputs: Readonly<{
73
105
  filteredArgs: string[];
@@ -105,7 +137,11 @@ export type VirmatorPluginExecutorParams<Commands extends VirmatorPluginCliComma
105
137
  pluginPackagePath: string;
106
138
  }>;
107
139
  }>;
108
- /** A virmator plugin definition's executor. This will call called by the virmator CLI. */
140
+ /**
141
+ * A virmator plugin definition's executor. This will call called by the virmator CLI.
142
+ *
143
+ * @category Util
144
+ */
109
145
  export type VirmatorPluginExecutor<Commands extends VirmatorPluginCliCommands = VirmatorPluginCliCommands> = (params: VirmatorPluginExecutorParams<Commands>) => MaybePromise<void | {
110
146
  noLog: true;
111
147
  }>;
@@ -1,23 +1,39 @@
1
1
  import { type RuntimeEnv } from '@augment-vir/common';
2
2
  import { type VirmatorPluginConfigFile } from './plugin-configs.js';
3
3
  import { type PackageType } from './plugin-env.js';
4
- /** A single doc entry for {@link PluginCommandDocs}. */
4
+ /**
5
+ * A single doc entry for {@link PluginCommandDocs}.
6
+ *
7
+ * @category Util
8
+ */
5
9
  export type PluginDocEntry = Readonly<{
6
10
  title?: string;
7
11
  content: string;
8
12
  }>;
9
- /** Documentation for a virmator plugin command. */
13
+ /**
14
+ * Documentation for a virmator plugin command.
15
+ *
16
+ * @category Util
17
+ */
10
18
  export type PluginCommandDocs = {
11
19
  sections: ReadonlyArray<string>;
12
20
  examples: ReadonlyArray<PluginDocEntry>;
13
21
  };
14
- /** A list of npm deps. Used for virmator plugin command lists. */
22
+ /**
23
+ * A list of npm deps. Used for virmator plugin command lists.
24
+ *
25
+ * @category Util
26
+ */
15
27
  export type PluginNpmDeps = Record<string, {
16
28
  type: NpmDepType;
17
29
  packageType: Partial<Record<PackageType, boolean>>;
18
30
  env: Partial<Record<RuntimeEnv, boolean>>;
19
31
  }>;
20
- /** An individual virmator plugin cli command definition. Can nest recursive commands. */
32
+ /**
33
+ * An individual virmator plugin cli command definition. Can nest recursive commands.
34
+ *
35
+ * @category Util
36
+ */
21
37
  export type IndividualPluginCommand = {
22
38
  /**
23
39
  * Documentation for this command which will be printed to the terminal when `virmator help` is
@@ -31,16 +47,28 @@ export type IndividualPluginCommand = {
31
47
  /** Dependencies that this command needs to be installed in the host repo. */
32
48
  npmDeps?: Readonly<PluginNpmDeps>;
33
49
  };
34
- /** The base type for a virmator plugin's collection of cli commands. */
50
+ /**
51
+ * The base type for a virmator plugin's collection of cli commands.
52
+ *
53
+ * @category Util
54
+ */
35
55
  export type VirmatorPluginCliCommands = Readonly<{
36
56
  [CliCommand in string]: IndividualPluginCommand;
37
57
  }>;
38
- /** The supported types of npm deps for virmator plugins to require. */
58
+ /**
59
+ * The supported types of npm deps for virmator plugins to require.
60
+ *
61
+ * @category Util
62
+ */
39
63
  export declare enum NpmDepType {
40
64
  Regular = "regular",
41
65
  Dev = "dev"
42
66
  }
43
- /** All init properties for a virmator plugin definition. */
67
+ /**
68
+ * All init properties for a virmator plugin definition.
69
+ *
70
+ * @category Util
71
+ */
44
72
  export type VirmatorPluginInit<Commands extends VirmatorPluginCliCommands = VirmatorPluginCliCommands> = Readonly<{
45
73
  /** A proper noun (capitalized) for your plugin. Used for debugging. */
46
74
  name: string;
@@ -1,4 +1,8 @@
1
- /** The supported types of npm deps for virmator plugins to require. */
1
+ /**
2
+ * The supported types of npm deps for virmator plugins to require.
3
+ *
4
+ * @category Util
5
+ */
2
6
  export var NpmDepType;
3
7
  (function (NpmDepType) {
4
8
  NpmDepType["Regular"] = "regular";
@@ -1,7 +1,11 @@
1
1
  import { type VirmatorPlugin, type VirmatorPluginExecutor } from './plugin-executor.js';
2
2
  import { type VirmatorPluginCliCommands, type VirmatorPluginInit } from './plugin-init.js';
3
3
  export type { VirmatorPlugin } from './plugin-executor.js';
4
- /** Define a virmator plugin. */
4
+ /**
5
+ * Define a virmator plugin.
6
+ *
7
+ * @category Util
8
+ */
5
9
  export declare function defineVirmatorPlugin<const Commands extends VirmatorPluginCliCommands>(
6
10
  /** Should be `import.meta.dirname`. Used to determine the directory of the plugin's package. */
7
11
  currentDir: string, init: VirmatorPluginInit<Commands>, executor: VirmatorPluginExecutor<NoInfer<Commands>>): VirmatorPlugin<NoInfer<Commands>>;
@@ -2,7 +2,11 @@ import { assert } from '@augment-vir/assert';
2
2
  import { findAncestor } from '@augment-vir/node';
3
3
  import { existsSync } from 'node:fs';
4
4
  import { join } from 'node:path';
5
- /** Define a virmator plugin. */
5
+ /**
6
+ * Define a virmator plugin.
7
+ *
8
+ * @category Util
9
+ */
6
10
  export function defineVirmatorPlugin(
7
11
  /** Should be `import.meta.dirname`. Used to determine the directory of the plugin's package. */
8
12
  currentDir, init, executor) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virmator/core",
3
- "version": "14.32.1",
3
+ "version": "14.34.0",
4
4
  "description": "Shared core functionality for all virmator plugins and the virmator CLI.",
5
5
  "keywords": [
6
6
  "automation",
@@ -32,17 +32,17 @@
32
32
  "test:update": "npm test update"
33
33
  },
34
34
  "dependencies": {
35
- "@augment-vir/assert": "^32.2.3",
36
- "@augment-vir/common": "^32.2.3",
37
- "@augment-vir/node": "^32.2.3",
35
+ "@augment-vir/assert": "^32.2.4",
36
+ "@augment-vir/common": "^32.2.4",
37
+ "@augment-vir/node": "^32.2.4",
38
38
  "mono-vir": "^2.5.1",
39
39
  "runstorm": "^1.0.6",
40
40
  "semver": "^7.8.5",
41
41
  "typescript": "^6.0.3"
42
42
  },
43
43
  "devDependencies": {
44
- "@augment-vir/test": "^32.2.3",
45
- "@types/node": "^26.2.0",
44
+ "@augment-vir/test": "^32.2.4",
45
+ "@types/node": "^26.4.0",
46
46
  "@types/semver": "^7.8.0",
47
47
  "esbuild": "^0.28.2"
48
48
  },