@askrjs/cli 0.0.7 → 0.0.9

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.
@@ -1,49 +0,0 @@
1
- import semver from "semver";
2
- //#region src/update/specification.ts
3
- const WINDOWS_PATH = /^[A-Za-z]:[\\/]/;
4
- const HOSTED_GIT = /^(?:bitbucket|gist|github|gitlab):/i;
5
- const GIT_URL = /^(?:git(?:\+[^:]+)?:|git@|ssh:)/i;
6
- const GIT_SHORTHAND = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:#.*)?$/;
7
- const REGISTRY_TAG = /^[A-Za-z][A-Za-z0-9._-]*$/;
8
- const SCOPED_PATH = /^@[^/]+\/[^/]+$/;
9
- function parseDependencySpecification(specification) {
10
- const rawSpec = specification.trim();
11
- if (!rawSpec) return {
12
- type: "unsupported",
13
- rawSpec
14
- };
15
- if (/^npm:/i.test(rawSpec)) return {
16
- type: "alias",
17
- rawSpec
18
- };
19
- if (/^(?:file|link|workspace):/i.test(rawSpec) || rawSpec.startsWith("./") || rawSpec.startsWith("../") || rawSpec.startsWith("/") || rawSpec.startsWith("~/") || /\.(?:tar\.gz|tgz)$/i.test(rawSpec) || WINDOWS_PATH.test(rawSpec) || /^[A-Za-z]:/.test(rawSpec) || SCOPED_PATH.test(rawSpec)) return {
20
- type: "file",
21
- rawSpec
22
- };
23
- if (HOSTED_GIT.test(rawSpec) || GIT_URL.test(rawSpec) || GIT_SHORTHAND.test(rawSpec)) return {
24
- type: "git",
25
- rawSpec
26
- };
27
- if (/^https?:/i.test(rawSpec) || /^[a-z][a-z0-9+.-]*:\/\//i.test(rawSpec)) return {
28
- type: "remote",
29
- rawSpec
30
- };
31
- if (semver.valid(rawSpec)) return {
32
- type: "version",
33
- rawSpec
34
- };
35
- if (semver.validRange(rawSpec)) return {
36
- type: "range",
37
- rawSpec
38
- };
39
- if (REGISTRY_TAG.test(rawSpec)) return {
40
- type: "tag",
41
- rawSpec
42
- };
43
- return {
44
- type: "unsupported",
45
- rawSpec
46
- };
47
- }
48
- //#endregion
49
- export { parseDependencySpecification as t };