@teambit/dependency-resolver 1.0.1086 → 1.0.1088
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/.npmignore +18 -0
- package/dist/dependency-resolver.main.runtime.js +17 -11
- package/dist/dependency-resolver.main.runtime.js.map +1 -1
- package/dist/dependency-resolver.main.runtime.spec.js +37 -3
- package/dist/dependency-resolver.main.runtime.spec.js.map +1 -1
- package/dist/package-manager.d.ts +1 -1
- package/dist/package-manager.js +0 -17
- package/dist/package-manager.js.map +1 -1
- package/dist/{preview-1785446962235.js → preview-1785520628900.js} +2 -2
- package/package.json +20 -21
package/.npmignore
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
dist/tsconfig.tsbuildinfo
|
|
2
|
+
dist/tsconfig.json
|
|
3
|
+
/tsconfig.json
|
|
4
|
+
|
|
5
|
+
package-tar/
|
|
6
|
+
.bit-capsule-ready
|
|
7
|
+
/*.ts
|
|
8
|
+
artifacts/*
|
|
9
|
+
!artifacts/env-template
|
|
10
|
+
!artifacts/ui-bundle
|
|
11
|
+
!artifacts/preview-bundle
|
|
12
|
+
package-tar/
|
|
13
|
+
.bit-capsule-ready
|
|
14
|
+
/*.ts
|
|
15
|
+
artifacts/*
|
|
16
|
+
!artifacts/env-template
|
|
17
|
+
!artifacts/ui-bundle
|
|
18
|
+
!artifacts/preview-bundle
|
|
@@ -198,13 +198,6 @@ function _network() {
|
|
|
198
198
|
};
|
|
199
199
|
return data;
|
|
200
200
|
}
|
|
201
|
-
function _npmResolver() {
|
|
202
|
-
const data = require("@pnpm/npm-resolver");
|
|
203
|
-
_npmResolver = function () {
|
|
204
|
-
return data;
|
|
205
|
-
};
|
|
206
|
-
return data;
|
|
207
|
-
}
|
|
208
201
|
function _semver() {
|
|
209
202
|
const data = _interopRequireWildcard(require("semver"));
|
|
210
203
|
_semver = function () {
|
|
@@ -1417,7 +1410,7 @@ class DependencyResolverMain {
|
|
|
1417
1410
|
errorMsg = `${errorPrefix} the policy version "${policyVersion}" of ${policy.dependencyId} is not valid for components, only for packages.
|
|
1418
1411
|
as an alternative, you can use "+" to keep the same version installed in the workspace`;
|
|
1419
1412
|
}
|
|
1420
|
-
const isVersionValid = Boolean(this.isValidVersionSpecifier(policyVersion) || allowedSpecialChars.includes(policyVersion));
|
|
1413
|
+
const isVersionValid = Boolean(this.isValidVersionSpecifier(policyVersion) || allowedSpecialChars.includes(policyVersion) || allowedPrefixes.some(prefix => policyVersion.startsWith(prefix)));
|
|
1421
1414
|
if (isVersionValid) return;
|
|
1422
1415
|
errorMsg = `${errorPrefix} the policy version "${policyVersion}" of ${policy.dependencyId} is not a valid semver version or range`;
|
|
1423
1416
|
});
|
|
@@ -1439,9 +1432,22 @@ as an alternative, you can use "+" to keep the same version installed in the wor
|
|
|
1439
1432
|
* E.g.: https://registry.npmjs.org/is-odd/-/is-odd-0.1.0.tgz)
|
|
1440
1433
|
*/
|
|
1441
1434
|
isValidVersionSpecifier(spec) {
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1435
|
+
const trimmedSpec = spec.trim();
|
|
1436
|
+
if (!trimmedSpec) return false;
|
|
1437
|
+
if (_semver().default.valid(trimmedSpec) || _semver().default.validRange(trimmedSpec)) return true;
|
|
1438
|
+
if (/^(?:workspace|file|link|git|git\+(?:https?|ssh)|ssh):/.test(trimmedSpec)) return true;
|
|
1439
|
+
if (/^https?:\/\/registry\.npmjs\.org\/.+\/-.+\.tgz(?:[#?].*)?$/.test(trimmedSpec)) return true;
|
|
1440
|
+
if (trimmedSpec.startsWith('npm:')) {
|
|
1441
|
+
const alias = trimmedSpec.slice('npm:'.length);
|
|
1442
|
+
// The version separator is the first `@` past a scope prefix — a
|
|
1443
|
+
// scoped alias's leading `@` is part of the package name, and the
|
|
1444
|
+
// version is optional (`npm:pkg` aliases the latest version).
|
|
1445
|
+
const versionStart = alias.indexOf('@', alias.startsWith('@') ? 1 : 0);
|
|
1446
|
+
const aliasName = versionStart === -1 ? alias : alias.slice(0, versionStart);
|
|
1447
|
+
if (!/^(?:@[^/@\s]+\/)?[^/@\s]+$/.test(aliasName)) return false;
|
|
1448
|
+
return versionStart === -1 || this.isValidVersionSpecifier(alias.slice(versionStart + 1));
|
|
1449
|
+
}
|
|
1450
|
+
return /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(trimmedSpec);
|
|
1445
1451
|
}
|
|
1446
1452
|
|
|
1447
1453
|
/**
|