dependabot-npm_and_yarn 0.213.0 → 0.215.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/package-lock.json +892 -857
- data/helpers/package.json +4 -4
- data/helpers/test/npm6/fixtures/conflicting-dependency-parser/deeply-nested/package-lock.json +3 -3
- data/lib/dependabot/npm_and_yarn/file_fetcher/path_dependency_builder.rb +11 -2
- data/lib/dependabot/npm_and_yarn/file_fetcher.rb +61 -1
- data/lib/dependabot/npm_and_yarn/file_parser/lockfile_parser.rb +3 -7
- data/lib/dependabot/npm_and_yarn/file_parser.rb +5 -8
- data/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb +14 -2
- data/lib/dependabot/npm_and_yarn/file_updater/npmrc_builder.rb +79 -4
- data/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb +47 -34
- data/lib/dependabot/npm_and_yarn/file_updater.rb +11 -16
- data/lib/dependabot/npm_and_yarn/helpers.rb +69 -16
- data/lib/dependabot/npm_and_yarn/native_helpers.rb +15 -2
- data/lib/dependabot/npm_and_yarn/update_checker/dependency_files_builder.rb +43 -1
- data/lib/dependabot/npm_and_yarn/update_checker/latest_version_finder.rb +7 -13
- data/lib/dependabot/npm_and_yarn/update_checker/registry_finder.rb +10 -4
- data/lib/dependabot/npm_and_yarn/update_checker/subdependency_version_resolver.rb +10 -16
- data/lib/dependabot/npm_and_yarn/update_checker/version_resolver.rb +71 -27
- data/lib/dependabot/npm_and_yarn/update_checker.rb +7 -27
- data/lib/dependabot/npm_and_yarn.rb +2 -0
- metadata +8 -9
- data/lib/dependabot/npm_and_yarn/file_parser/yarn_lockfile_parser.rb +0 -59
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.
|
4
|
+
version: 0.215.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-07 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.
|
19
|
+
version: 0.215.0
|
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.
|
26
|
+
version: 0.215.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: debug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 4.0.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 4.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.39.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.
|
124
|
+
version: 1.39.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rubocop-performance
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -272,7 +272,6 @@ files:
|
|
272
272
|
- lib/dependabot/npm_and_yarn/file_fetcher/path_dependency_builder.rb
|
273
273
|
- lib/dependabot/npm_and_yarn/file_parser.rb
|
274
274
|
- lib/dependabot/npm_and_yarn/file_parser/lockfile_parser.rb
|
275
|
-
- lib/dependabot/npm_and_yarn/file_parser/yarn_lockfile_parser.rb
|
276
275
|
- lib/dependabot/npm_and_yarn/file_updater.rb
|
277
276
|
- lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb
|
278
277
|
- lib/dependabot/npm_and_yarn/file_updater/npmrc_builder.rb
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "dependabot/dependency_file"
|
4
|
-
require "dependabot/npm_and_yarn/file_parser"
|
5
|
-
|
6
|
-
module Dependabot
|
7
|
-
module NpmAndYarn
|
8
|
-
class FileParser
|
9
|
-
class YarnLockfileParser
|
10
|
-
def initialize(lockfile:)
|
11
|
-
@content = lockfile.content
|
12
|
-
end
|
13
|
-
|
14
|
-
# This is *extremely* crude, but saves us from having to shell out
|
15
|
-
# to Yarn, which may not be safe
|
16
|
-
def parse
|
17
|
-
yaml = convert_to_yaml
|
18
|
-
lockfile_object = parse_as_yaml(yaml)
|
19
|
-
expand_lockfile_requirements(lockfile_object)
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
attr_reader :content
|
25
|
-
|
26
|
-
# Transform lockfile to parseable YAML by wrapping requirements in
|
27
|
-
# quotes, e.g. ("pkg@1.0.0":) and adding colon to nested
|
28
|
-
# properties (version: "1.0.0")
|
29
|
-
def convert_to_yaml
|
30
|
-
sanitize_requirement = lambda do |line|
|
31
|
-
return line unless line.match?(/^[\w"]/)
|
32
|
-
|
33
|
-
"\"#{line.gsub(/\"|:\n$/, '')}\":\n"
|
34
|
-
end
|
35
|
-
add_missing_colon = ->(l) { l.sub(/(?<=\w|")\s(?=\w|")/, ": ") }
|
36
|
-
|
37
|
-
content.lines.map(&sanitize_requirement).map(&add_missing_colon).join
|
38
|
-
end
|
39
|
-
|
40
|
-
def parse_as_yaml(yaml)
|
41
|
-
YAML.safe_load(yaml)
|
42
|
-
rescue Psych::SyntaxError, Psych::DisallowedClass, Psych::BadAlias
|
43
|
-
{}
|
44
|
-
end
|
45
|
-
|
46
|
-
# Split all comma separated keys and duplicate the lockfile entry
|
47
|
-
# so we get one entry per version requirement, this is needed when
|
48
|
-
# one of the requirements specifies a file: requirement, e.g.
|
49
|
-
# "pkga@file:./pkg, pkgb@1.0.0 and we want to check this in
|
50
|
-
# `details_from_yarn_lock`
|
51
|
-
def expand_lockfile_requirements(lockfile_object)
|
52
|
-
lockfile_object.to_a.each_with_object({}) do |(names, val), res|
|
53
|
-
names.split(", ").each { |name| res[name] = val }
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|