dependabot-npm_and_yarn 0.216.0 → 0.216.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8f2067adcff622e13e15f0f69b0af6a37040740153e7259d7a8b10716b21b25
4
- data.tar.gz: a6d6ec0f7f3575d681d1e55dffe7d02e573d6733e0a4d1ef2ae85c90064dcd04
3
+ metadata.gz: 2df51373de95ce542233cbb690f059ee015534e3e57d69470031491f9dd89794
4
+ data.tar.gz: c8e33eea70d6765a96e87248ebc4b5f8cedb49ea03e9c1abf79bdaddfc6cda00
5
5
  SHA512:
6
- metadata.gz: ab002df13a3712244ce2cba0498d92750a84f89316dcd6809d28a793eda2525c073252797104ac7bdf1b4f13e597ca5e75db14a488cc622fd71e3e2892269ef9
7
- data.tar.gz: e2c83d55d329b47796f02a0c4894f64df7d56c1b1ef0a2e8cdb051419a108031a7f86d0d5c77caaf67d8bbd3c22e3b270bcfde232ed1ad3b40cba36876d679fa
6
+ metadata.gz: 27c3502dd326b7b82738fa402d2e46c6054750af2e029b08f5c97b8f51e946c7090754e0679050116bbb6f572635aea77b77f4951ff19d703ff090e5308a5033
7
+ data.tar.gz: bdbfbb9f4896a58635cc9eef900f00a6e2ef02c438bb8a072fa83c199d532c9c92742ed805e8e39ddb3a5b746f50a457a7a29c4963870eddb61d0c4b7cc15957
@@ -7,11 +7,11 @@
7
7
  "name": "@dependabot/helper",
8
8
  "dependencies": {
9
9
  "@dependabot/yarn-lib": "^1.22.19",
10
- "@npmcli/arborist": "^6.2.5",
10
+ "@npmcli/arborist": "^6.2.7",
11
11
  "detect-indent": "^6.1.0",
12
12
  "nock": "^13.3.0",
13
13
  "npm": "6.14.18",
14
- "semver": "^7.3.8"
14
+ "semver": "^7.4.0"
15
15
  },
16
16
  "bin": {
17
17
  "helper": "run.js"
@@ -1780,9 +1780,9 @@
1780
1780
  }
1781
1781
  },
1782
1782
  "node_modules/@npmcli/arborist": {
1783
- "version": "6.2.5",
1784
- "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-6.2.5.tgz",
1785
- "integrity": "sha512-+GPm+9WrDnl9q+LvuMB2W+roVinHTGDdYWOtYzRfpAnuiqaATFbH14skpXjlJ7LvyUcyd1oJhuGq6XXJLGFNng==",
1783
+ "version": "6.2.7",
1784
+ "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-6.2.7.tgz",
1785
+ "integrity": "sha512-7Gp1lZEweW1GzoMOo0Z10zAm4SKZsVYUWtFSCrahXmV5H3Mp4Pgwg1nIgkXj4LkjqT+fLsXmjK6rQBauDH64Jg==",
1786
1786
  "dependencies": {
1787
1787
  "@isaacs/string-locale-compare": "^1.1.0",
1788
1788
  "@npmcli/fs": "^3.1.0",
@@ -1800,7 +1800,7 @@
1800
1800
  "hosted-git-info": "^6.1.1",
1801
1801
  "json-parse-even-better-errors": "^3.0.0",
1802
1802
  "json-stringify-nice": "^1.1.4",
1803
- "minimatch": "^6.1.6",
1803
+ "minimatch": "^7.4.2",
1804
1804
  "nopt": "^7.0.0",
1805
1805
  "npm-install-checks": "^6.0.0",
1806
1806
  "npm-package-arg": "^10.1.0",
@@ -1811,7 +1811,7 @@
1811
1811
  "parse-conflict-json": "^3.0.0",
1812
1812
  "proc-log": "^3.0.0",
1813
1813
  "promise-all-reject-late": "^1.0.0",
1814
- "promise-call-limit": "^1.0.1",
1814
+ "promise-call-limit": "^1.0.2",
1815
1815
  "read-package-json-fast": "^3.0.2",
1816
1816
  "semver": "^7.3.7",
1817
1817
  "ssri": "^10.0.1",
@@ -1850,9 +1850,9 @@
1850
1850
  }
1851
1851
  },
