@theholocron/astromech 5.0.0-alpha.170 → 5.0.0-alpha.172

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/index.d.mts CHANGED
@@ -383,6 +383,15 @@ interface WorkspacePackage {
383
383
  dir: string;
384
384
  version: string | undefined;
385
385
  dependencies: Record<string, string>;
386
+ /**
387
+ * A workspace:* devDependency can optionally count too (holocron#1071,
388
+ * workspaceDependencies' includeDevDependencies option). Optional so a
389
+ * caller holding the previous, dev-dependency-less shape (a plain
390
+ * object literal, or a value from outside this package's own version)
391
+ * keeps compiling and working -- a missing value is treated the same
392
+ * as `{}`.
393
+ */
394
+ devDependencies?: Record<string, string>;
386
395
  }
387
396
  interface Tree {
388
397
  readJson: (path: string) => unknown;
package/dist/index.mjs CHANGED
@@ -2017,11 +2017,54 @@ const WAIT_TIMEOUT_MS = 3e5;
2017
2017
  const WAIT_INTERVAL_MS = 1e4;
2018
2018
  //#endregion
2019
2019
  //#region src/tasks/deploy-on-release/workspace-dependencies/workspace-dependencies.ts
2020
- /** The `workspace:*` dependencies of `pkg`, as workspace packages (with their current version). */
2021
- function workspaceDependencies(pkg, all) {
2022
- const names = new Set(Object.entries(pkg.dependencies).filter(([, spec]) => String(spec).startsWith("workspace:")).map(([name]) => name));
2020
+ /**
2021
+ * `pkg`'s direct `workspace:*` dependencies -- `dependencies`, plus
2022
+ * `devDependencies` when asked. `pkg.devDependencies` defaults to `{}`:
2023
+ * it's optional on `WorkspacePackage` precisely so a caller holding the
2024
+ * previous (dev-dependency-less) shape doesn't crash here.
2025
+ */
2026
+ function directWorkspaceDependencies(pkg, all, includeDevDependencies) {
2027
+ const entries = includeDevDependencies ? [...Object.entries(pkg.dependencies), ...Object.entries(pkg.devDependencies ?? {})] : Object.entries(pkg.dependencies);
2028
+ const names = new Set(entries.filter(([, spec]) => String(spec).startsWith("workspace:")).map(([name]) => name));
2023
2029
  return all.filter((candidate) => names.has(candidate.name));
2024
2030
  }
2031
+ /**
2032
+ * Every `workspace:*` dependency of `pkg`, transitively (holocron#1071) —
2033
+ * its own direct dependencies, and theirs, and so on — as workspace
2034
+ * packages (with their current version).
2035
+ *
2036
+ * `includeDevDependencies` defaults to `false`, matching the pre-#1071
2037
+ * behavior: a shared dev/build-time workspace package (a tsconfig, a
2038
+ * lint config, a build script) counts only when a caller opts in.
2039
+ * `defaultPaths` (computing paths that should trigger a rebuild) opts in;
2040
+ * `deployOnRelease`'s publish-wait list (waiting for npm to serve a
2041
+ * package's RUNTIME dependencies before deploying it) does not -- an
2042
+ * unpublished, possibly `private`, dev-only package would never satisfy
2043
+ * that wait and the deploy would time out (holocron#1071 review).
2044
+ *
2045
+ * A diamond (two packages depending on the same third one) contributes
2046
+ * that third package once, not twice — tracked by a visited set, seeded
2047
+ * with `pkg` itself so a dependency cycle (A -> B -> A) can't loop
2048
+ * forever either, even though a real workspace graph normally can't have
2049
+ * one.
2050
+ */
2051
+ function workspaceDependencies(pkg, all, options) {
2052
+ const includeDevDependencies = options?.includeDevDependencies ?? false;
2053
+ const visited = /* @__PURE__ */ new Set([pkg.name]);
2054
+ const result = [];
2055
+ let frontier = directWorkspaceDependencies(pkg, all, includeDevDependencies);
2056
+ while (frontier.length > 0) {
2057
+ const next = [];
2058
+ for (const dep of frontier) {
2059
+ if (visited.has(dep.name)) continue;
2060
+ visited.add(dep.name);
2061
+ result.push(dep);
2062
+ next.push(...directWorkspaceDependencies(dep, all, includeDevDependencies));
2063
+ }
2064
+ frontier = next;
2065
+ }
2066
+ return result;
2067
+ }
2025
2068
  //#endregion
2026
2069
  //#region src/tasks/deploy-on-release/default-paths/default-paths.ts
2027
2070
  /**
@@ -2033,7 +2076,7 @@ function workspaceDependencies(pkg, all) {
2033
2076
  * @returns Repo-relative prefixes, each ending in `/`.
2034
2077
  */
2035
2078
  function defaultPaths(repoRoot, pkg, all) {
2036
- return [pkg, ...workspaceDependencies(pkg, all)].map(({ dir }) => `${relative(repoRoot, dir).replace(/\\/g, "/")}/`);
2079
+ return [pkg, ...workspaceDependencies(pkg, all, { includeDevDependencies: true })].map(({ dir }) => `${relative(repoRoot, dir).replace(/\\/g, "/")}/`);
2037
2080
  }
2038
2081
  //#endregion
2039
2082
  //#region src/tasks/deploy-on-release/deploy-targets/deploy-targets.ts
@@ -2131,7 +2174,8 @@ function workspacePackages(repoRoot, { readJson, listDirs }) {
2131
2174
  name,
2132
2175
  dir,
2133
2176
  version: manifest.version,
2134
- dependencies: manifest.dependencies ?? {}
2177
+ dependencies: manifest.dependencies ?? {},
2178
+ devDependencies: manifest.devDependencies ?? {}
2135
2179
  }] : []);
2136
2180
  }
2137
2181
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/astromech",
3
- "version": "5.0.0-alpha.170",
3
+ "version": "5.0.0-alpha.172",
4
4
  "description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron run ci`, the CI workflows, package.json scripts, linters, and required checks.",
5
5
  "keywords": [
6
6
  "ci",
@@ -48,7 +48,7 @@
48
48
  "@theholocron/fs-utils": "^1.16.0",
49
49
  "@theholocron/json-utils": "^1.16.0",
50
50
  "@theholocron/pkg-utils": "^1.16.0",
51
- "@theholocron/datapad": "5.0.0-alpha.170"
51
+ "@theholocron/datapad": "5.0.0-alpha.172"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@commitlint/config-conventional": "^21.2.3",