@qui-cli/plugin 4.0.0 → 4.1.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [4.1.0](https://github.com/battis/qui-cli/compare/plugin/4.0.0...plugin/4.1.0) (2026-01-18)
6
+
7
+
8
+ ### Features
9
+
10
+ * deprecated Plugin.hydrate() ([4194966](https://github.com/battis/qui-cli/commit/41949660396847f2560675242aed460370a3b7b4))
11
+ * simple Plugin.Conf.defaultHook() factory ([ee881f6](https://github.com/battis/qui-cli/commit/ee881f6bf91b39876dc05a49f434260725e52301))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * compile against Node.js v24 ([7b06b4f](https://github.com/battis/qui-cli/commit/7b06b4f4ac4f9688719041ab8b1d837b3a0ee214))
17
+ * no longer require ESM modules only as plugins ([cbf178c](https://github.com/battis/qui-cli/commit/cbf178c8a6f3cec49aff8b6de08fd547e66fb9f7))
18
+
5
19
  ## [4.0.0](https://github.com/battis/qui-cli/compare/plugin/3.0.0...plugin/4.0.0) (2025-11-07)
6
20
 
7
21
 
package/dist/Conf.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export type Base = Record<string, unknown>;
2
+ export type Hook<C extends Base = Base> = (config: C) => void | Promise<void>;
3
+ export type Validator<C extends Base = Base> = Record<keyof C, (proposal?: unknown) => boolean | Promise<boolean>>;
4
+ export declare function propose<C extends Base = Base>(config: C, proposal?: C, validator?: Validator<C>): Promise<void>;
5
+ export declare function defaultHook<C extends Base = Base>(config: C, validator?: Validator<C>): Hook<C>;
package/dist/Conf.js ADDED
@@ -0,0 +1,12 @@
1
+ export async function propose(config, proposal = {}, validator = {}) {
2
+ for (const key in proposal) {
3
+ if (proposal[key] !== undefined) {
4
+ if (!validator[key] || (await validator[key](proposal[key]))) {
5
+ config[key] = proposal[key];
6
+ }
7
+ }
8
+ }
9
+ }
10
+ export function defaultHook(config, validator) {
11
+ return async (proposal = {}) => propose(config, proposal, validator);
12
+ }
@@ -1 +1,2 @@
1
+ /** @deprecated use default */
1
2
  export declare function hydrate<Fallback, Proposed extends Fallback | undefined>(proposed: Proposed, fallback: Fallback): Fallback;
@@ -1,3 +1,4 @@
1
+ /** @deprecated use default */
1
2
  export function hydrate(proposed, fallback) {
2
3
  if (proposed === undefined) {
3
4
  return fallback;
package/dist/Init.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { ConfigSetFromMetaSet, OptionsResults } from 'jackspeak';
2
+ import * as Opt from './Opt.js';
3
+ type FlattenConfigMetaSets<O extends Opt.Options> = ConfigSetFromMetaSet<'number', false, Exclude<O['num'], undefined>> & ConfigSetFromMetaSet<'number', true, Exclude<O['numList'], undefined>> & ConfigSetFromMetaSet<'string', false, Exclude<O['opt'], undefined>> & ConfigSetFromMetaSet<'string', false, Exclude<O['opt'], undefined>> & ConfigSetFromMetaSet<'string', true, Exclude<O['optList'], undefined>> & ConfigSetFromMetaSet<'boolean', false, Exclude<O['flag'], undefined>> & ConfigSetFromMetaSet<'boolean', true, Exclude<O['flagList'], undefined>> & Exclude<O['fields'], undefined>;
4
+ export type Arguments<O extends Opt.Options> = {
5
+ positionals: (string | undefined)[];
6
+ values: OptionsResults<FlattenConfigMetaSets<O>>;
7
+ };
8
+ export type ExpectedArguments<H extends Opt.Hook> = Arguments<Awaited<ReturnType<H>>>;
9
+ export type Hook<O extends Opt.Options = Opt.Options> = (args: Arguments<O>) => void | Promise<void>;
10
+ export {};
package/dist/Plugin.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import * as Configuration from './Configuration.js';
2
- import * as Initialization from './Initialization.js';
3
- import * as Options from './Options.js';
1
+ import * as Conf from './Conf.js';
2
+ import * as Init from './Init.js';
3
+ import * as Opt from './Opt.js';
4
4
  import * as Run from './Run.js';
5
5
  export type Base = {
6
6
  name: string;
7
- configure?: Configuration.Hook;
8
- options?: Options.Hook;
9
- init?: Initialization.Hook;
7
+ configure?: Conf.Hook;
8
+ options?: Opt.Hook;
9
+ init?: Init.Hook;
10
10
  run?: Run.Hook;
11
11
  } & Record<string, unknown>;
@@ -1,14 +1,14 @@
1
- import { Base as PluginConfiguration } from './Configuration.js';
2
- import { Arguments } from './Initialization.js';
3
- import { Options } from './Options.js';
4
- import { Base as Plugin } from './Plugin.js';
5
- import { AccumulatedResults } from './Run.js';
6
- export declare function registered(): Plugin[];
7
- export declare function register(plugin: Plugin): Promise<void>;
1
+ import * as Conf from './Conf.js';
2
+ import * as Init from './Init.js';
3
+ import * as Opt from './Opt.js';
4
+ import * as Plugin from './Plugin.js';
5
+ import * as Run from './Run.js';
6
+ export declare function registered(): Plugin.Base[];
7
+ export declare function register(plugin: Plugin.Base): Promise<void>;
8
8
  export declare function reset(): void;
9
9
  export type Configuration = {
10
- [key: string]: PluginConfiguration;
10
+ [key: string]: Conf.Base;
11
11
  };
12
12
  export declare function configure(config?: Configuration): Promise<void>;
13
- export declare function init(args: Arguments<Options>): Promise<void>;
14
- export declare function run(): Promise<AccumulatedResults>;
13
+ export declare function init(args: Init.Arguments<Opt.Options>): Promise<void>;
14
+ export declare function run(): Promise<Run.AccumulatedResults>;
package/dist/Registrar.js CHANGED
@@ -1,4 +1,4 @@
1
- import { documentDefaults } from './Options.js';
1
+ import * as Opt from './Opt.js';
2
2
  const plugins = [];
3
3
  export function registered() {
4
4
  return plugins;
@@ -13,15 +13,13 @@ export async function register(plugin) {
13
13
  }
14
14
  }
15
15
  plugins.push({
16
- ...plugin,
17
- options: async () => {
18
- if (plugin.options) {
19
- return documentDefaults(await plugin.options());
20
- }
21
- else {
22
- return {};
23
- }
24
- }
16
+ name: plugin.name,
17
+ configure: plugin.configure ? plugin.configure.bind(plugin) : undefined,
18
+ options: plugin.options
19
+ ? async () => plugin.options ? Opt.documentDefaults(await plugin.options()) : {}
20
+ : undefined,
21
+ init: plugin.init ? plugin.init.bind(plugin) : undefined,
22
+ run: plugin.run ? plugin.run.bind(plugin) : undefined
25
23
  });
26
24
  }
27
25
  export function reset() {
package/dist/Run.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export type Result = any;
1
+ export type Result = unknown;
2
2
  export type AccumulatedResults = Record<string, Result>;
3
3
  export type Hook = (results?: AccumulatedResults) => Result | Promise<Result>;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
- export { Base as Configuration } from './Configuration.js';
2
- export { Arguments, ExpectedArguments } from './Initialization.js';
3
- export { Options, documentDefaults } from './Options.js';
1
+ export * as Conf from './Conf.js';
2
+ export * as Init from './Init.js';
3
+ export * as Opt from './Opt.js';
4
4
  export * as Registrar from './Registrar.js';
5
+ export * as Run from './Run.js';
6
+ export { Base as Configuration } from './Conf.js';
7
+ export { Arguments, ExpectedArguments } from './Init.js';
8
+ export { Options, documentDefaults } from './Opt.js';
5
9
  export { AccumulatedResults } from './Run.js';
6
- export * from './Utilities.js';
7
10
  export { register } from './Registrar.js';
11
+ export * from './Deprecated.js';
package/dist/index.js CHANGED
@@ -1,4 +1,8 @@
1
- export { documentDefaults } from './Options.js';
1
+ export * as Conf from './Conf.js';
2
+ export * as Init from './Init.js';
3
+ export * as Opt from './Opt.js';
2
4
  export * as Registrar from './Registrar.js';
3
- export * from './Utilities.js';
5
+ export * as Run from './Run.js';
6
+ export { documentDefaults } from './Opt.js';
4
7
  export { register } from './Registrar.js';
8
+ export * from './Deprecated.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qui-cli/plugin",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "@qui-cli plugin structure and registrar",
5
5
  "homepage": "https://github.com/battis/qui-cli/tree/main/packages/plugin#readme",
6
6
  "repository": {
@@ -18,13 +18,13 @@
18
18
  "types": "./dist/index.d.ts",
19
19
  "dependencies": {
20
20
  "jackspeak": "^4.1.1",
21
- "@qui-cli/colors": "3.1.0"
21
+ "@qui-cli/colors": "3.2.3"
22
22
  },
23
23
  "devDependencies": {
24
- "@tsconfig/node20": "^20.1.6",
25
- "@types/node": "^24.10.0",
26
- "commit-and-tag-version": "^12.6.0",
27
- "del-cli": "^6.0.0",
24
+ "@tsconfig/node24": "^24.0.4",
25
+ "@types/node": "^24.10.9",
26
+ "commit-and-tag-version": "^12.6.1",
27
+ "del-cli": "^7.0.0",
28
28
  "npm-run-all": "^4.1.5",
29
29
  "typescript": "^5.9.3"
30
30
  },
@@ -34,6 +34,6 @@
34
34
  "build": "run-s build:*",
35
35
  "build:clean": "run-s clean",
36
36
  "build:compile": "tsc",
37
- "release": "commit-and-tag-version"
37
+ "version": "commit-and-tag-version"
38
38
  }
39
39
  }
@@ -1,2 +0,0 @@
1
- export type Base = Record<string, unknown>;
2
- export type Hook = (config: Base) => void | Promise<void>;
@@ -1,10 +0,0 @@
1
- import { ConfigSetFromMetaSet, OptionsResults } from 'jackspeak';
2
- import * as Options from './Options.js';
3
- type FlattenConfigMetaSets<O extends Options.Options> = ConfigSetFromMetaSet<'number', false, Exclude<O['num'], undefined>> & ConfigSetFromMetaSet<'number', true, Exclude<O['numList'], undefined>> & ConfigSetFromMetaSet<'string', false, Exclude<O['opt'], undefined>> & ConfigSetFromMetaSet<'string', false, Exclude<O['opt'], undefined>> & ConfigSetFromMetaSet<'string', true, Exclude<O['optList'], undefined>> & ConfigSetFromMetaSet<'boolean', false, Exclude<O['flag'], undefined>> & ConfigSetFromMetaSet<'boolean', true, Exclude<O['flagList'], undefined>> & Exclude<O['fields'], undefined>;
4
- export type Arguments<O extends Options.Options> = {
5
- positionals: (string | undefined)[];
6
- values: OptionsResults<FlattenConfigMetaSets<O>>;
7
- };
8
- export type ExpectedArguments<H extends Options.Hook> = Arguments<Awaited<ReturnType<H>>>;
9
- export type Hook<O extends Options.Options = Options.Options> = (args: Arguments<O>) => void | Promise<void>;
10
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export * from './Utilities/hydrate.js';
package/dist/Utilities.js DELETED
@@ -1 +0,0 @@
1
- export * from './Utilities/hydrate.js';
File without changes
File without changes
File without changes