@plugjs/plug 0.0.14 → 0.0.16

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 (212) hide show
  1. package/dist/async.cjs +20 -19
  2. package/dist/async.cjs.map +1 -1
  3. package/dist/async.d.ts +9 -9
  4. package/dist/async.mjs +18 -17
  5. package/dist/async.mjs.map +1 -1
  6. package/dist/build.cjs +113 -110
  7. package/dist/build.cjs.map +2 -2
  8. package/dist/build.d.ts +14 -56
  9. package/dist/build.mjs +114 -111
  10. package/dist/build.mjs.map +2 -2
  11. package/dist/files.cjs +2 -16
  12. package/dist/files.cjs.map +1 -1
  13. package/dist/files.d.ts +3 -10
  14. package/dist/files.mjs +3 -17
  15. package/dist/files.mjs.map +1 -1
  16. package/dist/fork.cjs +28 -40
  17. package/dist/fork.cjs.map +1 -1
  18. package/dist/fork.d.ts +6 -27
  19. package/dist/fork.mjs +29 -40
  20. package/dist/fork.mjs.map +1 -1
  21. package/dist/helpers.cjs +27 -61
  22. package/dist/helpers.cjs.map +2 -2
  23. package/dist/helpers.d.ts +29 -31
  24. package/dist/helpers.mjs +27 -62
  25. package/dist/helpers.mjs.map +2 -2
  26. package/dist/index.cjs +15 -2
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.ts +9 -13
  29. package/dist/index.mjs +7 -2
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/log/colors.cjs +3 -1
  32. package/dist/log/colors.cjs.map +1 -1
  33. package/dist/log/colors.d.ts +2 -2
  34. package/dist/log/colors.mjs +3 -1
  35. package/dist/log/colors.mjs.map +1 -1
  36. package/dist/log/emit.d.ts +1 -1
  37. package/dist/log/logger.cjs +4 -0
  38. package/dist/log/logger.cjs.map +1 -1
  39. package/dist/log/logger.d.ts +4 -1
  40. package/dist/log/logger.mjs +4 -0
  41. package/dist/log/logger.mjs.map +1 -1
  42. package/dist/log/options.d.ts +1 -1
  43. package/dist/log/report.cjs +2 -11
  44. package/dist/log/report.cjs.map +1 -1
  45. package/dist/log/report.d.ts +36 -4
  46. package/dist/log/report.mjs +1 -10
  47. package/dist/log/report.mjs.map +1 -1
  48. package/dist/log.cjs +1 -1
  49. package/dist/log.cjs.map +1 -1
  50. package/dist/log.d.ts +6 -6
  51. package/dist/log.mjs +2 -2
  52. package/dist/log.mjs.map +1 -1
  53. package/dist/pipe.cjs +69 -26
  54. package/dist/pipe.cjs.map +1 -1
  55. package/dist/pipe.d.ts +178 -119
  56. package/dist/pipe.mjs +71 -24
  57. package/dist/pipe.mjs.map +1 -1
  58. package/dist/plugs/copy.cjs +15 -25
  59. package/dist/plugs/copy.cjs.map +2 -2
  60. package/dist/plugs/copy.d.ts +14 -13
  61. package/dist/plugs/copy.mjs +15 -17
  62. package/dist/plugs/copy.mjs.map +2 -2
  63. package/dist/plugs/coverage/analysis.d.ts +2 -2
  64. package/dist/plugs/coverage/report.cjs +1 -1
  65. package/dist/plugs/coverage/report.cjs.map +1 -1
  66. package/dist/plugs/coverage/report.d.ts +3 -3
  67. package/dist/plugs/coverage/report.mjs +1 -1
  68. package/dist/plugs/coverage/report.mjs.map +1 -1
  69. package/dist/plugs/coverage.cjs +20 -26
  70. package/dist/plugs/coverage.cjs.map +1 -1
  71. package/dist/plugs/coverage.d.ts +33 -30
  72. package/dist/plugs/coverage.mjs +21 -19
  73. package/dist/plugs/coverage.mjs.map +1 -1
  74. package/dist/plugs/debug.cjs +12 -36
  75. package/dist/plugs/debug.cjs.map +1 -1
  76. package/dist/plugs/debug.d.ts +4 -11
  77. package/dist/plugs/debug.mjs +30 -21
  78. package/dist/plugs/debug.mjs.map +1 -1
  79. package/dist/plugs/esbuild/fix-extensions.mjs +1 -1
  80. package/dist/plugs/esbuild/fix-extensions.mjs.map +1 -1
  81. package/dist/plugs/esbuild.cjs +14 -25
  82. package/dist/plugs/esbuild.cjs.map +1 -1
  83. package/dist/plugs/esbuild.d.ts +11 -16
  84. package/dist/plugs/esbuild.mjs +14 -17
  85. package/dist/plugs/esbuild.mjs.map +1 -1
  86. package/dist/plugs/eslint/runner.cjs +5 -6
  87. package/dist/plugs/eslint/runner.cjs.map +1 -1
  88. package/dist/plugs/eslint/runner.d.ts +6 -20
  89. package/dist/plugs/eslint/runner.mjs +6 -7
  90. package/dist/plugs/eslint/runner.mjs.map +1 -1
  91. package/dist/{task.cjs → plugs/eslint.cjs} +7 -24
  92. package/dist/plugs/eslint.cjs.map +6 -0
  93. package/dist/plugs/eslint.d.ts +34 -0
  94. package/dist/plugs/eslint.mjs +5 -0
  95. package/dist/plugs/eslint.mjs.map +6 -0
  96. package/dist/plugs/exec.cjs +20 -24
  97. package/dist/plugs/exec.cjs.map +1 -1
  98. package/dist/plugs/exec.d.ts +53 -53
  99. package/dist/plugs/exec.mjs +20 -23
  100. package/dist/plugs/exec.mjs.map +1 -1
  101. package/dist/plugs/filter.cjs +9 -19
  102. package/dist/plugs/filter.cjs.map +1 -1
  103. package/dist/plugs/filter.d.ts +21 -15
  104. package/dist/plugs/filter.mjs +10 -12
  105. package/dist/plugs/filter.mjs.map +1 -1
  106. package/dist/plugs/mocha/reporter.cjs +12 -6
  107. package/dist/plugs/mocha/reporter.cjs.map +1 -1
  108. package/dist/plugs/mocha/reporter.d.ts +0 -2
  109. package/dist/plugs/mocha/reporter.mjs +11 -4
  110. package/dist/plugs/mocha/reporter.mjs.map +1 -1
  111. package/dist/plugs/mocha/runner.cjs +4 -5
  112. package/dist/plugs/mocha/runner.cjs.map +1 -1
  113. package/dist/plugs/mocha/runner.d.ts +5 -31
  114. package/dist/plugs/mocha/runner.mjs +5 -6
  115. package/dist/plugs/mocha/runner.mjs.map +1 -1
  116. package/dist/plugs/mocha.cjs +22 -0
  117. package/dist/plugs/mocha.cjs.map +6 -0
  118. package/dist/plugs/mocha.d.ts +35 -0
  119. package/dist/plugs/mocha.mjs +5 -0
  120. package/dist/plugs/mocha.mjs.map +6 -0
  121. package/dist/plugs/rmf.cjs +4 -32
  122. package/dist/plugs/rmf.cjs.map +1 -1
  123. package/dist/plugs/rmf.d.ts +8 -12
  124. package/dist/plugs/rmf.mjs +25 -20
  125. package/dist/plugs/rmf.mjs.map +1 -1
  126. package/dist/plugs/tsc/compiler.d.ts +1 -1
  127. package/dist/plugs/tsc/options.d.ts +1 -1
  128. package/dist/plugs/tsc/report.d.ts +2 -2
  129. package/dist/plugs/tsc/runner.cjs +12 -11
  130. package/dist/plugs/tsc/runner.cjs.map +1 -1
  131. package/dist/plugs/tsc/runner.d.ts +4 -9
  132. package/dist/plugs/tsc/runner.mjs +12 -11
  133. package/dist/plugs/tsc/runner.mjs.map +1 -1
  134. package/dist/plugs/tsc.cjs +7 -0
  135. package/dist/plugs/tsc.cjs.map +6 -0
  136. package/dist/plugs/tsc.d.ts +36 -0
  137. package/dist/plugs/tsc.mjs +15 -0
  138. package/dist/plugs/tsc.mjs.map +6 -0
  139. package/dist/plugs.cjs +3 -5
  140. package/dist/plugs.cjs.map +1 -1
  141. package/dist/plugs.d.ts +10 -17
  142. package/dist/plugs.mjs +3 -5
  143. package/dist/plugs.mjs.map +1 -1
  144. package/dist/types.cjs +19 -0
  145. package/dist/types.cjs.map +6 -0
  146. package/dist/types.d.ts +71 -0
  147. package/dist/types.mjs +1 -0
  148. package/dist/types.mjs.map +6 -0
  149. package/dist/utils/caller.cjs +8 -11
  150. package/dist/utils/caller.cjs.map +2 -2
  151. package/dist/utils/caller.d.ts +2 -7
  152. package/dist/utils/caller.mjs +8 -11
  153. package/dist/utils/caller.mjs.map +2 -2
  154. package/dist/utils/options.cjs +4 -6
  155. package/dist/utils/options.cjs.map +1 -1
  156. package/dist/utils/options.d.ts +16 -15
  157. package/dist/utils/options.mjs +4 -6
  158. package/dist/utils/options.mjs.map +1 -1
  159. package/dist/utils/walk.d.ts +2 -2
  160. package/extra/cli.mjs +31 -20
  161. package/extra/ts-loader.mjs +6 -5
  162. package/package.json +8 -9
  163. package/src/async.ts +27 -19
  164. package/src/files.ts +6 -30
  165. package/src/fork.ts +35 -76
  166. package/src/helpers.ts +66 -99
  167. package/src/index.ts +10 -15
  168. package/src/log/colors.ts +4 -3
  169. package/src/log/emit.ts +4 -4
  170. package/src/log/logger.ts +12 -4
  171. package/src/log/options.ts +1 -1
  172. package/src/log/report.ts +8 -22
  173. package/src/log/spinner.ts +3 -3
  174. package/src/log.ts +9 -9
  175. package/src/paths.ts +1 -1
  176. package/src/pipe.ts +255 -170
  177. package/src/plugs/copy.ts +40 -31
  178. package/src/plugs/coverage/analysis.ts +4 -4
  179. package/src/plugs/coverage/report.ts +6 -5
  180. package/src/plugs/coverage.ts +64 -53
  181. package/src/plugs/debug.ts +28 -26
  182. package/src/plugs/esbuild/fix-extensions.ts +2 -2
  183. package/src/plugs/esbuild.ts +42 -46
  184. package/src/plugs/eslint/runner.ts +16 -31
  185. package/src/plugs/eslint.ts +42 -0
  186. package/src/plugs/exec.ts +93 -82
  187. package/src/plugs/filter.ts +42 -27
  188. package/src/plugs/mocha/reporter.ts +10 -5
  189. package/src/plugs/mocha/runner.ts +12 -38
  190. package/src/plugs/mocha.ts +41 -0
  191. package/src/plugs/rmf.ts +21 -25
  192. package/src/plugs/tsc/compiler.ts +1 -1
  193. package/src/plugs/tsc/options.ts +2 -2
  194. package/src/plugs/tsc/report.ts +2 -2
  195. package/src/plugs/tsc/runner.ts +24 -30
  196. package/src/plugs/tsc.ts +45 -0
  197. package/src/plugs.ts +10 -25
  198. package/src/types.ts +116 -0
  199. package/src/utils/caller.ts +11 -22
  200. package/src/utils/options.ts +49 -17
  201. package/src/utils/walk.ts +4 -4
  202. package/dist/run.cjs +0 -90
  203. package/dist/run.cjs.map +0 -6
  204. package/dist/run.d.ts +0 -89
  205. package/dist/run.mjs +0 -65
  206. package/dist/run.mjs.map +0 -6
  207. package/dist/task.cjs.map +0 -6
  208. package/dist/task.d.ts +0 -15
  209. package/dist/task.mjs +0 -14
  210. package/dist/task.mjs.map +0 -6
  211. package/src/run.ts +0 -159
  212. package/src/task.ts +0 -26
