@visulima/task-runner 1.0.0-alpha.7 → 1.0.0-alpha.9

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 (81) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -1
  3. package/dist/index.d.ts +3093 -49
  4. package/dist/index.js +29 -19
  5. package/dist/packem_chunks/index.js +5593 -0
  6. package/dist/packem_shared/{Cache-CWaX_c8U.js → Cache-CbhoA268.js} +151 -10
  7. package/dist/packem_shared/{FileAccessTracker-CQ5Ot7Hd.js → FileAccessTracker-D8zIURPU.js} +1 -1
  8. package/dist/packem_shared/{FingerprintManager-CV7U4f4f.js → FingerprintManager-78DjwWQ4.js} +1 -1
  9. package/dist/packem_shared/HttpRemoteCache-BTXUBH7t.js +290 -0
  10. package/dist/packem_shared/INPUT_URI_SCHEMES-DRm76YI5.js +69 -0
  11. package/dist/packem_shared/{IncrementalFileHasher-BRS76-mb.js → IncrementalFileHasher-BBhVK491.js} +1 -1
  12. package/dist/packem_shared/ReapiRemoteCache-vgRxDMmu.js +1012 -0
  13. package/dist/packem_shared/{TaskOrchestrator-rf45vW5c.js → TaskOrchestrator-CdRaQhTO.js} +100 -11
  14. package/dist/packem_shared/{TrackedTaskExecutor-CFPpQfXF.js → TrackedTaskExecutor-CWSMfHAW.js} +2 -2
  15. package/dist/packem_shared/V2_ROOT-DKBLxKo4.js +14 -0
  16. package/dist/packem_shared/actionDigestForTaskHash-BRE-9MT6.js +121 -0
  17. package/dist/packem_shared/archive-CnggHWb-.js +152 -0
  18. package/dist/packem_shared/{buildForwardDependencyMap-DLPgKEto.js → buildForwardDependencyMap-0BJFMMPv.js} +1 -2
  19. package/dist/packem_shared/{collectFiles-ClXHnHhg.js → collectFiles-cc1gokGU.js} +2 -1
  20. package/dist/packem_shared/{computeTaskHash-DYqfrDGq.js → computeTaskHash-DHoBJ_-V.js} +10 -4
  21. package/dist/packem_shared/containsBlob-CwGB0a_q.js +125 -0
  22. package/dist/packem_shared/{createTaskGraph-B7nH0kY_.js → createTaskGraph-Bwl4hwAf.js} +23 -2
  23. package/dist/packem_shared/{defaultTaskRunner-Cp7jCmIl.js → defaultTaskRunner-BaX4ZbFv.js} +58 -15
  24. package/dist/packem_shared/{detectFrameworks-CeFzKE6J.js → detectFrameworks-D7nyTc-o.js} +1 -1
  25. package/dist/packem_shared/{detectScriptShell-CR-xXKA4.js → detectScriptShell-CzxCM9-t.js} +1 -1
  26. package/dist/packem_shared/digestBuffer-CPdI2E1d.js +48 -0
  27. package/dist/packem_shared/{expandArguments-0AwD2BIA.js → expandArguments-Ba-hHYff.js} +2 -1
  28. package/dist/packem_shared/expandTokensInString-Bb7nYehP.js +47 -0
  29. package/dist/packem_shared/{extractPackageName-BllKetnz.js → extractPackageName-CMHjqGj_.js} +2 -3
  30. package/dist/packem_shared/{generateRunSummary-BE1jnQ3H.js → generateRunSummary-Bah7CFay.js} +1 -1
  31. package/dist/packem_shared/getCurrentBranch-DVNikt0P.js +156 -0
  32. package/dist/packem_shared/getMainWorktreeRoot-iBqToQJ4.js +114 -0
  33. package/dist/packem_shared/{parseCommands-D-IgF8Zh.js → parseCommands-DDdIxaH5.js} +8 -3
  34. package/dist/packem_shared/resolveCacheMode-CsmHT_0o.js +21 -0
  35. package/dist/packem_shared/{runConcurrently-CmfC4r-f.js → runConcurrently-BCGQ9fJl.js} +1 -1
  36. package/dist/packem_shared/shell-quote-DWJJbt21.js +3 -0
  37. package/dist/packem_shared/{utils-zO0ZRgtf.js → utils-Bmnj-H2J.js} +4 -1
  38. package/index.js +556 -723
  39. package/package.json +26 -13
  40. package/dist/affected.d.ts +0 -82
  41. package/dist/archive.d.ts +0 -38
  42. package/dist/cache.d.ts +0 -138
  43. package/dist/chrome-trace.d.ts +0 -53
  44. package/dist/command-parser/expand-arguments.d.ts +0 -11
  45. package/dist/command-parser/expand-shortcut.d.ts +0 -15
  46. package/dist/command-parser/expand-wildcard.d.ts +0 -13
  47. package/dist/command-parser/index.d.ts +0 -18
  48. package/dist/command-parser/strip-quotes.d.ts +0 -6
  49. package/dist/concurrent-fallback.d.ts +0 -16
  50. package/dist/concurrent.d.ts +0 -23
  51. package/dist/default-task-runner.d.ts +0 -44
  52. package/dist/detect-shell.d.ts +0 -19
  53. package/dist/file-access-tracker.d.ts +0 -59
  54. package/dist/fingerprint.d.ts +0 -54
  55. package/dist/flow-controllers/index.d.ts +0 -7
  56. package/dist/flow-controllers/input-handler.d.ts +0 -44
  57. package/dist/flow-controllers/log-timings.d.ts +0 -18
  58. package/dist/flow-controllers/restart-process.d.ts +0 -21
  59. package/dist/flow-controllers/teardown.d.ts +0 -22
  60. package/dist/framework-inference.d.ts +0 -35
  61. package/dist/graph-visualizer.d.ts +0 -74
  62. package/dist/incremental-hasher.d.ts +0 -76
  63. package/dist/life-cycle.d.ts +0 -38
  64. package/dist/lockfile-hasher.d.ts +0 -73
  65. package/dist/log-reporter.d.ts +0 -34
  66. package/dist/native-binding.d.ts +0 -106
  67. package/dist/output-resolver.d.ts +0 -20
  68. package/dist/packem_shared/RemoteCache-DSU3lc87.js +0 -219
  69. package/dist/packem_shared/archive-UQHAnZUa.js +0 -102
  70. package/dist/project-constraints.d.ts +0 -9
  71. package/dist/remote-cache.d.ts +0 -100
  72. package/dist/run-summary.d.ts +0 -111
  73. package/dist/task-graph-utils.d.ts +0 -39
  74. package/dist/task-graph.d.ts +0 -22
  75. package/dist/task-hasher.d.ts +0 -104
  76. package/dist/task-orchestrator.d.ts +0 -38
  77. package/dist/task-scheduler.d.ts +0 -41
  78. package/dist/terminal-buffer.d.ts +0 -29
  79. package/dist/tracked-executor.d.ts +0 -46
  80. package/dist/types.d.ts +0 -757
  81. package/dist/utils.d.ts +0 -39