1852
1852
  "node_modules/@npmcli/arborist/node_modules/minimatch": {
1853
- "version": "6.2.0",
1854
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-6.2.0.tgz",
1855
- "integrity": "sha512-sauLxniAmvnhhRjFwPNnJKaPFYyddAgbYdeUpHULtCT/GhzdCx/MDNy+Y40lBxTQUrMzDE8e0S43Z5uqfO0REg==",
1853
+ "version": "7.4.6",
1854
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.6.tgz",
1855
+ "integrity": "sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==",
1856
1856
  "dependencies": {
1857
1857
  "brace-expansion": "^2.0.1"
1858
1858
  },
@@ -13297,9 +13297,9 @@
13297
13297
  }
13298
13298
  },
13299
13299
  "node_modules/promise-call-limit": {
13300
- "version": "1.0.1",
13301
- "resolved": "https://registry.npmjs.org/promise-call-limit/-/promise-call-limit-1.0.1.tgz",
13302
- "integrity": "sha512-3+hgaa19jzCGLuSCbieeRsu5C2joKfYn8pY6JAuXFRVfF4IO+L7UPpFWNTeWT9pM7uhskvbPPd/oEOktCn317Q==",
13300
+ "version": "1.0.2",
13301
+ "resolved": "https://registry.npmjs.org/promise-call-limit/-/promise-call-limit-1.0.2.tgz",
13302
+ "integrity": "sha512-1vTUnfI2hzui8AEIixbdAJlFY4LFDXqQswy/2eOlThAscXCY4It8FdVuI0fMJGAB2aWGbdQf/gv0skKYXmdrHA==",
13303
13303
  "funding": {
13304
13304
  "url": "https://github.com/sponsors/isaacs"
13305
13305
  }
@@ -13882,9 +13882,9 @@
13882
13882
  "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
13883
13883
  },
13884
13884
  "node_modules/semver": {
13885
- "version": "7.3.8",
13886
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
13887
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
13885
+ "version": "7.4.0",
13886
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
13887
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
13888
13888
  "dependencies": {
13889
13889
  "lru-cache": "^6.0.0"
13890
13890
  },
@@ -16370,9 +16370,9 @@
16370
16370
  }
16371
16371
  },