@@ -1,6 +1,6 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QAAQ,OAAO,aAAa,OAAO;AAChD,QAAI,OAAO;AAAQ,aAAO,KAAK,IAAI;AAGnC,UAAM,UAAU,QAAQ,MAAM;AAC9B,QAAI,KAAK,gBAAgB,QAAQ,QAAQ,cAAc,GAAG,QAAQ,SAAS,CAAC;AAC5E,WAAO;AAAA,EACT;AACF;",
5
5
  "names": ["failures"]
6
6
  }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ // plugs/tsc.ts
4
+ var import_paths = require("../paths.cjs");
5
+ var import_pipe = require("../pipe.cjs");
6
+ (0, import_pipe.installForking)("tsc", (0, import_paths.requireResolve)(__filename, "./tsc/runner"));
7
+ //# sourceMappingURL=tsc.cjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/plugs/tsc.ts"],
4
+ "mappings": ";;;AAEA,mBAA+B;AAC/B,kBAA+B;AAAA,IAyC/B,4BAAe,WAAO,6BAAe,YAAW,cAAc,CAAC;",
5
+ "names": []
6
+ }
@@ -0,0 +1,36 @@
1
+ import type { CompilerOptions } from 'typescript';
2
+ declare module '../pipe' {
3
+ interface Pipe {
4
+ /**
5
+ * Run the {@link https://www.typescriptlang.org/ TypeScript Compiler}
6
+ * over the input source files, using the default `tsconfig.json` file.
7
+ */
8
+ tsc(): Pipe;
9
+ /**
10
+ * Run the {@link https://www.typescriptlang.org/ TypeScript Compiler}
11
+ * over the input source files, specifying the `tsconfig.json` file.
12
+ *
13
+ * @param configFile The `tsconfig.json` file to use.
14
+ */
15
+ tsc(configFile: string): Pipe;
16
+ /**
17
+ * Run the {@link https://www.typescriptlang.org/ TypeScript Compiler}
18
+ * over the input source files, using the default `tsconfig.json` file
19
+ * and overriding some options
20
+ *
21
+ * @param options {@link CompilerOptions | Options} overriding what's
22
+ * currently specified in the default `tsconfig.json`.
23
+ */
24
+ tsc(options: CompilerOptions): Pipe;
25
+ /**
26
+ * Run the {@link https://www.typescriptlang.org/ TypeScript Compiler}
27
+ * over the input source files, specifying the `tsconfig.json` file
28
+ * and overriding some options
29
+ *
30
+ * @param configFile The `tsconfig.json` file to use.
31
+ * @param options {@link CompilerOptions | Options} overriding what's
32
+ * currently specified in the specified `tsconfig.json`.
33
+ */
34
+ tsc(configFile: string, options: CompilerOptions): Pipe;
35
+ }
36
+ }
@@ -0,0 +1,15 @@
1
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
+ var __commonJS = (cb, mod) => function __require() {
3
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
+ };
5
+
6
+ // plugs/tsc.ts
7
+ import { requireResolve } from "../paths.mjs";
8
+ import { installForking } from "../pipe.mjs";
9
+ var require_tsc = __commonJS({
10
+ "plugs/tsc.ts"() {
11
+ installForking("tsc", requireResolve(import.meta.url, "./tsc/runner"));
12
+ }
13
+ });
14
+ export default require_tsc();
15
+ //# sourceMappingURL=tsc.mjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/plugs/tsc.ts"],
4
+ "mappings": ";;;;;;AAEA,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAH/B;AAAA;AA4CA,mBAAe,OAAO,eAAe,iBAAW,cAAc,CAAC;AAAA;AAAA;",
5
+ "names": []
6
+ }
package/dist/plugs.cjs CHANGED
@@ -17,8 +17,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
17
17
  // plugs.ts