@@ -0,0 +1,114 @@
1
+ import { createRequire as __cjs_createRequire } from "node:module";
2
+
3
+ const __cjs_require = __cjs_createRequire(import.meta.url);
4
+
5
+ const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
+
7
+ const __cjs_getBuiltinModule = (module) => {
8
+ // Check if we're in Node.js and version supports getBuiltinModule
9
+ if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
+ const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
+ // Node.js 20.16.0+ and 22.3.0+
12
+ if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
+ return __cjs_getProcess.getBuiltinModule(module);
14
+ }
15
+ }
16
+ // Fallback to createRequire
17
+ return __cjs_require(module);
18
+ };
19
+
20
+ const {
21
+ execFileSync
22
+ } = __cjs_getBuiltinModule("node:child_process");
23
+ const {
24
+ statSync,
25
+ realpathSync
26
+ } = __cjs_getBuiltinModule("node:fs");
27
+ import { isAbsolute, resolve, dirname } from '@visulima/path';
28
+ import { loadNativeBindings } from './isNativeAvailable-BpD28A6Z.js';
29
+
30
+ let nativeWorktreeBindings;
31
+ let nativeProbed = false;
32
+ const getNativeBindings = () => {
33
+ if (nativeProbed) {
34
+ return nativeWorktreeBindings;
35
+ }
36
+ nativeProbed = true;
37
+ const bindings = loadNativeBindings();
38
+ if (bindings && typeof bindings.getMainWorktreeRoot === "function" && typeof bindings.isLinkedWorktree === "function") {
39
+ nativeWorktreeBindings = {
40
+ getMainWorktreeRoot: bindings.getMainWorktreeRoot,
41
+ isLinkedWorktree: bindings.isLinkedWorktree,
42
+ resetWorktreeCache: typeof bindings.resetWorktreeCache === "function" ? bindings.resetWorktreeCache : () => {
43
+ }
44
+ };
45
+ }
46
+ return nativeWorktreeBindings;
47
+ };
48
+ const fallbackCache = /* @__PURE__ */ new Map();
49
+ const canonicalize = (path) => {
50
+ try {
51
+ return realpathSync(path);
52
+ } catch {
53
+ return path;
54
+ }
55
+ };
56
+ const fallbackIsLinkedWorktree = (workspaceRoot) => {
57
+ try {
58
+ const stat = statSync(resolve(workspaceRoot, ".git"));
59
+ return stat.isFile();
60
+ } catch {
61
+ return false;
62
+ }
63
+ };
64
+ const fallbackGetMainWorktreeRoot = (workspaceRoot) => {
65
+ const canonicalRoot = canonicalize(workspaceRoot);
66
+ if (fallbackCache.has(canonicalRoot)) {
67
+ return fallbackCache.get(canonicalRoot);
68
+ }
69
+ let result;
70
+ try {
71
+ if (fallbackIsLinkedWorktree(canonicalRoot)) {
72
+ const stdout = execFileSync("git", ["rev-parse", "--git-common-dir"], {
73
+ cwd: canonicalRoot,
74
+ encoding: "utf8",
75
+ stdio: ["ignore", "pipe", "ignore"]
76
+ }).trim();
77
+ if (stdout.length > 0) {
78
+ const commonDir = isAbsolute(stdout) ? stdout : resolve(canonicalRoot, stdout);
79
+ const mainRoot = canonicalize(dirname(commonDir));
80
+ result = mainRoot === canonicalRoot ? void 0 : mainRoot;
81
+ }
82
+ } else {
83
+ result = void 0;
84
+ }
85
+ } catch {
86
+ result = void 0;
87
+ }
88
+ fallbackCache.set(canonicalRoot, result);
89
+ return result;
90
+ };
91
+ const getMainWorktreeRoot = (workspaceRoot) => {
92
+ const native = getNativeBindings();
93
+ if (native) {
94
+ const result = native.getMainWorktreeRoot(workspaceRoot);
95
+ return typeof result === "string" && result.length > 0 ? result : void 0;
96
+ }
97
+ return fallbackGetMainWorktreeRoot(workspaceRoot);
98
+ };
99
+ const isLinkedWorktree = (workspaceRoot) => {
100
+ const native = getNativeBindings();
101
+ if (native) {
102
+ return native.isLinkedWorktree(workspaceRoot);
103
+ }
104
+ return fallbackIsLinkedWorktree(workspaceRoot);
105
+ };
106
+ const resetWorktreeCache = () => {
107
+ fallbackCache.clear();
108
+ const native = getNativeBindings();
109
+ if (native) {
110
+ native.resetWorktreeCache();
111
+ }
112
+ };
113
+
114
+ export { getMainWorktreeRoot, isLinkedWorktree, resetWorktreeCache };
@@ -1,10 +1,12 @@
1
- import { expandArguments } from './expandArguments-0AwD2BIA.js';
1
+ import { expandArguments } from './expandArguments-Ba-hHYff.js';
2
2
  import { expandShortcut } from './expandShortcut-BVG05ee4.js';
