dependabot-bun 0.404.0 → 0.405.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 656ed702db4c93729a3058a350606ead85787c12b413c36c2b50391f99b34c16
|
|
4
|
+
data.tar.gz: 7df71910e6023deb726e7029add82278b167f6f4e964a694b5b57d348ce53b6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 750f062f8954c500918facfb909ec935e2b5ae0cfe391dd9d0d50e5bf7a99c3a21ffb9450c88ec4c636117c36ac638a5687dad4793c05f85146bd0b84375ed85
|
|
7
|
+
data.tar.gz: 3ced8084fa5750ac5f6b9aeeb89e4fc916112f30141cb5ae6293d8cfd1b7d5e7dbd2c48b68086ddd0e4ecfab6fe4276155d06bdd3fd6ebb6d2e21f1caf7ef0ac
|
|
@@ -19,8 +19,6 @@ module Dependabot
|
|
|
19
19
|
extend T::Sig
|
|
20
20
|
extend T::Helpers
|
|
21
21
|
|
|
22
|
-
require_relative "file_fetcher/path_dependency_builder"
|
|
23
|
-
|
|
24
22
|
# Npm always prefixes file paths in the lockfile "version" with "file:"
|
|
25
23
|
# even when a naked path is used (e.g. "../dep")
|
|
26
24
|
NPM_PATH_DEPENDENCY_STARTS = T.let(%w(file:).freeze, [String])
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dependabot-bun
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.405.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dependabot
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.405.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.405.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: debug
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -316,7 +316,6 @@ files:
|
|
|
316
316
|
- lib/dependabot/bun/dependency_grapher.rb
|
|
317
317
|
- lib/dependabot/bun/dependency_grapher/lockfile_generator.rb
|
|
318
318
|
- lib/dependabot/bun/file_fetcher.rb
|
|
319
|
-
- lib/dependabot/bun/file_fetcher/path_dependency_builder.rb
|
|
320
319
|
- lib/dependabot/bun/file_parser.rb
|
|
321
320
|
- lib/dependabot/bun/file_parser/bun_lock.rb
|
|
322
321
|
- lib/dependabot/bun/file_parser/bun_lock/record.rb
|
|
@@ -356,7 +355,7 @@ licenses:
|
|
|
356
355
|
- MIT
|
|
357
356
|
metadata:
|
|
358
357
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
|
359
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
|
358
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.405.0
|
|
360
359
|
rdoc_options: []
|
|
361
360
|
require_paths:
|
|
362
361
|
- lib
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
# typed: strict
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require "json"
|
|
5
|
-
require "dependabot/dependency_file"
|
|
6
|
-
require "dependabot/errors"
|
|
7
|
-
require "dependabot/bun/file_fetcher"
|
|
8
|
-
require "sorbet-runtime"
|
|
9
|
-
|
|
10
|
-
module Dependabot
|
|
11
|
-
module Bun
|
|
12
|
-
class FileFetcher
|
|
13
|
-
class PathDependencyBuilder
|
|
14
|
-
extend T::Sig
|
|
15
|
-
|
|
16
|
-
sig do
|
|
17
|
-
params(
|
|
18
|
-
dependency_name: String,
|
|
19
|
-
path: String,
|
|
20
|
-
directory: String,
|
|
21
|
-
package_lock: T.nilable(DependencyFile),
|
|
22
|
-
yarn_lock: T.nilable(DependencyFile)
|
|
23
|
-
)
|
|
24
|
-
.void
|
|
25
|
-
end
|
|
26
|
-
def initialize(
|
|
27
|
-
dependency_name:,
|
|
28
|
-
path:,
|
|
29
|
-
directory:,
|
|
30
|
-
package_lock:,
|
|
31
|
-
yarn_lock:
|
|
32
|
-
)
|
|
33
|
-
@dependency_name = dependency_name
|
|
34
|
-
@path = path
|
|
35
|
-
@directory = directory
|
|
36
|
-
@package_lock = package_lock
|
|
37
|
-
@yarn_lock = yarn_lock
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
sig { returns(DependencyFile) }
|
|
41
|
-
def dependency_file
|
|
42
|
-
filename = File.join(path, "package.json")
|
|
43
|
-
|
|
44
|
-
DependencyFile.new(
|
|
45
|
-
name: Pathname.new(filename).cleanpath.to_path,
|
|
46
|
-
content: build_path_dep_content(dependency_name),
|
|
47
|
-
directory: directory,
|
|
48
|
-
support_file: true
|
|
49
|
-
)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
private
|
|
53
|
-
|
|
54
|
-
sig { returns(String) }
|
|
55
|
-
attr_reader :dependency_name
|
|
56
|
-
|
|
57
|
-
sig { returns(String) }
|
|
58
|
-
attr_reader :path
|
|
59
|
-
|
|
60
|
-
sig { returns(T.nilable(DependencyFile)) }
|
|
61
|
-
attr_reader :package_lock
|
|
62
|
-
|
|
63
|
-
sig { returns(T.nilable(DependencyFile)) }
|
|
64
|
-
attr_reader :yarn_lock
|
|
65
|
-
|
|
66
|
-
sig { returns(String) }
|
|
67
|
-
attr_reader :directory
|
|
68
|
-
|
|
69
|
-
sig { returns(T.untyped) }
|
|
70
|
-
def details_from_yarn_lock
|
|
71
|
-
path_starts = FileFetcher::PATH_DEPENDENCY_STARTS
|
|
72
|
-
parsed_yarn_lock.to_a
|
|
73
|
-
.find do |n, _|
|
|
74
|
-
next false unless n.split(/(?<=\w)\@/).first == dependency_name
|
|
75
|
-
|
|
76
|
-
T.must(n.split(/(?<=\w)\@/).last).start_with?(*path_starts)
|
|
77
|
-
end&.last
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
sig { returns(T.untyped) }
|
|
81
|
-
def details_from_npm_lock
|
|
82
|
-
path_starts = FileFetcher::NPM_PATH_DEPENDENCY_STARTS
|
|
83
|
-
path_deps = parsed_package_lock.fetch("dependencies", []).to_a
|
|
84
|
-
.select do |_, v|
|
|
85
|
-
v.fetch("version", "").start_with?(*path_starts)
|
|
86
|
-
end
|
|
87
|
-
path_deps.find { |n, _| n == dependency_name }&.last
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
sig { params(dependency_name: String).returns(String) }
|
|
91
|
-
def build_path_dep_content(dependency_name)
|
|
92
|
-
unless details_from_yarn_lock || details_from_npm_lock
|
|
93
|
-
raise Dependabot::PathDependenciesNotReachable, [dependency_name]
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
if details_from_yarn_lock
|
|
97
|
-
{
|
|
98
|
-
name: dependency_name,
|
|
99
|
-
version: details_from_yarn_lock["version"] || "0.0.1",
|
|
100
|
-
dependencies:
|
|
101
|
-
replace_yarn_lockfile_paths(
|
|
102
|
-
details_from_yarn_lock["dependencies"]
|
|
103
|
-
),
|
|
104
|
-
optionalDependencies:
|
|
105
|
-
replace_yarn_lockfile_paths(
|
|
106
|
-
details_from_yarn_lock["optionalDependencies"]
|
|
107
|
-
)
|
|
108
|
-
}.compact.to_json
|
|
109
|
-
else
|
|
110
|
-
{
|
|
111
|
-
name: dependency_name,
|
|
112
|
-
version: "0.0.1",
|
|
113
|
-
dependencies: details_from_npm_lock["requires"]
|
|
114
|
-
}.compact.to_json
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
# If an unfetchable path dependency itself has path dependencies
|
|
119
|
-
# then the paths in the yarn.lock for them will be absolute, not
|
|
120
|
-
# relative. Worse, they may point to the user's local cache.
|
|
121
|
-
# We work around this by constructing a relative path to the
|
|
122
|
-
# (second-level) path dependencies.
|
|
123
|
-
sig { params(dependencies_hash: T.nilable(T::Hash[String, T.untyped])).returns(T.untyped) }
|
|
124
|
-
def replace_yarn_lockfile_paths(dependencies_hash)
|
|
125
|
-
return unless dependencies_hash
|
|
126
|
-
|
|
127
|
-
dependencies_hash.each_with_object({}) do |(name, value), obj|
|
|
128
|
-
obj[name] = value
|
|
129
|
-
next unless value.start_with?(*FileFetcher::PATH_DEPENDENCY_STARTS)
|
|
130
|
-
|
|
131
|
-
path_from_base =
|
|
132
|
-
parsed_yarn_lock.to_a
|
|
133
|
-
.find do |n, _|
|
|
134
|
-
next false unless n.split(/(?<=\w)\@/).first == name
|
|
135
|
-
|
|
136
|
-
T.must(n.split(/(?<=\w)\@/).last)
|
|
137
|
-
.start_with?(*FileFetcher::PATH_DEPENDENCY_STARTS)
|
|
138
|
-
end&.first&.split(/(?<=\w)\@/)&.last
|
|
139
|
-
|
|
140
|
-
next unless path_from_base
|
|
141
|
-
|
|
142
|
-
cleaned_path = path_from_base
|
|
143
|
-
.gsub(FileFetcher::PATH_DEPENDENCY_CLEAN_REGEX, "")
|
|
144
|
-
obj[name] = "file:" + File.join(inverted_path, cleaned_path)
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
sig { returns(T.untyped) }
|
|
149
|
-
def parsed_package_lock
|
|
150
|
-
return {} unless package_lock
|
|
151
|
-
|
|
152
|
-
JSON.parse(T.must(T.must(package_lock).content))
|
|
153
|
-
rescue JSON::ParserError
|
|
154
|
-
{}
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
sig { returns(T.nilable(T::Hash[String, T.untyped])) }
|
|
158
|
-
def parsed_yarn_lock
|
|
159
|
-
return unless yarn_lock
|
|
160
|
-
return @parsed_yarn_lock if defined?(@parsed_yarn_lock)
|
|
161
|
-
|
|
162
|
-
parsed = T.cast(
|
|
163
|
-
SharedHelpers.in_a_temporary_directory do
|
|
164
|
-
File.write("yarn.lock", T.must(yarn_lock).content)
|
|
165
|
-
|
|
166
|
-
SharedHelpers.run_helper_subprocess(
|
|
167
|
-
command: NativeHelpers.helper_path,
|
|
168
|
-
function: "yarn:parseLockfile",
|
|
169
|
-
args: [Dir.pwd]
|
|
170
|
-
)
|
|
171
|
-
rescue SharedHelpers::HelperSubprocessFailed
|
|
172
|
-
raise Dependabot::DependencyFileNotParseable, T.must(yarn_lock).path
|
|
173
|
-
end,
|
|
174
|
-
T::Hash[String, T.untyped]
|
|
175
|
-
)
|
|
176
|
-
@parsed_yarn_lock = T.let(parsed, T.nilable(T::Hash[String, T.untyped]))
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
# The path back to the root lockfile
|
|
180
|
-
sig { returns(String) }
|
|
181
|
-
def inverted_path
|
|
182
|
-
path.split("/").map do |part|
|
|
183
|
-
next part if part == "."
|
|
184
|
-
next "tmp" if part == ".."
|
|
185
|
-
|
|
186
|
-
".."
|
|
187
|
-
end.join("/")
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
end
|
|
192
|
-
end
|