18
18
  var plugs_exports = {};
19
19
  module.exports = __toCommonJS(plugs_exports);
20
- var import_fork = require("./fork.cjs");
21
- var import_paths = require("./paths.cjs");
20
+ __reExport(plugs_exports, require("./plugs/eslint.cjs"), module.exports);
21
+ __reExport(plugs_exports, require("./plugs/mocha.cjs"), module.exports);
22
+ __reExport(plugs_exports, require("./plugs/tsc.cjs"), module.exports);
22
23
  __reExport(plugs_exports, require("./plugs/copy.cjs"), module.exports);
23
24
  __reExport(plugs_exports, require("./plugs/coverage.cjs"), module.exports);
24
25
  __reExport(plugs_exports, require("./plugs/debug.cjs"), module.exports);
@@ -26,7 +27,4 @@ __reExport(plugs_exports, require("./plugs/esbuild.cjs"), module.exports);
26
27
  __reExport(plugs_exports, require("./plugs/exec.cjs"), module.exports);
27
28
  __reExport(plugs_exports, require("./plugs/filter.cjs"), module.exports);
28
29
  __reExport(plugs_exports, require("./plugs/rmf.cjs"), module.exports);
29
- (0, import_fork.installForking)("eslint", (0, import_paths.requireResolve)(__filename, "./plugs/eslint/runner"));
30
- (0, import_fork.installForking)("mocha", (0, import_paths.requireResolve)(__filename, "./plugs/mocha/runner"));
31
- (0, import_fork.installForking)("tsc", (0, import_paths.requireResolve)(__filename, "./plugs/tsc/runner"));
32
30
  //# sourceMappingURL=plugs.cjs.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/plugs.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAIA,kBAA+B;AAC/B,mBAA+B;AAsB/B,0BAAc,6BA3Bd;AA4BA,0BAAc,iCA5Bd;AA6BA,0BAAc,8BA7Bd;AA8BA,0BAAc,gCA9Bd;AA+BA,0BAAc,6BA/Bd;AAgCA,0BAAc,+BAhCd;AAiCA,0BAAc,4BAjCd;AAAA,IAmBA,4BAAe,cAAU,6BAAe,YAAW,uBAAuB,CAAC;AAAA,IAC3E,4BAAe,aAAS,6BAAe,YAAW,sBAAsB,CAAC;AAAA,IACzE,4BAAe,WAAO,6BAAe,YAAW,oBAAoB,CAAC;",
