@pluginfinity/engine 0.3.8 → 0.3.10

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/discovery.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ConfigAmbiguous, ConfigNotFound } from "./errors.js";
2
- import { Effect, FileSystem, Path } from "effect";
2
+ import { Effect, Option, Path } from "effect";
3
3
  import { GlobPattern } from "@effected/glob";
4
4
  import { Walker, descend } from "@effected/walker";
5
5
 
@@ -20,7 +20,6 @@ const ALL_PRUNE = [
20
20
  "builds",
21
21
  ".git"
22
22
  ];
23
- const exists = (fs, path) => fs.exists(path).pipe(Effect.orElseSucceed(() => false));
24
23
  /**
25
24
  * Finding `pluginfinity.config.*` files. Every member takes its start directory
26
25
  * as an absolute path and never reads the process working directory.
@@ -34,20 +33,16 @@ var ConfigDiscovery = class {
34
33
  * directory that contains `.git`.
35
34
  */
36
35
  static nearest = (start) => Effect.gen(function* () {
37
- const fs = yield* FileSystem.FileSystem;
38
36
  const path = yield* Path.Path;
39
- for (const dir of yield* Walker.ascend(start)) {
40
- const found = [];
41
- for (const name of CONFIG_FILE_NAMES) if (yield* exists(fs, path.join(dir, name))) found.push(name);
42
- if (found.length > 1) return yield* Effect.fail(new ConfigAmbiguous({
43
- path: dir,
44
- files: found
45
- }));
46
- const [only] = found;
47
- if (only !== void 0) return path.join(dir, only);
48
- if (yield* exists(fs, path.join(dir, ".git"))) break;
49
- }
50
- return yield* Effect.fail(new ConfigNotFound({ path: start }));
37
+ const dirs = yield* Walker.ascendToMarker(start, [".git"]);
38
+ const hits = yield* Walker.findUpwardAll(dirs, (dir) => CONFIG_FILE_NAMES.map((name) => path.join(dir, name)));
39
+ if (Option.isNone(hits)) return yield* Effect.fail(new ConfigNotFound({ path: start }));
40
+ const { dir, found } = hits.value;
41
+ if (found.length > 1) return yield* Effect.fail(new ConfigAmbiguous({
42
+ path: dir,
43
+ files: found.map((file) => path.basename(file))
44
+ }));
45
+ return found[0];
51
46
  });
52
47
  /**
53
48
  * Every config at or below `start`, sorted, skipping `node_modules`,
package/doctor.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ConfigLoader } from "./loader.js";
2
2
  import { selectConfigPaths } from "./selection.js";
3
3
  import { ENGINE_VERSION } from "./version.js";
4
- import { Duration, Effect, FileSystem, Option, Path, Result, Schema } from "effect";
4
+ import { Duration, Effect, Option, Path, Result, Schema } from "effect";
5
5
  import { TARGETS } from "@pluginfinity/targets";
6
6
  import { Walker } from "@effected/walker";
7
7
  import { Tool, ToolDiscovery } from "@effected/commands";
@@ -155,14 +155,11 @@ const toolCheck = (fields, name, timeout) => Effect.gen(function* () {
155
155
  });
156
156
  });
157
157
  const detectPackageManager = (start) => Effect.gen(function* () {
158
- const fs = yield* FileSystem.FileSystem;
159
158
  const path = yield* Path.Path;
160
- const has = (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false));
161
- for (const dir of yield* Walker.ascend(start)) {
162
- for (const [file, manager] of LOCKFILES) if (yield* has(path.join(dir, file))) return manager;
163
- if (yield* has(path.join(dir, ".git"))) break;
164
- }
165
- return "npm";
159
+ const dirs = yield* Walker.ascendToMarker(start, [".git"]);
160
+ const lockfile = yield* Walker.findUpward(dirs, (dir) => LOCKFILES.map(([file]) => path.join(dir, file)));
161
+ const manager = Option.flatMapNullishOr(lockfile, (found) => LOCKFILES.find(([file]) => file === path.basename(found))?.[1]);
162
+ return Option.getOrElse(manager, () => "npm");
166
163
  });
167
164
  const configFailure = (error) => check({
168
165
  id: "config",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluginfinity/engine",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "private": false,
5
5
  "description": "The pluginfinity build pipeline shared by every pluginfinity front end: config discovery, read, transform per target, emit and check.",
6
6
  "keywords": [
@@ -34,19 +34,19 @@
34
34
  "./package.json": "./package.json"
35
35
  },
36
36
  "dependencies": {
37
- "@effected/commands": "^0.17.0",
38
- "@effected/engine": "^0.9.0",
39
- "@effected/glob": "^0.15.0",
40
- "@effected/semver": "^0.18.0",
41
- "@effected/walker": "^0.21.0",
42
- "@effected/yaml": "^0.25.1",
43
- "@pluginfinity/core": "0.3.0",
44
- "@pluginfinity/targets": "0.3.0",
37
+ "@effected/commands": "^0.19.0",
38
+ "@effected/engine": "^0.11.0",
39
+ "@effected/glob": "^0.17.0",
40
+ "@effected/semver": "^0.20.0",
41
+ "@effected/walker": "^0.24.0",
42
+ "@effected/yaml": "^0.27.0",
43
+ "@pluginfinity/core": "0.3.1",
44
+ "@pluginfinity/targets": "0.3.1",
45
45
  "jiti": "^2.6.1"
46
46
  },
47
47
  "peerDependencies": {
48
- "@effect/platform-node": "^4.0.0",
49
- "effect": "^4.0.0"
48
+ "@effect/platform-node": "~4.1.1",
49
+ "effect": "~4.1.1"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=24.11.0"
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.59.4"
8
+ "packageVersion": "7.60.0"
9
9
  }
10
10
  ]
11
11
  }
package/version.js CHANGED
@@ -12,6 +12,6 @@
12
12
  *
13
13
  * @public
14
14
  */
15
- const ENGINE_VERSION = "0.3.8";
15
+ const ENGINE_VERSION = "0.3.10";
16
16
 
17
17
  export { ENGINE_VERSION };