@fynjs/run 1.1.0 → 1.1.2

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.
Files changed (103) hide show
  1. package/bin/qrun.js +6 -1
  2. package/bin/xrun.js +1 -1
  3. package/dist/cli/check-global.d.ts +1 -0
  4. package/{cli → dist/cli}/check-global.js +3 -3
  5. package/dist/cli/ck.d.ts +1 -0
  6. package/dist/cli/cli-options.d.ts +80 -0
  7. package/dist/cli/cli-options.js +95 -0
  8. package/dist/cli/config.d.ts +7 -0
  9. package/dist/cli/config.js +7 -0
  10. package/dist/cli/env.d.ts +17 -0
  11. package/dist/cli/env.js +31 -0
  12. package/dist/cli/npm-loader.d.ts +2 -0
  13. package/dist/cli/npm-loader.js +43 -0
  14. package/dist/cli/parse-cmd-args.d.ts +34 -0
  15. package/dist/cli/parse-cmd-args.js +199 -0
  16. package/dist/cli/provider-packages.d.ts +28 -0
  17. package/dist/cli/provider-packages.js +62 -0
  18. package/dist/cli/search-up-task-file.d.ts +8 -0
  19. package/dist/cli/search-up-task-file.js +79 -0
  20. package/dist/cli/task-file.d.ts +40 -0
  21. package/dist/cli/task-file.js +177 -0
  22. package/dist/cli/ts-runner.d.ts +2 -0
  23. package/dist/cli/ts-runner.js +60 -0
  24. package/dist/cli/usage.d.ts +2 -0
  25. package/dist/cli/wrap-process.d.ts +10 -0
  26. package/dist/cli/wrap-process.js +26 -0
  27. package/dist/cli/xrun-main.d.ts +119 -0
  28. package/dist/cli/xrun-main.js +417 -0
  29. package/dist/cli/xrun.d.ts +2 -0
  30. package/{cli → dist/cli}/xrun.js +0 -1
  31. package/dist/lib/chalk.d.ts +2 -0
  32. package/{lib → dist/lib}/chalk.js +0 -1
  33. package/dist/lib/cli-context.d.ts +97 -0
  34. package/dist/lib/cli-context.js +129 -0
  35. package/dist/lib/defaults.d.ts +30 -0
  36. package/{lib → dist/lib}/defaults.js +13 -16
  37. package/dist/lib/gen-xqid.d.ts +2 -0
  38. package/dist/lib/gen-xqid.js +8 -0
  39. package/dist/lib/index.d.ts +3 -0
  40. package/{lib → dist/lib}/index.js +0 -3
  41. package/dist/lib/logger.d.ts +2 -0
  42. package/dist/lib/logger.js +95 -0
  43. package/dist/lib/my-pkg.d.ts +4 -0
  44. package/dist/lib/my-pkg.js +42 -0
  45. package/dist/lib/ns-order.d.ts +7 -0
  46. package/dist/lib/ns-order.js +62 -0
  47. package/dist/lib/print-tasks/index.d.ts +2 -0
  48. package/dist/lib/print-tasks/index.js +100 -0
  49. package/dist/lib/reporters/console.d.ts +20 -0
  50. package/dist/lib/reporters/console.js +119 -0
  51. package/dist/lib/stringify.d.ts +2 -0
  52. package/dist/lib/stringify.js +19 -0
  53. package/dist/lib/util/parse-array.d.ts +2 -0
  54. package/dist/lib/util/parse-array.js +5 -0
  55. package/dist/lib/util/task-options.d.ts +37 -0
  56. package/dist/lib/util/task-options.js +115 -0
  57. package/dist/lib/util/update-env.d.ts +1 -0
  58. package/dist/lib/util/update-env.js +18 -0
  59. package/dist/lib/xqitem.d.ts +22 -0
  60. package/dist/lib/xqitem.js +57 -0
  61. package/dist/lib/xqtor.d.ts +57 -0
  62. package/dist/lib/xqtor.js +704 -0
  63. package/dist/lib/xqtree.d.ts +11 -0
  64. package/dist/lib/xqtree.js +33 -0
  65. package/dist/lib/xrun-instance.d.ts +9 -0
  66. package/dist/lib/xrun-instance.js +27 -0
  67. package/dist/lib/xrun.d.ts +55 -0
  68. package/dist/lib/xrun.js +317 -0
  69. package/dist/lib/xtask-spec.d.ts +10 -0
  70. package/dist/lib/xtask-spec.js +57 -0
  71. package/dist/lib/xtasks.d.ts +25 -0
  72. package/dist/lib/xtasks.js +119 -0
  73. package/package.json +39 -15
  74. package/cli/cli-options.js +0 -98
  75. package/cli/config.js +0 -8
  76. package/cli/env.js +0 -33
  77. package/cli/npm-loader.js +0 -56
  78. package/cli/parse-cmd-args.js +0 -156
  79. package/cli/provider-packages.js +0 -73
  80. package/cli/search-up-task-file.js +0 -92
  81. package/cli/task-file.js +0 -192
  82. package/cli/ts-runner.js +0 -62
  83. package/cli/wrap-process.js +0 -27
  84. package/cli/xrun-main.js +0 -425
  85. package/lib/cli-context.js +0 -145
  86. package/lib/gen-xqid.js +0 -10
  87. package/lib/logger.js +0 -105
  88. package/lib/ns-order.js +0 -76
  89. package/lib/print-tasks/index.js +0 -105
  90. package/lib/reporters/console.js +0 -133
  91. package/lib/stringify.js +0 -16
  92. package/lib/util/parse-array.js +0 -5
  93. package/lib/util/update-env.js +0 -16
  94. package/lib/xqitem.js +0 -70
  95. package/lib/xqtor.js +0 -814
  96. package/lib/xqtree.js +0 -41
  97. package/lib/xrun-instance.js +0 -33
  98. package/lib/xrun.d.ts +0 -89
  99. package/lib/xrun.js +0 -344
  100. package/lib/xtask-spec.js +0 -63
  101. package/lib/xtasks.js +0 -137
  102. /package/{cli → dist/cli}/ck.js +0 -0
  103. /package/{cli → dist/cli}/usage.js +0 -0
