@optique/discover 1.2.0-dev.2333 → 1.2.0-dev.2335

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  const require_chunk = require('./chunk-CUT6urMc.cjs');
3
3
  require('./command-C-NgG0KJ.cjs');
4
- require('./src-Bb2ONs5m.cjs');
5
- const require_generator = require('./generator-4mV9w1F0.cjs');
4
+ require('./src-DL9BHbjo.cjs');
5
+ const require_generator = require('./generator-B0OvR99S.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.2333+f7f47e8b";
18
+ var version = "1.2.0-dev.2335+26079d6b";
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
2
  import "./command-9sgrJtwh.js";
3
- import "./src-Ddp18zFp.js";
4
- import { watchCommandsModule, writeCommandsModule } from "./generator-CJiusCJb.js";
3
+ import "./src-BT2FzGqZ.js";
4
+ import { watchCommandsModule, writeCommandsModule } from "./generator-BY2Tdodb.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.2333+f7f47e8b";
17
+ var version = "1.2.0-dev.2335+26079d6b";
18
18
  var license = "MIT";
19
19
  var exports = {
20
20
  ".": "./src/index.ts",
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_src = require('./src-Bb2ONs5m.cjs');
2
+ const require_src = require('./src-DL9BHbjo.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"));
@@ -1,4 +1,4 @@
1
- import { getDefaultExtensions } from "./src-Ddp18zFp.js";
1
+ import { getDefaultExtensions } from "./src-BT2FzGqZ.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,6 +1,6 @@
1
1
  require('./command-C-NgG0KJ.cjs');
2
- require('./src-Bb2ONs5m.cjs');
3
- const require_generator = require('./generator-4mV9w1F0.cjs');
2
+ require('./src-DL9BHbjo.cjs');
3
+ const require_generator = require('./generator-B0OvR99S.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
1
  import "./command-9sgrJtwh.js";
2
- import "./src-Ddp18zFp.js";
3
- import { generateCommandsModule, watchCommandsModule, writeCommandsModule } from "./generator-CJiusCJb.js";
2
+ import "./src-BT2FzGqZ.js";
3
+ import { generateCommandsModule, watchCommandsModule, writeCommandsModule } from "./generator-BY2Tdodb.js";
4
4
 
5
5
  export { generateCommandsModule, watchCommandsModule, writeCommandsModule };
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  const require_command = require('./command-C-NgG0KJ.cjs');
2
- const require_src = require('./src-Bb2ONs5m.cjs');
2
+ const require_src = require('./src-DL9BHbjo.cjs');
3
3
 
4
4
  exports.commandsFromModules = require_src.commandsFromModules;
5
5
  exports.createProgramParser = require_src.createProgramParser;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { defineCommand, isCommand } from "./command-9sgrJtwh.js";
2
- import { commandsFromModules, createProgramParser, discoverCommands, getDefaultExtensions, runProgram } from "./src-Ddp18zFp.js";
2
+ import { commandsFromModules, createProgramParser, discoverCommands, getDefaultExtensions, runProgram } from "./src-BT2FzGqZ.js";
3
3
 
4
4
  export { commandsFromModules, createProgramParser, defineCommand, discoverCommands, getDefaultExtensions, isCommand, runProgram };
@@ -190,7 +190,7 @@ async function dispatchInvocation(invocation, programHooks) {
190
190
  if (commandHooks?.beforeEach != null) return invocation.handler(invocation.value, commandContext);
191
191
  if (programHooks?.beforeEach != null) return invocation.handler(invocation.value, programContext);
192
192
  return invocation.handler(invocation.value);
193
- }));
193
+ }, programContext));
194
194
  }
195
195
  /**
196
196
  * Runs an inner step wrapped in a single set of lifecycle hooks.
@@ -198,13 +198,14 @@ async function dispatchInvocation(invocation, programHooks) {
198
198
  * @param hooks The hooks for this scope, if any.
199
199
  * @param invocation The selected command invocation passed to `beforeEach`.
200
200
  * @param inner The step to wrap; receives the context from `beforeEach`.
201
+ * @param fallbackContext The context used when `beforeEach` is absent.
201
202
  * @returns The value returned by `inner`.
202
203
  * @throws The original error thrown by `beforeEach`, `inner`, or `afterEach`,
203
204
  * re-thrown after `onError` runs. An error thrown by `onError` itself
204
205
  * is suppressed so it cannot mask the original failure.
205
206
  */
206
- async function runHookScope(hooks, invocation, inner) {
207
- let context = {};
207
+ async function runHookScope(hooks, invocation, inner, fallbackContext = {}) {
208
+ let context = fallbackContext;
208
209
  try {
209
210
  if (hooks?.beforeEach != null) context = await hooks.beforeEach(invocation) ?? {};
210
211
  const result = await inner(context);
@@ -191,7 +191,7 @@ async function dispatchInvocation(invocation, programHooks) {
191
191
  if (commandHooks?.beforeEach != null) return invocation.handler(invocation.value, commandContext);
192
192
  if (programHooks?.beforeEach != null) return invocation.handler(invocation.value, programContext);
193
193
  return invocation.handler(invocation.value);
194
- }));
194
+ }, programContext));
195
195
  }
196
196
  /**
197
197
  * Runs an inner step wrapped in a single set of lifecycle hooks.
@@ -199,13 +199,14 @@ async function dispatchInvocation(invocation, programHooks) {
199
199
  * @param hooks The hooks for this scope, if any.
200
200
  * @param invocation The selected command invocation passed to `beforeEach`.
201
201
  * @param inner The step to wrap; receives the context from `beforeEach`.
202
+ * @param fallbackContext The context used when `beforeEach` is absent.
202
203
  * @returns The value returned by `inner`.
203
204
  * @throws The original error thrown by `beforeEach`, `inner`, or `afterEach`,
204
205
  * re-thrown after `onError` runs. An error thrown by `onError` itself
205
206
  * is suppressed so it cannot mask the original failure.
206
207
  */
207
- async function runHookScope(hooks, invocation, inner) {
208
- let context = {};
208
+ async function runHookScope(hooks, invocation, inner, fallbackContext = {}) {
209
+ let context = fallbackContext;
209
210
  try {
210
211
  if (hooks?.beforeEach != null) context = await hooks.beforeEach(invocation) ?? {};
211
212
  const result = await inner(context);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/discover",
3
- "version": "1.2.0-dev.2333",
3
+ "version": "1.2.0-dev.2335",
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.2333+f7f47e8b",
87
- "@optique/run": "1.2.0-dev.2333+f7f47e8b"
86
+ "@optique/run": "1.2.0-dev.2335+26079d6b",
87
+ "@optique/core": "1.2.0-dev.2335+26079d6b"
88
88
  },
89
89
  "devDependencies": {
90
90
  "@types/node": "^24.0.0",