4
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAIA,0BAAc,+BAJd;AAKA,0BAAc,8BALd;AAMA,0BAAc,4BANd;AAYA,0BAAc,6BAZd;AAaA,0BAAc,iCAbd;AAcA,0BAAc,8BAdd;AAeA,0BAAc,gCAfd;AAgBA,0BAAc,6BAhBd;AAiBA,0BAAc,+BAjBd;AAkBA,0BAAc,4BAlBd;",
5
5
  "names": []
6
6
  }
package/dist/plugs.d.ts CHANGED
@@ -1,17 +1,10 @@
1
- import type ESLint from './plugs/eslint/runner.js';
2
- import type Mocha from './plugs/mocha/runner.js';
3
- import type Tsc from './plugs/tsc/runner.js';
4
- declare module './pipe.js' {
5
- interface Pipe {
6
- eslint: PipeExtension<typeof ESLint>;
7
- mocha: PipeExtension<typeof Mocha>;
8
- tsc: PipeExtension<typeof Tsc>;
9
- }
10
- }
11
- export * from './plugs/copy.js';
12
- export * from './plugs/coverage.js';
13
- export * from './plugs/debug.js';
14
- export * from './plugs/esbuild.js';
15
- export * from './plugs/exec.js';
16
- export * from './plugs/filter.js';
17
- export * from './plugs/rmf.js';
1
+ export * from './plugs/eslint';
2
+ export * from './plugs/mocha';
3
+ export * from './plugs/tsc';
4
+ export * from './plugs/copy';
5
+ export * from './plugs/coverage';
6
+ export * from './plugs/debug';
7
+ export * from './plugs/esbuild';
8
+ export * from './plugs/exec';
9
+ export * from './plugs/filter';
10
+ export * from './plugs/rmf';
package/dist/plugs.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  // plugs.ts
2
- import { installForking } from "./fork.mjs";
3
- import { requireResolve } from "./paths.mjs";
2
+ export * from "./plugs/eslint.mjs";
3
+ export * from "./plugs/mocha.mjs";
4
+ export * from "./plugs/tsc.mjs";
4
5
  export * from "./plugs/copy.mjs";
