@karmaniverous/stan-cli 0.13.1 → 0.14.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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import path from 'node:path';
3
- import { D as DBG_SCOPE_SNAP_CONTEXT_LEGACY, l as loadCliConfig } from './stan.js';
3
+ import { d as resolveNamedOrDefaultFunction, D as DBG_SCOPE_SNAP_CONTEXT_LEGACY, l as loadCliConfig } from './stan.js';
4
4
  import '@karmaniverous/stan-core';
5
5
  import 'commander';
6
6
  import 'node:fs';
@@ -22,43 +22,6 @@ import 'tree-kill';
22
22
  import 'signal-exit';
23
23
  import 'node:module';
24
24
 
25
- // src/common/interop/resolve.ts
26
- /**
27
- * Resolve a function export from a module, preferring a named export and
28
- * falling back to an identically named property on the module's default export.
29
- *
30
- * This helper avoids the use of `any`; callers provide the function type `F`
31
- * and the pickers that extract the candidate from the module shape (typed or unknown).
32
- *
33
- * @typeParam F - Function type to resolve (e.g., typeof import('./mod')['foo']).
34
- * @param mod - The imported module object (typed or unknown).
35
- * @param pickNamed - Extractor for the named export (returns undefined when absent).
36
- * @param pickDefault - Extractor for the default export's property (returns undefined when absent).
37
- * @param label - Optional label for error messaging.
38
- * @returns The resolved function of type F.
39
- * @throws When neither the named nor the default export provides the function.
40
- */
41
- function resolveNamedOrDefaultFunction(mod, pickNamed, pickDefault, label) {
42
- try {
43
- const named = pickNamed(mod);
44
- if (typeof named === 'function')
45
- return named;
46
- }
47
- catch {
48
- /* ignore pickNamed errors */
49
- }
50
- try {
51
- const viaDefault = pickDefault(mod);
52
- if (typeof viaDefault === 'function')
53
- return viaDefault;
54
- }
55
- catch {
56
- /* ignore pickDefault errors */
57
- }
58
- const what = label && label.trim().length ? label.trim() : 'export';
59
- throw new Error(`resolveNamedOrDefaultFunction: ${what} not found`);
60
- }
61
-
62
25
  /* src/stan/snap/context.ts
63
26
  * Resolve execution context for snap commands (cwd, stanPath, maxUndos).
64
27
  */
@@ -92,7 +55,7 @@ async function resolveContext(cwd0) {
92
55
  // evaluation-order hazards during module import.
93
56
  let engine;
94
57
  try {
95
- const effModUnknown = (await import('./stan.js').then(function (n) { return n.d; }));
58
+ const effModUnknown = (await import('./stan.js').then(function (n) { return n.f; }));
96
59
  // Decide if we should print a single success trace when STAN_DEBUG=1.
97
60
  const debugOn = () => process.env.STAN_DEBUG === '1';
98
61
  const debugTrace = (kind) => {