importmap-node 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/lib/importmap/node/installer.rb +20 -3
- data/lib/importmap/node/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e925ec7f4c661a624c66ce1116e572cd72ac61edab43aaf81bd8b13e73eb20c
|
|
4
|
+
data.tar.gz: 5b87af166955a82bb11fac6300ed087539a90a5dcb9c9d6dc64cf1c000f9cb7d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 513deae74ee355a739069b4632d216da7225153a98fa7ef8d15651ca71f7357476d6a3238f01d7b848d2da0b6fa0c63cec03e30dd1acc2db2dd39369e6adf33b
|
|
7
|
+
data.tar.gz: d2838be955254448255bd04fb1c107f7236d0b5697ce72b05e332f9570c60561400d8fd5cd05e69bfec7f52885a4b5b7d0207be75d4a72782265503df290416b
|
|
@@ -93,8 +93,18 @@ module Importmap
|
|
|
93
93
|
def repo_url?(package)
|
|
94
94
|
return false if package.start_with?('file:')
|
|
95
95
|
|
|
96
|
-
package
|
|
97
|
-
|
|
96
|
+
spec = spec_part(package)
|
|
97
|
+
spec.match?(%r{\Ahttps?://|\Agit[+:]|\Agithub:|\Abitbucket:|\Agitlab:}) ||
|
|
98
|
+
(!spec.start_with?('@') && spec.include?('/'))
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Returns the URL/spec portion of a Yarn 4 "name@url" argument.
|
|
102
|
+
# Scoped packages starting with "@" are returned unchanged.
|
|
103
|
+
def spec_part(package)
|
|
104
|
+
return package if package.start_with?('@')
|
|
105
|
+
|
|
106
|
+
idx = package.index('@')
|
|
107
|
+
idx ? package[(idx + 1)..] : package
|
|
98
108
|
end
|
|
99
109
|
|
|
100
110
|
def current_dependencies
|
|
@@ -114,7 +124,14 @@ module Importmap
|
|
|
114
124
|
|
|
115
125
|
def resolve_package_name(package)
|
|
116
126
|
return local_package_name(package) if package.start_with?('file:')
|
|
117
|
-
|
|
127
|
+
|
|
128
|
+
if repo_url?(package)
|
|
129
|
+
unless package.start_with?('@')
|
|
130
|
+
idx = package.index('@')
|
|
131
|
+
return package[0, idx] if idx
|
|
132
|
+
end
|
|
133
|
+
return repo_package_name(package)
|
|
134
|
+
end
|
|
118
135
|
|
|
119
136
|
package
|
|
120
137
|
end
|