5
6
  export * from "./plugs/coverage.mjs";
6
7
  export * from "./plugs/debug.mjs";
@@ -8,7 +9,4 @@ export * from "./plugs/esbuild.mjs";
8
9
  export * from "./plugs/exec.mjs";
9
10
  export * from "./plugs/filter.mjs";
10
11
  export * from "./plugs/rmf.mjs";
11
- installForking("eslint", requireResolve(import.meta.url, "./plugs/eslint/runner"));
12
- installForking("mocha", requireResolve(import.meta.url, "./plugs/mocha/runner"));
13
- installForking("tsc", requireResolve(import.meta.url, "./plugs/tsc/runner"));
14
12
  //# sourceMappingURL=plugs.mjs.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/plugs.ts"],
4
- "mappings": ";AAIA,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAsB/B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAdd,eAAe,UAAU,eAAe,iBAAW,uBAAuB,CAAC;AAC3E,eAAe,SAAS,eAAe,iBAAW,sBAAsB,CAAC;AACzE,eAAe,OAAO,eAAe,iBAAW,oBAAoB,CAAC;",
4
+ "mappings": ";AAIA,cAAc;AACd,cAAc;AACd,cAAc;AAMd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
5
5
  "names": []
6
6
  }
package/dist/types.cjs ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/types.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
5
+ "names": []
6
+ }
@@ -0,0 +1,71 @@
1
+ import type { Files } from './files';
2
+ import type { AbsolutePath } from './paths';
3
+ import type { Pipe } from './pipe';
4
+ /**
5
+ * A type describing the ultimate result of a {@link Plug}, {@link Pipe} or
6
+ * {@link Task}, that is either a {@link Files} instance or `undefined`.
7
+ */
8
+ export declare type Result = Files | undefined;
9
+ /**
10
+ * The {@link State} interface defines a component tracking the current
11
+ * _state_ of a build, caching the result of {@link Task}s, and tracking their
12
+ * invocation stack to avoid infinite loops.
13
+ */
14
+ export interface State {
15
+ /** The cache of the result of {@link Task}s execution */
16
+ readonly cache: Map<Task, Promise<Result>>;
17
+ /** The current {@link Task} invocation stack (to avoid infinite loops) */
18
+ readonly stack: Task[];
19
+ /** All {@link Tasks} available in this {@link State} */
20
+ readonly tasks: Tasks;
21
+ /** All _properties_ available in this {@link State} */
22
+ readonly props: Props;
23
+ }
24
+ /**
25
+ * The {@link Task} interface normalizes a task definition, associating it with
26
+ * its build file, its sibling {@link Task}s and available _properties_.
27
+ */
28
+ export interface Task<T extends Result = Result> {
29
+ /** All _properties_ siblings to this {@link Task} */
30
+ readonly props: Props;
31
+ /** All {@link Tasks} sibling to this {@link Task} */
32
+ readonly tasks: Tasks;
33
+ /** The absolute file name where this {@link Task} was defined */
34
+ readonly buildFile: AbsolutePath;
35
+ /** Invoke a task from (possibly) a different {@link Context} */
36
+ call(state: State, taskName: string): Promise<T>;
37
+ }
38
+ /**
39
+ * The {@link TaskResult} type identifies _what_ can be returned by a
40
+ * {@link TaskDef | _task definition_}.
41
+ */
42
+ export declare type TaskResult = Pipe | Files | void | undefined;
43
+ /** The {@link TaskDef} type identifies the _definition_ of a task. */
44
+ export declare type TaskDef<R extends TaskResult = TaskResult> = () => R | Promise<R>;
45
+ /** A type identifying all _properties_ of a {@link Context}. */
46
+ export declare type Props<D extends BuildDef = BuildDef> = {
47
+ readonly [k in string & keyof D as D[k] extends string ? k : never]: string;
48
+ };
49
+ /** A type identifying all _tasks_ in a {@link Context} */
50
+ export declare type Tasks<D extends BuildDef = BuildDef> = {
51
+ readonly [k in string & keyof D as D[k] extends TaskDef | Task ? k : never]: D[k] extends TaskDef<infer R> ? R extends void | undefined ? Task<undefined> : R extends Pipe | Files ? Task<Files> : never : D[k] extends Task ? D[k] : never;
52
+ };
53
+ /**
54
+ * The {@link BuildDef} interface describes the _definition_ of a {@link Build},
55
+ * all its properties and tasks.
56
+ */
57
+ export interface BuildDef {
58
+ [k: string]: string | TaskDef | Task;
59
+ }
60
+ /**
61
+ * The type that will be used for `this` when invoking
62
+ * {@link TaskDef | task definitions }.
63
+ */
64
+ export declare type ThisBuild<D extends BuildDef> = {
65
+ readonly [k in keyof D]: k extends string ? D[k] extends TaskDef<infer R> ? R extends Promise<undefined> | void | undefined ? () => Promise<undefined> : R extends Pipe | Files ? () => Pipe & Promise<Files> : never : D[k] extends Task<infer R> ? R extends undefined ? () => Promise<undefined> : R extends Files ? () => Pipe & Promise<Files> : never : D[k] extends string ? string : never : never;
66
+ };
67
+ /**
68
+ * The {@link Build} type represents the collection of {@link Task}s
69
+ * and _properties_ compiled from a {@link BuildDef | build definition}.
70
+ */
71
+ export declare type Build<D extends BuildDef = BuildDef> = Tasks<D> & Props<D>;
package/dist/types.mjs ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "mappings": "",
5
+ "names": []
6
+ }
@@ -26,6 +26,7 @@ module.exports = __toCommonJS(caller_exports);
26
26
  var import_node_fs = require("node:fs");
