rman 1.2.2 → 1.2.4

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/constants.js CHANGED
@@ -1 +1 @@
1
- export const version = '1.2.2';
1
+ export const version = '1.2.4';
@@ -10,3 +10,31 @@
10
10
  * `label` names the config key in the error, so a failure says which setting to go and look at.
11
11
  */
12
12
  export declare function resolveConfigTarget(target: string, from: string, label: string): string;
13
+ /**
14
+ * The fallback: a plugin or shared config installed **beside rman itself**, tried when the
15
+ * repository cannot resolve it.
16
+ *
17
+ * A globally installed rman's siblings *are* the globally installed packages, so this is what makes
18
+ * `rman ci` work on a fresh clone - the command comes from `rman-node`, and `ci` exists to create
19
+ * the very `node_modules` the plugin would otherwise have to be found in. Measured: with both
20
+ * installed globally, a clone answered `"plugins" target "rman-node" could not be resolved ... is
21
+ * it installed in this repository?`, which was true and useless.
22
+ *
23
+ * **The repository is always tried first**, so a repository carrying its own copy is unaffected and
24
+ * its version always wins. This is a fallback, never a search order: `createRequire` is based on the
25
+ * config file precisely so a repository's config resolves against the repository.
26
+ *
27
+ * It is deliberately *not* gated on whether the repository looks installed. That was tried - fall
28
+ * back only when there is no `node_modules` anywhere above the config file - on the reasoning that
29
+ * an installed repository merely *missing* a dependency should keep the honest error. It reads well
30
+ * and behaves unpredictably: the walk reaches the filesystem root, so a checkout under any directory
31
+ * that happens to have a `node_modules` (a home directory, a nested clone) silently lost the
32
+ * fallback. A rule whose answer depends on where the repository was cloned is worse than the
33
+ * looser one.
34
+ *
35
+ * `from` exists for the specs, and is the whole test seam: the answer depends on where **this
36
+ * module** sits, so a spec running inside this repository could otherwise only ever prove that this
37
+ * repository can see its own `node_modules`. Given a throwaway layout's URL it exercises the real
38
+ * resolution - no subprocess, and nothing to keep in step with the source.
39
+ */
40
+ export declare function resolveBesideRman(target: string, from?: string): string | undefined;
@@ -28,6 +28,44 @@ export function resolveConfigTarget(target, from, label) {
28
28
  return createRequire(pathToFileURL(path.join(dir, 'noop.js'))).resolve(target);
29
29
  }
30
30
  catch {
31
+ const beside = resolveBesideRman(target);
32
+ if (beside)
33
+ return beside;
31
34
  throw new Error(`"${label}" target "${target}" could not be resolved from "${from}" - is it installed in this repository?`);
32
35
  }
33
36
  }
37
+ /**
38
+ * The fallback: a plugin or shared config installed **beside rman itself**, tried when the
39
+ * repository cannot resolve it.
40
+ *
41
+ * A globally installed rman's siblings *are* the globally installed packages, so this is what makes
42
+ * `rman ci` work on a fresh clone - the command comes from `rman-node`, and `ci` exists to create
43
+ * the very `node_modules` the plugin would otherwise have to be found in. Measured: with both
44
+ * installed globally, a clone answered `"plugins" target "rman-node" could not be resolved ... is
45
+ * it installed in this repository?`, which was true and useless.
46
+ *
47
+ * **The repository is always tried first**, so a repository carrying its own copy is unaffected and
48
+ * its version always wins. This is a fallback, never a search order: `createRequire` is based on the
49
+ * config file precisely so a repository's config resolves against the repository.
50
+ *
51
+ * It is deliberately *not* gated on whether the repository looks installed. That was tried - fall
52
+ * back only when there is no `node_modules` anywhere above the config file - on the reasoning that
53
+ * an installed repository merely *missing* a dependency should keep the honest error. It reads well
54
+ * and behaves unpredictably: the walk reaches the filesystem root, so a checkout under any directory
55
+ * that happens to have a `node_modules` (a home directory, a nested clone) silently lost the
56
+ * fallback. A rule whose answer depends on where the repository was cloned is worse than the
57
+ * looser one.
58
+ *
59
+ * `from` exists for the specs, and is the whole test seam: the answer depends on where **this
60
+ * module** sits, so a spec running inside this repository could otherwise only ever prove that this
61
+ * repository can see its own `node_modules`. Given a throwaway layout's URL it exercises the real
62
+ * resolution - no subprocess, and nothing to keep in step with the source.
63
+ */
64
+ export function resolveBesideRman(target, from = import.meta.url) {
65
+ try {
66
+ return createRequire(from).resolve(target);
67
+ }
68
+ catch {
69
+ return undefined;
70
+ }
71
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rman",
3
3
  "description": "Repository manager",
4
- "version": "1.2.2",
4
+ "version": "1.2.4",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {