@vltpkg/satisfies 1.0.0-rc.29 → 1.0.0-rc.30

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 (2) hide show
  1. package/dist/index.js +16 -0
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -14,6 +14,22 @@ export const satisfiesTuple = (tuple, spec, fromLocation = process.cwd(), projec
14
14
  const { options } = spec;
15
15
  spec = spec.final;
16
16
  const [type, first, second] = tuple;
17
+ // When a registry spec matches a workspace package by name and
18
+ // version, treat it as satisfied. This allows monorepo packages
19
+ // that reference each other with plain semver specs (e.g.
20
+ // "@dev/build-tools": "^1.0.0") to resolve to local workspace
21
+ // packages, matching npm/pnpm/yarn behavior.
22
+ if (spec.type === 'registry' && type === 'workspace') {
23
+ if (!monorepo)
24
+ return false;
25
+ const ws = monorepo.get(first);
26
+ if (ws?.name !== spec.name)
27
+ return false;
28
+ if (!spec.range)
29
+ return true;
30
+ const v = parse(ws.manifest.version ?? '');
31
+ return !!v && spec.range.test(v);
32
+ }
17
33
  if (spec.type !== type)
18
34
  return false;
19
35
  switch (spec.type) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vltpkg/satisfies",
3
3
  "description": "method for determining if a DepID satisfies a Spec",
4
- "version": "1.0.0-rc.29",
4
+ "version": "1.0.0-rc.30",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -13,11 +13,11 @@
13
13
  "url": "http://vlt.sh"
14
14
  },
15
15
  "dependencies": {
16
- "@vltpkg/dep-id": "1.0.0-rc.29",
17
- "@vltpkg/error-cause": "1.0.0-rc.29",
18
- "@vltpkg/semver": "1.0.0-rc.29",
19
- "@vltpkg/spec": "1.0.0-rc.29",
20
- "@vltpkg/workspaces": "1.0.0-rc.29"
16
+ "@vltpkg/dep-id": "1.0.0-rc.30",
17
+ "@vltpkg/error-cause": "1.0.0-rc.30",
18
+ "@vltpkg/semver": "1.0.0-rc.30",
19
+ "@vltpkg/spec": "1.0.0-rc.30",
20
+ "@vltpkg/workspaces": "1.0.0-rc.30"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@eslint/js": "^9.39.1",