27
27
  var import_node_url = require("node:url");
28
28
  var import_assert = require("../assert.cjs");
29
+ var import_log = require("../log.cjs");
29
30
  var import_paths = require("../paths.cjs");
30
31
  function findCaller(of) {
31
32
  const oldPrepareStackTrace = Error.prepareStackTrace;
@@ -34,20 +35,16 @@ function findCaller(of) {
34
35
  const nullableFileOrUrl = stackTraces[0].getFileName();
35
36
  if (!nullableFileOrUrl)
36
37
  return;
37
- const nullableLine = stackTraces[0].getColumnNumber();
38
- const nullableColumn = stackTraces[0].getColumnNumber();
39
- const line = typeof nullableLine === "number" ? nullableLine : void 0;
40
- const column = typeof nullableColumn === "number" ? nullableColumn : void 0;
41
- const file = nullableFileOrUrl.startsWith("file:/") ? (0, import_node_url.fileURLToPath)(nullableFileOrUrl) : nullableFileOrUrl;
42
- (0, import_paths.assertAbsolutePath)(file);
43
- return { file, line, column };
38
+ const file2 = nullableFileOrUrl.startsWith("file:/") ? (0, import_node_url.fileURLToPath)(nullableFileOrUrl) : nullableFileOrUrl;
39
+ (0, import_paths.assertAbsolutePath)(file2);
40
+ return file2;
44
41
  };
45
42
  const record = {};
46
43
  Error.captureStackTrace(record, of);
47
- const location = record.stack;
48
- (0, import_assert.assert)(location, "Unable to determine build file name");
49
- (0, import_assert.assert)((0, import_node_fs.statSync)(location.file).isFile(), `Build file "${location.file}" not found`);
50
- return location;
44
+ const file = record.stack;
45
+ (0, import_assert.assert)(file, "Unable to determine build file name");
46
+ (0, import_assert.assert)((0, import_node_fs.statSync)(file).isFile(), `Build file ${(0, import_log.$p)(file)} not found`);
47
+ return file;
51
48
  } finally {
52
49
  Error.prepareStackTrace = oldPrepareStackTrace;
53
50
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/caller.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAyB;AACzB,sBAA8B;AAC9B,oBAAuB;AACvB,mBAAiD;AAQ1C,SAAS,WAAW,IAAuC;AAChE,QAAM,uBAAuB,MAAM;AAEnC,MAAI;AACF,UAAM,oBAAoB,CAAC,GAAG,gBAAsC;AAClE,YAAM,oBAAoB,YAAY,GAAG,YAAY;AACrD,UAAI,CAAE;AAAmB;AAEzB,YAAM,eAAe,YAAY,GAAG,gBAAgB;AACpD,YAAM,iBAAiB,YAAY,GAAG,gBAAgB;AAEtD,YAAM,OAAO,OAAO,iBAAiB,WAAW,eAAe;AAC/D,YAAM,SAAS,OAAO,mBAAmB,WAAW,iBAAiB;AAErE,YAAM,OACJ,kBAAkB,WAAW,QAAQ,QACnC,+BAAc,iBAAiB,IAC/B;AAEJ,2CAAmB,IAAI;AACvB,aAAO,EAAE,MAAM,MAAM,OAAO;AAAA,IAC9B;AAEA,UAAM,SAA+B,CAAC;AACtC,UAAM,kBAAkB,QAAQ,EAAE;AAClC,UAAM,WAAW,OAAO;AAExB,8BAAO,UAAU,qCAAqC;AACtD,kCAAO,yBAAS,SAAS,IAAI,EAAE,OAAO,GAAG,eAAe,SAAS,iBAAiB;AAClF,WAAO;AAAA,EACT,UAAE;AACA,UAAM,oBAAoB;AAAA,EAC5B;AACF;",
5
- "names": []
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAyB;AACzB,sBAA8B;AAC9B,oBAAuB;AACvB,iBAAmB;AACnB,mBAAiD;AAE1C,SAAS,WAAW,IAA2C;AACpE,QAAM,uBAAuB,MAAM;AAEnC,MAAI;AACF,UAAM,oBAAoB,CAAC,GAAG,gBAA0C;AACtE,YAAM,oBAAoB,YAAY,GAAG,YAAY;AACrD,UAAI,CAAE;AAAmB;AAEzB,YAAMA,QACJ,kBAAkB,WAAW,QAAQ,QACnC,+BAAc,iBAAiB,IAC/B;AAEJ,2CAAmBA,KAAI;AACvB,aAAOA;AAAA,IACT;AAEA,UAAM,SAAmC,CAAC;AAC1C,UAAM,kBAAkB,QAAQ,EAAE;AAClC,UAAM,OAAO,OAAO;AAEpB,8BAAO,MAAM,qCAAqC;AAClD,kCAAO,yBAAS,IAAI,EAAE,OAAO,GAAG,kBAAc,eAAG,IAAI,aAAa;AAClE,WAAO;AAAA,EACT,UAAE;AACA,UAAM,oBAAoB;AAAA,EAC5B;AACF;",
5
+ "names": ["file"]
6
6
  }
