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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a600199932a9709489532ba6697f1d923fc81291f12b3af30ea53766804b4bb0
4
- data.tar.gz: 5aeeeb117182c6e7316974ddf486416cb334bc007062ebfd1dda76b84601457f
3
+ metadata.gz: 3e925ec7f4c661a624c66ce1116e572cd72ac61edab43aaf81bd8b13e73eb20c
4
+ data.tar.gz: 5b87af166955a82bb11fac6300ed087539a90a5dcb9c9d6dc64cf1c000f9cb7d
5
5
  SHA512:
6
- metadata.gz: b785eea53cd09a655ea133038592dff31f1406252896cdd76c0d6b1bb4f7f69df3f74f48d2ccc3d2c58086746a4c0fb7390af2a40b7e9755a680f0e07558f7e2
7
- data.tar.gz: 784c868a3e81b623f1b3d1845774d5783878e0d375bbd60d053013319ac4d4433a89c8b0b1b3e19755f98abc737aea20e503108175ee0a85eefca865d245696b
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.match?(%r{\Ahttps?://|\Agit[+:]|\Agithub:|\Abitbucket:|\Agitlab:}) ||
97
- (!package.start_with?('@') && package.include?('/'))
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
- return repo_package_name(package) if repo_url?(package)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Importmap
4
4
  module Node
5
- VERSION = '0.1.2'
5
+ VERSION = '0.1.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: importmap-node
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tien