@optique/discover 1.2.0-dev.2255 → 1.2.0-dev.2259
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/dist/cli.cjs +4 -4
- package/dist/cli.js +4 -4
- package/dist/{command-DSHIV50v.js → command-9sgrJtwh.js} +1 -0
- package/dist/{command-C9u5sJZS.cjs → command-C-NgG0KJ.cjs} +1 -0
- package/dist/{command-DIfnalpt.d.cts → command-Dvg452tU.d.cts} +4 -2
- package/dist/{command-s80EaEXl.d.ts → command-egqHCvDL.d.ts} +4 -2
- package/dist/command.cjs +1 -1
- package/dist/command.d.cts +1 -1
- package/dist/command.d.ts +1 -1
- package/dist/command.js +1 -1
- package/dist/{generator-HNXr5Vz2.js → generator-B8UY7n7b.js} +1 -1
- package/dist/{generator-DW4rrPD2.cjs → generator-CkGpilfc.cjs} +1 -1
- package/dist/generator.cjs +3 -3
- package/dist/generator.js +3 -3
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{src-CzbbFDmi.cjs → src-C3_a7SFM.cjs} +2 -2
- package/dist/{src-CVATvqru.js → src-wHLRsXWK.js} +2 -2
- package/package.json +3 -3
package/dist/cli.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
3
|
-
require('./command-
|
|
4
|
-
require('./src-
|
|
5
|
-
const require_generator = require('./generator-
|
|
3
|
+
require('./command-C-NgG0KJ.cjs');
|
|
4
|
+
require('./src-C3_a7SFM.cjs');
|
|
5
|
+
const require_generator = require('./generator-CkGpilfc.cjs');
|
|
6
6
|
const require_main_check = require('./main-check-CwunSNpK.cjs');
|
|
7
7
|
const __optique_core_constructs = require_chunk.__toESM(require("@optique/core/constructs"));
|
|
8
8
|
const __optique_core_message = require_chunk.__toESM(require("@optique/core/message"));
|
|
@@ -15,7 +15,7 @@ const node_process = require_chunk.__toESM(require("node:process"));
|
|
|
15
15
|
|
|
16
16
|
//#region deno.json
|
|
17
17
|
var name = "@optique/discover";
|
|
18
|
-
var version = "1.2.0-dev.
|
|
18
|
+
var version = "1.2.0-dev.2259+0b30260e";
|
|
19
19
|
var license = "MIT";
|
|
20
20
|
var exports$1 = {
|
|
21
21
|
".": "./src/index.ts",
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./command-
|
|
3
|
-
import "./src-
|
|
4
|
-
import { watchCommandsModule, writeCommandsModule } from "./generator-
|
|
2
|
+
import "./command-9sgrJtwh.js";
|
|
3
|
+
import "./src-wHLRsXWK.js";
|
|
4
|
+
import { watchCommandsModule, writeCommandsModule } from "./generator-B8UY7n7b.js";
|
|
5
5
|
import { isMainModuleUrl } from "./main-check-mMnKfUZs.js";
|
|
6
6
|
import { object } from "@optique/core/constructs";
|
|
7
7
|
import { message } from "@optique/core/message";
|
|
@@ -14,7 +14,7 @@ import process from "node:process";
|
|
|
14
14
|
|
|
15
15
|
//#region deno.json
|
|
16
16
|
var name = "@optique/discover";
|
|
17
|
-
var version = "1.2.0-dev.
|
|
17
|
+
var version = "1.2.0-dev.2259+0b30260e";
|
|
18
18
|
var license = "MIT";
|
|
19
19
|
var exports = {
|
|
20
20
|
".": "./src/index.ts",
|
|
@@ -32,6 +32,7 @@ function isCommand(value) {
|
|
|
32
32
|
* @internal
|
|
33
33
|
*/
|
|
34
34
|
function validateHooks(hooks, scope) {
|
|
35
|
+
if (Array.isArray(hooks)) throw new TypeError(`${scope} hooks must be an object, not an array.`);
|
|
35
36
|
if (typeof hooks !== "object" || hooks == null) throw new TypeError(`${scope} hooks must be an object.`);
|
|
36
37
|
for (const name of [
|
|
37
38
|
"beforeEach",
|
|
@@ -33,6 +33,7 @@ function isCommand(value) {
|
|
|
33
33
|
* @internal
|
|
34
34
|
*/
|
|
35
35
|
function validateHooks(hooks, scope) {
|
|
36
|
+
if (Array.isArray(hooks)) throw new TypeError(`${scope} hooks must be an object, not an array.`);
|
|
36
37
|
if (typeof hooks !== "object" || hooks == null) throw new TypeError(`${scope} hooks must be an object.`);
|
|
37
38
|
for (const name of [
|
|
38
39
|
"beforeEach",
|
|
@@ -104,13 +104,15 @@ interface ProgramHooks {
|
|
|
104
104
|
*
|
|
105
105
|
* The returned {@link ProgramHookContext} is threaded forward as the second
|
|
106
106
|
* argument to the command handler (when this is the most specific hook scope)
|
|
107
|
-
* and to {@link afterEach} and {@link onError}.
|
|
107
|
+
* and to {@link afterEach} and {@link onError}. Returning a context is
|
|
108
|
+
* optional: omit the return or return `null`, and an empty context is
|
|
109
|
+
* threaded forward instead.
|
|
108
110
|
*
|
|
109
111
|
* Returning a promise is supported; the dispatcher awaits it. A rejected
|
|
110
112
|
* promise (or a thrown error) aborts the command before the handler runs and
|
|
111
113
|
* invokes {@link onError}.
|
|
112
114
|
*/
|
|
113
|
-
readonly beforeEach?: (invocation: ProgramInvocation) => ProgramHookContext | Promise<ProgramHookContext>;
|
|
115
|
+
readonly beforeEach?: (invocation: ProgramInvocation) => ProgramHookContext | null | void | Promise<ProgramHookContext | null | void>;
|
|
114
116
|
/**
|
|
115
117
|
* Called after the handler returns successfully, receiving the context from
|
|
116
118
|
* {@link beforeEach} (or an empty object when no `beforeEach` ran) and the
|
|
@@ -104,13 +104,15 @@ interface ProgramHooks {
|
|
|
104
104
|
*
|
|
105
105
|
* The returned {@link ProgramHookContext} is threaded forward as the second
|
|
106
106
|
* argument to the command handler (when this is the most specific hook scope)
|
|
107
|
-
* and to {@link afterEach} and {@link onError}.
|
|
107
|
+
* and to {@link afterEach} and {@link onError}. Returning a context is
|
|
108
|
+
* optional: omit the return or return `null`, and an empty context is
|
|
109
|
+
* threaded forward instead.
|
|
108
110
|
*
|
|
109
111
|
* Returning a promise is supported; the dispatcher awaits it. A rejected
|
|
110
112
|
* promise (or a thrown error) aborts the command before the handler runs and
|
|
111
113
|
* invokes {@link onError}.
|
|
112
114
|
*/
|
|
113
|
-
readonly beforeEach?: (invocation: ProgramInvocation) => ProgramHookContext | Promise<ProgramHookContext>;
|
|
115
|
+
readonly beforeEach?: (invocation: ProgramInvocation) => ProgramHookContext | null | void | Promise<ProgramHookContext | null | void>;
|
|
114
116
|
/**
|
|
115
117
|
* Called after the handler returns successfully, receiving the context from
|
|
116
118
|
* {@link beforeEach} (or an empty object when no `beforeEach` ran) and the
|
package/dist/command.cjs
CHANGED
package/dist/command.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AnyCommand, AnyStaticCommand, Command, CommandDefinition, CommandMetadata, CommandPath, ProgramHookContext, ProgramHooks, ProgramInvocation, StaticCommand, defineCommand, isCommand, validateHooks } from "./command-
|
|
1
|
+
import { AnyCommand, AnyStaticCommand, Command, CommandDefinition, CommandMetadata, CommandPath, ProgramHookContext, ProgramHooks, ProgramInvocation, StaticCommand, defineCommand, isCommand, validateHooks } from "./command-Dvg452tU.cjs";
|
|
2
2
|
export { AnyCommand, AnyStaticCommand, Command, CommandDefinition, CommandMetadata, CommandPath, ProgramHookContext, ProgramHooks, ProgramInvocation, StaticCommand, defineCommand, isCommand, validateHooks };
|
package/dist/command.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AnyCommand, AnyStaticCommand, Command, CommandDefinition, CommandMetadata, CommandPath, ProgramHookContext, ProgramHooks, ProgramInvocation, StaticCommand, defineCommand, isCommand, validateHooks } from "./command-
|
|
1
|
+
import { AnyCommand, AnyStaticCommand, Command, CommandDefinition, CommandMetadata, CommandPath, ProgramHookContext, ProgramHooks, ProgramInvocation, StaticCommand, defineCommand, isCommand, validateHooks } from "./command-egqHCvDL.js";
|
|
2
2
|
export { AnyCommand, AnyStaticCommand, Command, CommandDefinition, CommandMetadata, CommandPath, ProgramHookContext, ProgramHooks, ProgramInvocation, StaticCommand, defineCommand, isCommand, validateHooks };
|
package/dist/command.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getDefaultExtensions } from "./src-
|
|
1
|
+
import { getDefaultExtensions } from "./src-wHLRsXWK.js";
|
|
2
2
|
import { mkdir, readdir, realpath, stat, writeFile } from "node:fs/promises";
|
|
3
3
|
import { dirname, posix, relative, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_src = require('./src-
|
|
2
|
+
const require_src = require('./src-C3_a7SFM.cjs');
|
|
3
3
|
const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
|
|
4
4
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
5
5
|
const node_url = require_chunk.__toESM(require("node:url"));
|
package/dist/generator.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require('./command-
|
|
2
|
-
require('./src-
|
|
3
|
-
const require_generator = require('./generator-
|
|
1
|
+
require('./command-C-NgG0KJ.cjs');
|
|
2
|
+
require('./src-C3_a7SFM.cjs');
|
|
3
|
+
const require_generator = require('./generator-CkGpilfc.cjs');
|
|
4
4
|
|
|
5
5
|
exports.generateCommandsModule = require_generator.generateCommandsModule;
|
|
6
6
|
exports.watchCommandsModule = require_generator.watchCommandsModule;
|
package/dist/generator.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./command-
|
|
2
|
-
import "./src-
|
|
3
|
-
import { generateCommandsModule, watchCommandsModule, writeCommandsModule } from "./generator-
|
|
1
|
+
import "./command-9sgrJtwh.js";
|
|
2
|
+
import "./src-wHLRsXWK.js";
|
|
3
|
+
import { generateCommandsModule, watchCommandsModule, writeCommandsModule } from "./generator-B8UY7n7b.js";
|
|
4
4
|
|
|
5
5
|
export { generateCommandsModule, watchCommandsModule, writeCommandsModule };
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_command = require('./command-
|
|
2
|
-
const require_src = require('./src-
|
|
1
|
+
const require_command = require('./command-C-NgG0KJ.cjs');
|
|
2
|
+
const require_src = require('./src-C3_a7SFM.cjs');
|
|
3
3
|
|
|
4
4
|
exports.commandsFromModules = require_src.commandsFromModules;
|
|
5
5
|
exports.createProgramParser = require_src.createProgramParser;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyCommand, AnyStaticCommand, Command, CommandDefinition, CommandMetadata, CommandPath, ProgramHookContext, ProgramHooks, ProgramInvocation, StaticCommand, defineCommand, isCommand } from "./command-
|
|
1
|
+
import { AnyCommand, AnyStaticCommand, Command, CommandDefinition, CommandMetadata, CommandPath, ProgramHookContext, ProgramHooks, ProgramInvocation, StaticCommand, defineCommand, isCommand } from "./command-Dvg452tU.cjs";
|
|
2
2
|
import { Mode } from "@optique/core/parser";
|
|
3
3
|
import { FluentParser } from "@optique/core/fluent";
|
|
4
4
|
import { Message } from "@optique/core/message";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyCommand, AnyStaticCommand, Command, CommandDefinition, CommandMetadata, CommandPath, ProgramHookContext, ProgramHooks, ProgramInvocation, StaticCommand, defineCommand, isCommand } from "./command-
|
|
1
|
+
import { AnyCommand, AnyStaticCommand, Command, CommandDefinition, CommandMetadata, CommandPath, ProgramHookContext, ProgramHooks, ProgramInvocation, StaticCommand, defineCommand, isCommand } from "./command-egqHCvDL.js";
|
|
2
2
|
import { Message } from "@optique/core/message";
|
|
3
3
|
import { ProgramMetadata } from "@optique/core/program";
|
|
4
4
|
import { RunOptions } from "@optique/run";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineCommand, isCommand } from "./command-
|
|
2
|
-
import { commandsFromModules, createProgramParser, discoverCommands, getDefaultExtensions, runProgram } from "./src-
|
|
1
|
+
import { defineCommand, isCommand } from "./command-9sgrJtwh.js";
|
|
2
|
+
import { commandsFromModules, createProgramParser, discoverCommands, getDefaultExtensions, runProgram } from "./src-wHLRsXWK.js";
|
|
3
3
|
|
|
4
4
|
export { commandsFromModules, createProgramParser, defineCommand, discoverCommands, getDefaultExtensions, isCommand, runProgram };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_command = require('./command-
|
|
2
|
+
const require_command = require('./command-C-NgG0KJ.cjs');
|
|
3
3
|
const __optique_core_constructs = require_chunk.__toESM(require("@optique/core/constructs"));
|
|
4
4
|
const __optique_core_modifiers = require_chunk.__toESM(require("@optique/core/modifiers"));
|
|
5
5
|
const __optique_core_primitives = require_chunk.__toESM(require("@optique/core/primitives"));
|
|
@@ -200,7 +200,7 @@ async function dispatchInvocation(invocation, programHooks) {
|
|
|
200
200
|
async function runHookScope(hooks, invocation, inner) {
|
|
201
201
|
let context = {};
|
|
202
202
|
try {
|
|
203
|
-
if (hooks?.beforeEach != null) context = await hooks.beforeEach(invocation);
|
|
203
|
+
if (hooks?.beforeEach != null) context = await hooks.beforeEach(invocation) ?? {};
|
|
204
204
|
const result = await inner(context);
|
|
205
205
|
if (hooks?.afterEach != null) await hooks.afterEach(context, result);
|
|
206
206
|
return result;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isCommand, validateHooks } from "./command-
|
|
1
|
+
import { isCommand, validateHooks } from "./command-9sgrJtwh.js";
|
|
2
2
|
import { longestMatch, or } from "@optique/core/constructs";
|
|
3
3
|
import { map } from "@optique/core/modifiers";
|
|
4
4
|
import { command } from "@optique/core/primitives";
|
|
@@ -199,7 +199,7 @@ async function dispatchInvocation(invocation, programHooks) {
|
|
|
199
199
|
async function runHookScope(hooks, invocation, inner) {
|
|
200
200
|
let context = {};
|
|
201
201
|
try {
|
|
202
|
-
if (hooks?.beforeEach != null) context = await hooks.beforeEach(invocation);
|
|
202
|
+
if (hooks?.beforeEach != null) context = await hooks.beforeEach(invocation) ?? {};
|
|
203
203
|
const result = await inner(context);
|
|
204
204
|
if (hooks?.afterEach != null) await hooks.afterEach(context, result);
|
|
205
205
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/discover",
|
|
3
|
-
"version": "1.2.0-dev.
|
|
3
|
+
"version": "1.2.0-dev.2259",
|
|
4
4
|
"description": "Runtime-aware command discovery for Optique CLI programs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"optique-discover": "./dist/cli.js"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@optique/core": "1.2.0-dev.
|
|
87
|
-
"@optique/run": "1.2.0-dev.
|
|
86
|
+
"@optique/core": "1.2.0-dev.2259+0b30260e",
|
|
87
|
+
"@optique/run": "1.2.0-dev.2259+0b30260e"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@types/node": "^24.0.0",
|