@@ -1,7 +1,2 @@
1
- import { AbsolutePath } from '../paths.js';
2
- export interface Location {
3
- file: AbsolutePath;
4
- line?: number | undefined;
5
- column?: number | undefined;
6
- }
7
- export declare function findCaller(of: (...args: any[]) => any): Location;
1
+ import { AbsolutePath } from '../paths';
2
+ export declare function findCaller(of: (...args: any[]) => any): AbsolutePath;
@@ -2,6 +2,7 @@
2
2
  import { statSync } from "node:fs";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { assert } from "../assert.mjs";
5
+ import { $p } from "../log.mjs";
5
6
  import { assertAbsolutePath } from "../paths.mjs";
6
7
  function findCaller(of) {
7
8
  const oldPrepareStackTrace = Error.prepareStackTrace;
@@ -10,20 +11,16 @@ function findCaller(of) {
10
11
  const nullableFileOrUrl = stackTraces[0].getFileName();
11
12
  if (!nullableFileOrUrl)
12
13
  return;
13
- const nullableLine = stackTraces[0].getColumnNumber();
14
- const nullableColumn = stackTraces[0].getColumnNumber();
15
- const line = typeof nullableLine === "number" ? nullableLine : void 0;
16
- const column = typeof nullableColumn === "number" ? nullableColumn : void 0;
17
- const file = nullableFileOrUrl.startsWith("file:/") ? fileURLToPath(nullableFileOrUrl) : nullableFileOrUrl;
18
- assertAbsolutePath(file);
19
- return { file, line, column };
14
+ const file2 = nullableFileOrUrl.startsWith("file:/") ? fileURLToPath(nullableFileOrUrl) : nullableFileOrUrl;
15
+ assertAbsolutePath(file2);
16
+ return file2;
20
17
  };
21
18
  const record = {};
22
19
  Error.captureStackTrace(record, of);
23
- const location = record.stack;
24
- assert(location, "Unable to determine build file name");
25
- assert(statSync(location.file).isFile(), `Build file "${location.file}" not found`);
26
- return location;
20
+ const file = record.stack;
21
+ assert(file, "Unable to determine build file name");
22
+ assert(statSync(file).isFile(), `Build file ${$p(file)} not found`);
23
+ return file;
27
24
  } finally {
28
25
  Error.prepareStackTrace = oldPrepareStackTrace;
29
26
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/caller.ts"],
4
- "mappings": ";AAAA,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAuB,0BAA0B;AAQ1C,SAAS,WAAW,IAAuC;AAChE,QAAM,uBAAuB,MAAM;AAEnC,MAAI;AACF,UAAM,oBAAoB,CAAC,GAAG,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AAA,EACT,UAAE;AACA,UAAM,oBAAoB;AAAA,EAC5B;AACF;",
5
+ "names": ["file"]
6
6
  }