3
+ import { expandTokens } from './expandTokensInString-Bb7nYehP.js';
4
+ export { expandTokensInString } from './expandTokensInString-Bb7nYehP.js';
3
5
  import { expandWildcard } from './expandWildcard-B0xN_knq.js';
4
6
  import { stripQuotes } from './stripQuotes-Cey-zwFf.js';
5
7
 
6
8
  const parseCommands = (inputs, options = {}) => {
7
- const { additionalArguments = [] } = options;
9
+ const { additionalArguments = [], tokens } = options;
8
10
  let configs = inputs.map((input) => {
9
11
  if (typeof input === "string") {
10
12
  return { command: input };
@@ -17,10 +19,13 @@ const parseCommands = (inputs, options = {}) => {
17
19
  const result = expandWildcard(config);
18
20
  return Array.isArray(result) ? result : [result];
19
21
  });
22
+ if (tokens) {
23
+ configs = configs.map((config) => expandTokens(config, tokens));
24
+ }
20
25
  if (additionalArguments.length > 0) {
21
26
  configs = configs.map((config) => expandArguments(config, additionalArguments));
22
27
  }
23
28
  return configs;
24
29
  };
25
30
 
26
- export { expandArguments, expandShortcut, expandWildcard, parseCommands, stripQuotes };
31
+ export { expandArguments, expandShortcut, expandTokens, expandWildcard, parseCommands, stripQuotes };
@@ -0,0 +1,21 @@
1
+ import { HttpRemoteCache } from './HttpRemoteCache-BTXUBH7t.js';
2
+ import { ReapiRemoteCache } from './ReapiRemoteCache-vgRxDMmu.js';
3
+
4
+ const resolveCacheMode = (options) => options.mode ?? "readwrite";
5
+ const createRemoteCacheBackend = (options) => {
6
+ const mode = resolveCacheMode(options);
7
+ const resolved = { ...options, mode };
8
+ switch (options.backend ?? "http") {
9
+ case "http": {
10
+ return new HttpRemoteCache(resolved);
11
+ }
12
+ case "reapi": {
13
+ return new ReapiRemoteCache(resolved);
14
+ }
15
+ default: {
16
+ return new HttpRemoteCache(resolved);
17
+ }
18
+ }
19
+ };
20
+
21
+ export { createRemoteCacheBackend, resolveCacheMode };
@@ -1,5 +1,5 @@
1
1
  import { runConcurrentFallback } from './runConcurrentFallback-BTmgGV1H.js';
2
- import { detectScriptShell } from './detectScriptShell-CR-xXKA4.js';
2
+ import { detectScriptShell } from './detectScriptShell-CzxCM9-t.js';
3
3
  import { logTimings } from './formatTimingTable-3qtCM552.js';
4
4
  import { withRestart } from './withRestart-BREjRJa4.js';
5
5
  import { runTeardown } from './runTeardown-BAezH79J.js';
@@ -0,0 +1,3 @@
1
+ const shellQuote = (value) => `'${value.replaceAll("'", String.raw`'\''`)}'`;
2
+
3
+ export { shellQuote as s };
@@ -17,6 +17,9 @@ const __cjs_getBuiltinModule = (module) => {
17
17
  return __cjs_require(module);
18
18
  };
19
19
 
20
+ const {
21
+ randomUUID
22
+ } = __cjs_getBuiltinModule("node:crypto");
20
23
  const {
21
24
  stat,
22
25
  realpath,
@@ -385,6 +388,6 @@ const readPackageDeps = async (packageJsonPath, options = READ_PACKAGE_DEPS_DEFA
385
388
  return void 0;
386
389
  }
387
390
  };
388
- const uniqueId = () => `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
391
+ const uniqueId = () => randomUUID();
389
392
 
390
393
  export { createFailureResult as a, hashStrings as b, collectFiles as c, resolveTaskCwd as d, createXxh3Hasher as e, hashFile as h, readPackageDeps as r, sortObjectKeys as s, uniqueId as u, xxh3Hash as x };