16372
16372
  "@npmcli/arborist": {
16373
- "version": "6.2.5",
16374
- "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-6.2.5.tgz",
16375
- "integrity": "sha512-+GPm+9WrDnl9q+LvuMB2W+roVinHTGDdYWOtYzRfpAnuiqaATFbH14skpXjlJ7LvyUcyd1oJhuGq6XXJLGFNng==",
16373
+ "version": "6.2.7",
16374
+ "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-6.2.7.tgz",
16375
+ "integrity": "sha512-7Gp1lZEweW1GzoMOo0Z10zAm4SKZsVYUWtFSCrahXmV5H3Mp4Pgwg1nIgkXj4LkjqT+fLsXmjK6rQBauDH64Jg==",
16376
16376
  "requires": {
16377
16377
  "@isaacs/string-locale-compare": "^1.1.0",
16378
16378
  "@npmcli/fs": "^3.1.0",
@@ -16390,7 +16390,7 @@
16390
16390
  "hosted-git-info": "^6.1.1",
16391
16391
  "json-parse-even-better-errors": "^3.0.0",
16392
16392
  "json-stringify-nice": "^1.1.4",
16393
- "minimatch": "^6.1.6",
16393
+ "minimatch": "^7.4.2",
16394
16394
  "nopt": "^7.0.0",
16395
16395
  "npm-install-checks": "^6.0.0",
16396
16396
  "npm-package-arg": "^10.1.0",
@@ -16401,7 +16401,7 @@
16401
16401
  "parse-conflict-json": "^3.0.0",
16402
16402
  "proc-log": "^3.0.0",
16403
16403
  "promise-all-reject-late": "^1.0.0",
16404
- "promise-call-limit": "^1.0.1",
16404
+ "promise-call-limit": "^1.0.2",
16405
16405
  "read-package-json-fast": "^3.0.2",
16406
16406
  "semver": "^7.3.7",
16407
16407
  "ssri": "^10.0.1",
@@ -16428,9 +16428,9 @@
16428
16428
  "integrity": "sha512-iZbGHafX/59r39gPwVPRBGw0QQKnA7tte5pSMrhWOW7swGsVvVTjmfyAV9pNqk8YGT7tRCdxRu8uzcgZwoDooA=="
16429
16429
  },
16430
16430
  "minimatch": {
16431
- "version": "6.2.0",
16432
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-6.2.0.tgz",
16433
- "integrity": "sha512-sauLxniAmvnhhRjFwPNnJKaPFYyddAgbYdeUpHULtCT/GhzdCx/MDNy+Y40lBxTQUrMzDE8e0S43Z5uqfO0REg==",
16431
+ "version": "7.4.6",
16432
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.6.tgz",
16433
+ "integrity": "sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==",
16434
16434
  "requires": {
16435
16435
  "brace-expansion": "^2.0.1"
16436
16436
  }
@@ -25022,9 +25022,9 @@
25022
25022
  "integrity": "sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw=="
25023
25023
  },
25024
25024
  "promise-call-limit": {
25025
- "version": "1.0.1",
25026
- "resolved": "https://registry.npmjs.org/promise-call-limit/-/promise-call-limit-1.0.1.tgz",
25027
- "integrity": "sha512-3+hgaa19jzCGLuSCbieeRsu5C2joKfYn8pY6JAuXFRVfF4IO+L7UPpFWNTeWT9pM7uhskvbPPd/oEOktCn317Q=="
25025
+ "version": "1.0.2",
25026
+ "resolved": "https://registry.npmjs.org/promise-call-limit/-/promise-call-limit-1.0.2.tgz",
25027
+ "integrity": "sha512-1vTUnfI2hzui8AEIixbdAJlFY4LFDXqQswy/2eOlThAscXCY4It8FdVuI0fMJGAB2aWGbdQf/gv0skKYXmdrHA=="
25028
25028
  },
25029
25029
  "promise-inflight": {
25030
25030
  "version": "1.0.1",
@@ -25457,9 +25457,9 @@
25457
25457
  "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
25458
25458
  },
25459
25459
  "semver": {
25460
- "version": "7.3.8",
25461
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
25462
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
25460
+ "version": "7.4.0",
25461
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
25462
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
25463
25463
  "requires": {
25464
25464
  "lru-cache": "^6.0.0"
25465
25465
  },
data/helpers/package.json CHANGED
@@ -10,11 +10,11 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@dependabot/yarn-lib": "^1.22.19",
13
- "@npmcli/arborist": "^6.2.5",
13
+ "@npmcli/arborist": "^6.2.7",
14
14
  "detect-indent": "^6.1.0",
15
15
  "nock": "^13.3.0",
16
16
  "npm": "6.14.18",
17
- "semver": "^7.3.8"
17
+ "semver": "^7.4.0"
18
18
  },
19
19
  "devDependencies": {
20
20
  "eslint": "^8.38.0",
@@ -10,7 +10,7 @@ require "dependabot/npm_and_yarn/file_parser/lockfile_parser"
10
10
 
11
11
  module Dependabot
12
12
  module NpmAndYarn
13
- class FileFetcher < Dependabot::FileFetchers::Base
13
+ class FileFetcher < Dependabot::FileFetchers::Base # rubocop:disable Metrics/ClassLength
14
14
  require_relative "file_fetcher/path_dependency_builder"
15
15
 
16
16
  # Npm always prefixes file paths in the lockfile "version" with "file:"
@@ -22,6 +22,7 @@ module Dependabot
22
22
  # "yarn link", e.g. "link:react"
23
23
  PATH_DEPENDENCY_STARTS = %w(file: link:. link:/ link:~/ / ./ ../ ~/).freeze
24
24
  PATH_DEPENDENCY_CLEAN_REGEX = /^file:|^link:/
25
+ DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org"
25
26
 
26
27
  def self.required_files_in?(filenames)
27
28
  filenames.include?("package.json")
@@ -55,6 +56,7 @@ module Dependabot
55
56
  package_managers["npm"] = Helpers.npm_version_numeric(package_lock.content) if package_lock
56
57
  package_managers["yarn"] = yarn_version if yarn_version
57
58
  package_managers["shrinkwrap"] = 1 if shrinkwrap
59
+ package_managers["unknown"] = 1 if package_managers.empty?
58
60
 
59
61
  {
60
62
  ecosystem: "npm",
@@ -85,25 +87,41 @@ module Dependabot
85
87
 
86
88
  # If every entry in the lockfile uses the same registry, we can infer
87
89
  # that there is a global .npmrc file, so add it here as if it were in the repo.
88
- def inferred_npmrc
90
+
91
+ def inferred_npmrc # rubocop:disable Metrics/PerceivedComplexity
89
92
  return @inferred_npmrc if defined?(@inferred_npmrc)
90
93
  return @inferred_npmrc = nil unless npmrc.nil? && package_lock
91
94
 
92
95
  known_registries = []
93
- JSON.parse(package_lock.content).fetch("dependencies", {}).each do |_name, details|
94
- resolved = details.fetch("resolved", "https://registry.npmjs.org")
96
+ JSON.parse(package_lock.content).fetch("dependencies", {}).each do |dependency_name, details|
97
+ resolved = details.fetch("resolved", DEFAULT_NPM_REGISTRY)
98
+
95
99
  begin
96
100
  uri = URI.parse(resolved)
97
101
  rescue URI::InvalidURIError
98
102
  # Ignoring non-URIs since they're not registries.
99
- # This can happen if resolved is false, for instance.
103
+ # This can happen if resolved is `false`, for instance
104
+ # npm6 bug https://github.com/npm/cli/issues/1138
100
105
  next
101
106
  end
102
- # Check for scheme since path dependencies will not have one
103
- known_registries << "#{uri.scheme}://#{uri.host}" if uri.scheme && uri.host
107
+
108
+ next unless uri.scheme && uri.host
109
+
110
+ known_registry = "#{uri.scheme}://#{uri.host}"
111
+ path = uri.path
112
+
113
+ next unless path
114
+
115
+ index = path.index(dependency_name)
116
+ if index
117
+ registry_base_path = path[0...index].delete_suffix("/")
118
+ known_registry << registry_base_path
119
+ end
120
+
121
+ known_registries << known_registry
104
122
  end
105
123
 
106
- if known_registries.uniq.length == 1 && known_registries.first != "https://registry.npmjs.org"
124
+ if known_registries.uniq.length == 1 && known_registries.first != DEFAULT_NPM_REGISTRY
107
125
  Dependabot.logger.info("Inferred global NPM registry is: #{known_registries.first}")
108
126
  return @inferred_npmrc = Dependabot::DependencyFile.new(
109
127
  name: ".npmrc",
@@ -121,7 +139,7 @@ module Dependabot
121
139
  if (package_manager = package.fetch("packageManager", nil))
122
140
  get_yarn_version_from_package_json(package_manager)
123
141
  elsif yarn_lock
124
- 1
142
+ Helpers.yarn_version_numeric(yarn_lock)
125
143
  end
126
144
  end
127
145
 
@@ -40,9 +40,7 @@ module Dependabot
40
40
  dependency_set = Dependabot::NpmAndYarn::FileParser::DependencySet.new
41
41
 
42
42
  dependencies = object_with_dependencies["dependencies"]
43
- dependencies ||= object_with_dependencies.fetch("packages", {}).transform_keys do |name|
44
- name.delete_prefix("node_modules/")
45
- end
43
+ dependencies ||= object_with_dependencies.fetch("packages", {})
46
44
 
47
45
  dependencies.each do |name, details|
48
46
  next if name.empty? # v3 lockfiles include an empty key holding info of the current package
@@ -51,7 +49,7 @@ module Dependabot
51
49
  next unless version
52
50
 
53
51
  dependency_args = {
54
- name: name,
52
+ name: name.split("node_modules/").last,
55
53
  version: version,
56
54
  package_manager: "npm_and_yarn",
57
55
  requirements: []
@@ -16,6 +16,14 @@ module Dependabot
16
16
  6
17
17
  end
18
18
 
19
+ def self.yarn_version_numeric(yarn_lock)
20
+ if yarn_berry?(yarn_lock)
21
+ 3
22
+ else
23
+ 1
24
+ end
25
+ end
26
+
19
27
  def self.fetch_yarnrc_yml_value(key, default_value)
20
28
  if File.exist?(".yarnrc.yml") && (yarnrc = YAML.load_file(".yarnrc.yml"))
21
29
  yarnrc.fetch(key, default_value)
@@ -375,11 +375,11 @@ module Dependabot
375
375
  end
376
376
 
377
377
  def version_class
378
- NpmAndYarn::Version
378
+ dependency.version_class
379
379
  end
380
380
 
381
381
  def requirement_class
382
- NpmAndYarn::Requirement
382
+ dependency.requirement_class
383
383
  end
384
384
 
385
385
  def npmrc_file
@@ -145,7 +145,7 @@ module Dependabot
145
145
  end
146
146
 
147
147
  def version_class
148
- NpmAndYarn::Version
148
+ dependency.version_class
149
149
  end
150
150
 
151
151
  def updated_dependency
@@ -642,11 +642,11 @@ module Dependabot
642
642
  end
643
643
 
644
644
  def version_class
645
- NpmAndYarn::Version
645
+ dependency.version_class
646
646
  end
647
647
 
648
648
  def requirement_class
649
- NpmAndYarn::Requirement
649
+ dependency.requirement_class
650
650
  end
651
651
 
652
652
  def version_regex
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-npm_and_yarn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.216.0
4
+ version: 0.216.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-12 00:00:00.000000000 Z
11
+ date: 2023-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.216.0
19
+ version: 0.216.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.216.0
26
+ version: 0.216.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.48.0
117
+ version: 1.50.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.48.0
124
+ version: 1.50.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rubocop-performance
127
127
  requirement: !ruby/object:Gem::Requirement