@@ -25,13 +25,11 @@ __export(options_exports, {
25
25
  module.exports = __toCommonJS(options_exports);
26
26
  function parseOptions(args, defaults) {
27
27
  const params = [];
28
- const options = { ...defaults };
29
- for (const arg of args) {
30
- if (typeof arg === "string")
31
- params.push(arg);
32
- else
33
- Object.assign(options, arg);
28
+ const clone = [...args];
29
+ while (typeof clone[0] === "string") {
30
+ params.push(clone.shift());
34
31
  }
32
+ const options = Object.assign({}, defaults, clone.pop());
35
33
  return { params, options };
36
34
  }
37
35
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/options.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWO,SAAS,aAAgD,MAA6B,UAAyC;AACpI,QAAM,SAAmB,CAAC;AAC1B,QAAM,UAAe,EAAE,GAAG,SAAS;AAEnC,aAAW,OAAO,MAAM;AACtB,QAAI,OAAO,QAAQ;AAAU,aAAO,KAAK,GAAG;AAAA;AACvC,aAAO,OAAO,SAAS,GAAG;AAAA,EACjC;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;",
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCO,SAAS,aAId,MAAY,UAA4D;AACxE,QAAM,SAAmB,CAAC;AAC1B,QAAM,QAAe,CAAE,GAAG,IAAK;AAG/B,SAAO,OAAO,MAAM,OAAO,UAAU;AACnC,WAAO,KAAK,MAAM,MAAM,CAAC;AAAA,EAC3B;AAGA,QAAM,UAAU,OAAO,OAAO,CAAC,GAAG,UAAU,MAAM,IAAI,CAAC;AAGvD,SAAO,EAAE,QAAQ,QAAQ;AAC3B;",
5
5
  "names": []
6
6
  }
@@ -1,15 +1,16 @@
1
- export declare type ParsedOptions<Options> = {
2
- params: string[];
3
- options: Options;
4
- };
5
- export declare type ParsedOptionalOptions<Options> = {
6
- params: string[];
7
- options?: Options | undefined;
8
- };
9
- export declare type ParseOptions<Options> = string[] | [...string[], Options] | [Options];
10
- /** Parse an array of at least one string, followed by an optional `Options` argument. */
11
- export declare function parseOptions<Options>(args: ParseOptions<Options>): ParsedOptionalOptions<Options>;
12
- /** Parse an array of at least one string, followed by an optional `Options` argument. */
13
- export declare function parseOptions<Options>(args: ParseOptions<Options>, defaults?: undefined): ParsedOptionalOptions<Options>;
14
- /** Parse an array of at least one string, followed by an optional `Options` argument, ensuring some defaults are present. */
15
- export declare function parseOptions<Options, Defaults extends Options>(args: ParseOptions<Options>, defaults: Defaults): ParsedOptions<Options & Defaults>;
1
+ /** A type extacting string parameters from an arguments array */
2
+ export declare type ParsedParams<Args extends readonly any[]> = Args extends readonly [infer First, ...infer Rest] ? First extends string ? [First, ...ParsedParams<Rest>] : [] : Args extends readonly [...infer First, infer Rest] ? Rest extends string ? [...ParsedParams<First>, Rest] : [...ParsedParams<First>] : Args extends readonly string[] ? [...Args] : [];
3
+ /** A type extacting the (last) options type from an arguments array */
4
+ export declare type ParsedOptions<Args extends readonly any[]> = Args extends readonly [...string[], infer Last] ? Last extends object ? Last : never : never;
5
+ /** Parserable arguments: a number of strings, followed by optional options */
6
+ export declare type ParseOptions<Options extends Record<any, any>> = readonly [...params: string[]] | readonly [...params: string[], options: Options];
7
+ /** The return type from {@link ParseOptions} */
8
+ export interface ParsedResult<Args extends readonly any[], Options, Defaults> {
9
+ params: ParsedParams<Args>;
10
+ options: Defaults extends null | undefined ? Options | undefined : Options & Defaults;
11
+ }
12
+ /**
13
+ * Parse an array of arguments (a number of strings optionally followed by an
14
+ * options object into parameters and options.
15
+ */
16
+ export declare function parseOptions<Args extends ParseOptions<any>, Options extends ParsedOptions<Args> = ParsedOptions<Args>, Defaults extends ParsedOptions<Args> | null | undefined = undefined>(args: Args, defaults?: Defaults): ParsedResult<Args, Options, Defaults>;
@@ -1,13 +1,11 @@
1
1
  // utils/options.ts
2
2
  function parseOptions(args, defaults) {
3
3
  const params = [];
4
- const options = { ...defaults };
5
- for (const arg of args) {
6
- if (typeof arg === "string")
7
- params.push(arg);
8
- else
9
- Object.assign(options, arg);
4
+ const clone = [...args];
5
+ while (typeof clone[0] === "string") {
6
+ params.push(clone.shift());
10
7
  }
8
+ const options = Object.assign({}, defaults, clone.pop());
11
9
  return { params, options };
12
10
  }
13
11
  export {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/options.ts"],
4
- "mappings": ";AAWO,SAAS,aAAgD,MAA6B,UAAyC;AACpI,QAAM,SAAmB,CAAC;AAC1B,QAAM,UAAe,EAAE,GAAG,SAAS;AAEnC,aAAW,OAAO,MAAM;AACtB,QAAI,OAAO,QAAQ;AAAU,aAAO,KAAK,GAAG;AAAA;AACvC,aAAO,OAAO,SAAS,GAAG;AAAA,EACjC;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;",
4
+ "mappings": ";AAmCO,SAAS,aAId,MAAY,UAA4D;AACxE,QAAM,SAAmB,CAAC;AAC1B,QAAM,QAAe,CAAE,GAAG,IAAK;AAG/B,SAAO,OAAO,MAAM,OAAO,UAAU;AACnC,WAAO,KAAK,MAAM,MAAM,CAAC;AAAA,EAC3B;AAGA,QAAM,UAAU,OAAO,OAAO,CAAC,GAAG,UAAU,MAAM,IAAI,CAAC;AAGvD,SAAO,EAAE,QAAQ,QAAQ;AAC3B;",
5
5
  "names": []
6
6
  }
@@ -1,5 +1,5 @@
1
- import { AbsolutePath } from '../paths.js';
2
- import { MatchOptions } from './match.js';
1
+ import { AbsolutePath } from '../paths';
2
+ import { MatchOptions } from './match';
3
3
  /** Specific options for walking a directory */
4
4
  export interface WalkOptions extends MatchOptions {
5
5
  /**