@@ -0,0 +1,79 @@
1
+ import Path from "path";
2
+ import Fs from "fs";
3
+ import config from "./config.js";
4
+ /*
5
+ * Look for xrun file at xrunDir
6
+ * Search up each directory if `search` is true
7
+ * Until a file "package.json" is found or top is reached
8
+ */
9
+ function searchUpTaskFile(xrunDir, search) {
10
+ let result;
11
+ let dir = xrunDir;
12
+ do {
13
+ result = findTaskFile(dir);
14
+ // If we found a task file or package.json, stop searching
15
+ if (result.found || result.foundPkg) {
16
+ break;
17
+ }
18
+ // If we're not searching up or we've hit the root, stop
19
+ if (!search)
20
+ break;
21
+ const tmp = Path.join(dir, "..");
22
+ if (!tmp || tmp === "." || tmp === dir) {
23
+ break;
24
+ }
25
+ dir = tmp;
26
+ } while (true);
27
+ // If we didn't find a task file, use the original directory
28
+ if (!result.found) {
29
+ result.dir = xrunDir;
30
+ }
31
+ return result;
32
+ }
33
+ function findTaskFile(xrunDir) {
34
+ const dirFiles = Fs.readdirSync(xrunDir);
35
+ const files = config.search;
36
+ // First check the root directory
37
+ let xrunFile;
38
+ files.find(n => (xrunFile = dirFiles.find(f => f.startsWith(n))));
39
+ // If found in root, return it
40
+ if (xrunFile) {
41
+ const foundPkg = Boolean(dirFiles.find(f => f === "package.json"));
42
+ return {
43
+ found: true,
44
+ foundPkg,
45
+ xrunFile: Path.join(xrunDir, xrunFile),
46
+ dir: xrunDir
47
+ };
48
+ }
49
+ // If not found in root, check subdirectories: scripts/, tools/, build/, tasks/
50
+ const subDirs = ["scripts", "tools", "build", "tasks"];
51
+ for (const subDir of subDirs) {
52
+ const subDirPath = Path.join(xrunDir, subDir);
53
+ try {
54
+ const subDirFiles = Fs.readdirSync(subDirPath);
55
+ files.find(n => (xrunFile = subDirFiles.find(f => f.startsWith(n))));
56
+ if (xrunFile) {
57
+ const foundPkg = Boolean(dirFiles.find(f => f === "package.json"));
58
+ return {
59
+ found: true,
60
+ foundPkg,
61
+ xrunFile: Path.join(subDirPath, xrunFile),
62
+ dir: xrunDir
63
+ };
64
+ }
65
+ }
66
+ catch (err) {
67
+ // Subdirectory doesn't exist or can't be read, skip it
68
+ }
69
+ }
70
+ // Not found anywhere
71
+ const foundPkg = Boolean(dirFiles.find(f => f === "package.json"));
72
+ return {
73
+ found: false,
74
+ foundPkg,
75
+ xrunFile: undefined,
76
+ dir: xrunDir
77
+ };
78
+ }
79
+ export { searchUpTaskFile, findTaskFile };
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Update the current working directory
3
+ * @param {string} [dir] - Directory to change to
4
+ * @returns {string} New working directory
5
+ */
6
+ declare function updateCwd(dir: any): any;
7
+ /**
8
+ * Search for task files in the given directory
9
+ * @param {boolean} search - Whether to search up directories
10
+ * @param {ParseOptions} opts - Search options
11
+ * @returns {SearchResult} Search result
12
+ */
13
+ declare function searchTaskFile(search: any, opts: any): any;
14
+ /**
15
+ * Load a task file.
16
+ *
17
+ * Loading goes through `import()` rather than `require`, which is what lets a task file use
18
+ * top-level await - node's `require(esm)` refuses that graph outright and always will. Every
19
+ * other format keeps working: `import()` of a CommonJS file yields a namespace with
20
+ * `module.exports` on `.default`, which processTasks already unwraps.
21
+ *
22
+ * @param {string} name - Path to the task file
23
+ * @returns {Promise<Object|Function|undefined>} Loaded task module, or undefined if it failed
24
+ */
25
+ declare function loadTaskFile(name: any): Promise<any>;
26
+ /**
27
+ * Process loaded tasks and register them with xrun
28
+ * @param {Object|Function} tasks - Tasks to process
29
+ * @param {string} loadMsg - Message to display when tasks are loaded
30
+ * @param {string} [ns="xrun"] - Namespace to load tasks into
31
+ */
32
+ declare function processTasks(tasks: any, loadMsg: any, ns?: string): void;
33
+ /**
34
+ * Load tasks from files or required modules
35
+ * @param {ParseOptions} opts - Options for loading tasks
36
+ * @param {SearchResult} searchResult - Result from searching for task files
37
+ * @returns {boolean} Whether any tasks were loaded
38
+ */
39
+ declare function loadTasks(opts: any, searchResult: any): Promise<boolean>;
40
+ export { updateCwd, searchTaskFile, loadTaskFile, processTasks, loadTasks };
@@ -0,0 +1,177 @@
1
+ import { pathToFileURL } from "node:url";
2
+ import Path from "path";
3
+ import env from "./env.js";
4
+ import xsh from "xsh";
5
+ import logger from "../lib/logger.js";
6
+ import config from "./config.js";
7
+ import ck from "./ck.js";
8
+ import { searchUpTaskFile } from "./search-up-task-file.js";
9
+ import WrapProcess from "./wrap-process.js";
10
+ import { createRequire } from "node:module";
11
+ import npmLoader from "./npm-loader.js";
12
+ import instance from "../lib/xrun-instance.js";
13
+ import TsRunner from "./ts-runner.js";
14
+ /**
15
+ * Update the current working directory
16
+ * @param {string} [dir] - Directory to change to
17
+ * @returns {string} New working directory
18
+ */
19
+ function updateCwd(dir) {
20
+ dir = dir || WrapProcess.cwd();
21
+ const newCwd = Path.isAbsolute(dir) ? dir : Path.resolve(dir);
22
+ try {
23
+ const cwd = WrapProcess.cwd();
24
+ if (newCwd !== cwd) {
25
+ WrapProcess.chdir(newCwd);
26
+ logger.log(ck `CWD changed to <magenta>${newCwd}</>`);
27
+ }
28
+ else if (env.get(env.xrunCwd) !== cwd) {
29
+ logger.log(ck `CWD is <magenta>${cwd}</>`);
30
+ }
31
+ env.set(env.xrunCwd, newCwd);
32
+ return newCwd;
33
+ }
34
+ catch (err) {
35
+ logger.log(ck `chdir <magenta>${newCwd}</> <red>failed</>`);
36
+ WrapProcess.exit(1);
37
+ }
38
+ }
39
+ /**
40
+ * Search for task files in the given directory
41
+ * @param {boolean} search - Whether to search up directories
42
+ * @param {ParseOptions} opts - Search options
43
+ * @returns {SearchResult} Search result
44
+ */
45
+ function searchTaskFile(search, opts) {
46
+ const xrunDir = Path.join(opts.cwd, opts.dir || "");
47
+ const loadResult = searchUpTaskFile(xrunDir, search);
48
+ if (!loadResult.found) {
49
+ if (env.get(env.xrunTaskFile) !== "not found") {
50
+ const x = xsh.pathCwd.replace(xrunDir, "./");
51
+ logger.log(ck `No <green>${config.taskFile}</> found in <magenta>${x}</>`);
52
+ }
53
+ // set env to let subsequent xrun calls know that the task file was not found
54
+ // and avoid logging the same message again
55
+ env.set(env.xrunTaskFile, "not found");
56
+ }
57
+ else if (opts.updateCwd !== false) {
58
+ // force CWD to where xrun task file was found
59
+ loadResult.cwd = updateCwd(loadResult.dir);
60
+ }
61
+ return loadResult;
62
+ }
63
+ /**
64
+ * Load a task file.
65
+ *
66
+ * Loading goes through `import()` rather than `require`, which is what lets a task file use
67
+ * top-level await - node's `require(esm)` refuses that graph outright and always will. Every
68
+ * other format keeps working: `import()` of a CommonJS file yields a namespace with
69
+ * `module.exports` on `.default`, which processTasks already unwraps.
70
+ *
71
+ * @param {string} name - Path to the task file
72
+ * @returns {Promise<Object|Function|undefined>} Loaded task module, or undefined if it failed
73
+ */
74
+ async function loadTaskFile(name) {
75
+ const ext = Path.extname(name);
76
+ if (ext === ".ts" || ext === ".tsx" || ext === ".mts" || ext === ".cts") {
77
+ TsRunner.startRunner();
78
+ }
79
+ try {
80
+ return await import(pathToFileURL(Path.resolve(name)).href);
81
+ }
82
+ catch (e) {
83
+ const file = xsh.pathCwd.replace(name, ".");
84
+ const errMsg = ck `<red>Unable to load ${file}</>`;
85
+ //
86
+ // node strips TypeScript types natively, which covers ordinary task files. It cannot
87
+ // handle syntax that has to be transformed rather than erased - enums, namespaces,
88
+ // parameter properties - and says so with its own code. Name the limit rather than
89
+ // dumping a stack that does not explain it.
90
+ //
91
+ /* istanbul ignore next */
92
+ if (e.code === "ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX" ||
93
+ e.code === "ERR_UNKNOWN_FILE_EXTENSION" ||
94
+ e.code === "ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING") {
95
+ logger.error(ck `${errMsg}: node cannot load this TypeScript on its own.
96
+ It strips types, but enums, namespaces and parameter properties need a real transform.
97
+ Rewrite them, or run node with <yellow>--experimental-transform-types</>.
98
+ ${e.message}`);
99
+ return undefined;
100
+ }
101
+ logger.error(`${errMsg}: ${xsh.pathCwd.replace(e.stack, ".", "g")}`);
102
+ return undefined;
103
+ }
104
+ }
105
+ /**
106
+ * Process loaded tasks and register them with xrun
107
+ * @param {Object|Function} tasks - Tasks to process
108
+ * @param {string} loadMsg - Message to display when tasks are loaded
109
+ * @param {string} [ns="xrun"] - Namespace to load tasks into
110
+ */
111
+ function processTasks(tasks, loadMsg, ns = "xrun") {
112
+ if (typeof tasks === "function") {
113
+ tasks(instance.xrun);
114
+ if (loadMsg) {
115
+ logger.log(`Loaded tasks by calling export function from ${loadMsg}`);
116
+ }
117
+ }
118
+ else if (typeof tasks === "object") {
119
+ if (tasks.default) {
120
+ processTasks(tasks.default, `${loadMsg} default export`, ns);
121
+ }
122
+ else if (Object.keys(tasks).length > 0) {
123
+ instance.xrun.load(ns, tasks);
124
+ logger.log(ck `Loaded tasks from ${loadMsg} into namespace <magenta>${ns}</>`);
125
+ }
126
+ else if (loadMsg) {
127
+ logger.log(`Loaded ${loadMsg}`);
128
+ }
129
+ }
130
+ else {
131
+ logger.log(ck `Unknown export type <yellow>${typeof tasks}</> from ${loadMsg}`);
132
+ }
133
+ }
134
+ /**
135
+ * Load tasks from files or required modules
136
+ * @param {ParseOptions} opts - Options for loading tasks
137
+ * @param {SearchResult} searchResult - Result from searching for task files
138
+ * @returns {boolean} Whether any tasks were loaded
139
+ */
140
+ async function loadTasks(opts, searchResult) {
141
+ let loaded = false;
142
+ npmLoader(instance.xrun, opts);
143
+ if (opts.require) {
144
+ // a for-of rather than forEach: each file has to finish loading before the next starts,
145
+ // so tasks land in the order the user listed their modules
146
+ for (const xmod of opts.require) {
147
+ let file;
148
+ try {
149
+ file = createRequire(Path.join(WrapProcess.cwd(), "package.json")).resolve(xmod);
150
+ }
151
+ catch (err) {
152
+ logger.log(ck `<red>ERROR:</> <yellow>Unable to require module</> <cyan>'${xmod}'</> - <red>${err.message}</>`);
153
+ continue;
154
+ }
155
+ const tasks = await loadTaskFile(file);
156
+ /* istanbul ignore else */
157
+ if (tasks) {
158
+ const loadMsg = ck `<green>${xmod}</>`;
159
+ processTasks(tasks, loadMsg);
160
+ loaded = true;
161
+ }
162
+ }
163
+ }
164
+ else if (searchResult.xrunFile) {
165
+ const tasks = await loadTaskFile(searchResult.xrunFile);
166
+ /* istanbul ignore else */
167
+ if (tasks) {
168
+ processTasks(tasks, env.get(env.xrunTaskFile) !== searchResult.xrunFile
169
+ ? ck `<green>${xsh.pathCwd.replace(searchResult.xrunFile, ".")}</>`
170
+ : "");
171
+ env.set(env.xrunTaskFile, searchResult.xrunFile);
172
+ return (loaded = true);
173
+ }
174
+ }
175
+ return loaded;
176
+ }
177
+ export { updateCwd, searchTaskFile, loadTaskFile, processTasks, loadTasks };
@@ -0,0 +1,2 @@
1
+ declare const TsRunner: any;
2
+ export default TsRunner;
@@ -0,0 +1,60 @@
1
+ import { createRequire } from "node:module";
2
+ import { makeOptionalRequire } from "optional-require";
3
+ //
4
+ // A require hook is the point here - TsRunner installs tsx / ts-node into require - so this
5
+ // deliberately stays on require rather than moving to optional-import.
6
+ //
7
+ const optionalRequire = makeOptionalRequire(createRequire(import.meta.url));
8
+ import env from "./env.js";
9
+ import logger from "../lib/logger.js";
10
+ import path from "path";
11
+ import WrapProcess from "./wrap-process.js";
12
+ const TsRunner = {
13
+ //
14
+ // `@fynjs/ts-resolve` is ESM-only, but it stays on this same require path: node's
15
+ // `require(esm)` is unflagged from 22.12, which is already this package's floor, and
16
+ // `./register` has no top-level await - the one graph `require(esm)` refuses. So it is
17
+ // required like the others and returns a (truthy) namespace object.
18
+ //
19
+ // It is first because it is the cheapest: a resolve hook feeding node's own type
20
+ // stripping, no transpiler and no native binary. Its only hard requirement is node
21
+ // >= 22.15 for `module.registerHooks`; below that the require throws, optional-require
22
+ // routes that to `fail`, and tsx / ts-node still get their turn.
23
+ //
24
+ "runner-ts-resolve": "@fynjs/ts-resolve/register",
25
+ "runner-ts-node": "ts-node/register/transpile-only",
26
+ loaded: undefined,
27
+ runner: undefined,
28
+ _require: optionalRequire,
29
+ load(name) {
30
+ const runner = TsRunner._require(TsRunner[`runner-${name}`], {
31
+ fail: e => (TsRunner[`error-${name}`] = e)
32
+ });
33
+ if (runner) {
34
+ TsRunner.loaded = name;
35
+ TsRunner.runner = runner;
36
+ const resolve = TsRunner._require.resolve;
37
+ TsRunner.path =
38
+ (resolve && ": " + path.relative(WrapProcess.cwd(), resolve(TsRunner[`runner-${name}`]))) ||
39
+ "";
40
+ }
41
+ return runner;
42
+ },
43
+ startRunner() {
44
+ const runners = ["ts-resolve", "ts-node"];
45
+ for (const runner of runners) {
46
+ if (TsRunner.load(runner)) {
47
+ break;
48
+ }
49
+ }
50
+ if (!TsRunner.loaded) {
51
+ const errMsg = runners.map(r => r + ": " + TsRunner[`error-${r}`]).join("\n ");
52
+ logger.log(`Unable to load a typescript runner:\n ${errMsg}`);
53
+ }
54
+ else if (!env.get(env.xrunId)) {
55
+ /* if xrunId exist then we are already running as invocation from another xrun */
56
+ logger.log(`Loaded ${TsRunner.loaded} for TypeScript files${TsRunner.path}`);
57
+ }
58
+ }
59
+ };
60
+ export default TsRunner;
@@ -0,0 +1,2 @@
1
+ declare const usage: string;
2
+ export default usage;
@@ -0,0 +1,10 @@
1
+ /** @type {WrapProcess} */
2
+ declare const WrapProcess: {
3
+ _process: NodeJS.Process;
4
+ exit(code: any): void;
5
+ cwd(): any;
6
+ chdir(dir: any): void;
7
+ argv: any;
8
+ env: any;
9
+ };
10
+ export default WrapProcess;
@@ -0,0 +1,26 @@
1
+ /** @type {WrapProcess} */
2
+ const WrapProcess = {
3
+ _process: process,
4
+ exit(code) {
5
+ this._process.exit(code);
6
+ },
7
+ cwd() {
8
+ return this._process.cwd();
9
+ },
10
+ chdir(dir) {
11
+ this._process.chdir(dir);
12
+ },
13
+ get argv() {
14
+ return this._process.argv;
15
+ },
16
+ set argv(value) {
17
+ this._process.argv = value;
18
+ },
19
+ get env() {
20
+ return this._process.env;
21
+ },
22
+ set env(value) {
23
+ this._process.env = value;
24
+ }
25
+ };
26
+ export default WrapProcess;
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Flush logger based on options
3
+ * @param {Object} opts - Options
4
+ */
5
+ declare function flushLogger(opts: any): void;
6
+ /**
7
+ * Handle process exit or callback
8
+ * @param {number} code - Exit code
9
+ * @param {Function} done - Optional callback
10
+ */
11
+ declare function handleExitOrDone(code: any, done: any): boolean;
12
+ /**
13
+ * Process environment options from command line
14
+ * @param {Object} opts - Options object containing env property
15
+ */
16
+ declare function processEnvOptions(opts: any): void;
17
+ /**
18
+ * List CLI options for shell auto completion
19
+ * @param {Array} argv - Command line arguments
20
+ * @param {number} offset - Argument offset
21
+ * @param {Function} done - Optional callback
22
+ * @returns {void}
23
+ */
24
+ declare function handleCliOptions(argv: any, offset: any, done: any): boolean;
25
+ /**
26
+ * Find and load the runner module
27
+ * @param {string} xrunPath - Path to xrun
28
+ * @returns {Object} Runner module and its path
29
+ */
30
+ declare function findRunnerModule(xrunPath: any): {
31
+ runner: any;
32
+ foundPath: string;
33
+ };
34
+ /**
35
+ * Handle case when no tasks are found
36
+ * @param {CliContext} cliContext - Command context
37
+ * @param {string} cwd - Current working directory
38
+ * @param {Function} done - Optional callback
39
+ */
40
+ declare function handleNoTasks(cliContext: any, cwd: any, done: any, opts: any): boolean;
41
+ /**
42
+ * Handle task listing
43
+ * @param {Object} runner - Runner instance
44
+ * @param {Object} opts - Options
45
+ * @param {Function} done - Optional callback
46
+ * @returns {void}
47
+ */
48
+ declare function handleTaskListing(runner: any, opts: any, done: any): boolean;
49
+ /**
50
+ * Handle namespace listing
51
+ * @param {Object} runner - Runner instance
52
+ * @param {Object} opts - Options
53
+ * @param {Function} done - Optional callback
54
+ * @returns {void}
55
+ */
56
+ declare function handleNamespaceListing(runner: any, opts: any, done: any): boolean;
57
+ /**
58
+ * Handle help display
59
+ * @param {Object} runner - Runner instance
60
+ * @param {CliContext} cliContext - Command context
61
+ * @param {Object} opts - Options
62
+ * @param {string} cmdName - Command name
63
+ * @param {Function} done - Optional callback
64
+ * @returns {void}
65
+ */
66
+ declare function handleHelp(runner: any, cliContext: any, opts: any, cmdName: any, done: any): boolean;
67
+ /**
68
+ * Setup node_modules bin in PATH
69
+ * @param {Object} opts - Options
70
+ */
71
+ declare function setupNodeModulesBin(opts: any): void;
72
+ /**
73
+ * Setup environment variables
74
+ */
75
+ declare function setupEnvironment(): void;
76
+ /**
77
+ * Process task arguments
78
+ * @param {Array} tasks - Task arguments
79
+ * @param {Object} opts - Options
80
+ * @returns {Array} Processed tasks
81
+ */
82
+ declare function processTasks(tasks: any, opts: any): any;
83
+ /**
84
+ * Handle quiet flag setting in environment
85
+ * @param {Object} jsonMeta - Command metadata
86
+ * @param {Object} opts - Command options
87
+ * @returns {boolean} - Whether quiet mode is enabled
88
+ */
89
+ declare function handleQuietFlag(jsonMeta: any, opts: any): any;
90
+ /**
91
+ * Main entry point for xrun
92
+ * @param {Array} argv - Command line arguments
93
+ * @param {number} offset - Argument offset
94
+ * @param {string} xrunPath - Path to xrun
95
+ * @param {Function} done - Optional callback
96
+ * @returns {*} Runner result or void
97
+ */
98
+ declare function xrunMain(argv: any, offset: any, xrunPath?: string, done?: any): Promise<any>;
99
+ import { INTERNALS } from "../lib/defaults.js";
100
+ export { xrunMain };
101
+ declare const _default: {
102
+ xrunMain: typeof xrunMain;
103
+ [INTERNALS]: {
104
+ flushLogger: typeof flushLogger;
105
+ handleExitOrDone: typeof handleExitOrDone;
106
+ handleCliOptions: typeof handleCliOptions;
107
+ findRunnerModule: typeof findRunnerModule;
108
+ handleNoTasks: typeof handleNoTasks;
109
+ handleTaskListing: typeof handleTaskListing;
110
+ handleNamespaceListing: typeof handleNamespaceListing;
111
+ handleHelp: typeof handleHelp;
112
+ setupNodeModulesBin: typeof setupNodeModulesBin;
113
+ setupEnvironment: typeof setupEnvironment;
114
+ processTasks: typeof processTasks;
115
+ handleQuietFlag: typeof handleQuietFlag;
116
+ processEnvOptions: typeof processEnvOptions;
117
+ };
118
+ };
119
+ export default _default;