bundlebun 0.3.0.1.3.8-aarch64-linux → 0.4.0.1.3.8-aarch64-linux
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/CHANGELOG.md +8 -0
- data/README.md +74 -40
- data/exe/bundlebun +1 -1
- data/lib/bundlebun/env_path.rb +6 -3
- data/lib/bundlebun/integrations.rb +2 -0
- data/lib/bundlebun/runner.rb +135 -21
- data/lib/bundlebun/version.rb +1 -1
- data/lib/bundlebun.rb +63 -7
- data/lib/tasks/bun.rake +1 -1
- data/sig/bundlebun/env_path.rbs +8 -0
- data/sig/bundlebun/integrations/cssbundling.rbs +12 -0
- data/sig/bundlebun/integrations/execjs.rbs +7 -0
- data/sig/bundlebun/integrations/jsbundling.rbs +12 -0
- data/sig/bundlebun/integrations/vite_ruby.rbs +12 -0
- data/sig/bundlebun/integrations.rbs +5 -0
- data/sig/bundlebun/platform.rbs +5 -0
- data/sig/bundlebun/runner.rbs +35 -0
- data/sig/bundlebun/version.rbs +3 -0
- data/sig/bundlebun.rbs +18 -0
- metadata +20 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 06ab64db90fe90fd19fb08427c8ca39dee9067d575e296a714da249b9f00e05a
|
|
4
|
+
data.tar.gz: c80e30e34145a8d6c2ca0da91fd2d1d24c4ebce997baa145ece9bf8c319ab049
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 53d74f5e6c44fdc40a36c29d7903ebd044eae559b79c6c8f074c781f1b34e54f1b9fb93f1579bf4ae278b06b278c2ba4f4b879906f8cf746ffcda784e8f608bb
|
|
7
|
+
data.tar.gz: 34deaf0a237207308a17f13ae82fc6bb87b7eeab57174a7d42ecf0d710a0a1d3e1e42dc28c4d784bc8faf8193255e5199e27a04b784d3972a3e17ac282e265fb
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [0.4.0] - 2026-02-01
|
|
2
|
+
|
|
3
|
+
- `Bundlebun.system(args)` method: runs Bun as a subprocess and returns to Ruby. Returns `true` if Bun exited successfully. Use this when you need to continue executing Ruby code after Bun finishes.
|
|
4
|
+
- Default behaviour remains: `Bundlebun.()` / `Bundlebun.call` / `Bundlebun.exec` all replace the current Ruby process with Bun (never return). This is what binstubs and wrappers use.
|
|
5
|
+
|
|
6
|
+
- ActiveSupport::Notifications instrumentation added. `system.bundlebun` for `Bundlebun.system` calls, `exec.bundlebun` for exec calls (binstubs, wrappers). Payload: `{ command: args }`.
|
|
7
|
+
- Added RBS type signatures for the public API
|
|
8
|
+
|
|
1
9
|
## [0.3.0] - 2026-01-29
|
|
2
10
|
|
|
3
11
|
- New `rake bun:install:package` task: automatically migrates `package.json` scripts to use `bin/bun`. Replaces calls to `bun`, `bunx`, `npx`, `npm run`, `yarn run`, `pnpm run`, and `pnpm exec` with their `bin/bun` equivalents. Asks for confirmation.
|
data/README.md
CHANGED
|
@@ -88,14 +88,77 @@ Similarly, if `Procfile` or `Procfile.*` files are present, the installer will o
|
|
|
88
88
|
|
|
89
89
|
_Windows tip:_ If you're on Windows, the `bin\bun.cmd` file will be created. If you've joined an existing project where only the Unix-like binstub exists at that location, just run `rake bun:install` again.
|
|
90
90
|
|
|
91
|
-
Next, the Rake task will try to detect the integrations we need to install based on the classes and modules Rake can see in your project.
|
|
91
|
+
Next, the Rake task will try to detect the integrations we need to install based on the classes and modules Rake can see in your project. See: _Integrations_.
|
|
92
92
|
|
|
93
93
|
**By default, on load, bundlebun:**
|
|
94
94
|
|
|
95
95
|
- adds the path to the bundled `bun` executable to the start of your application's `PATH`. That simplifies the integration in cases where we don't really need to monkey-patch a lot of code, and we just need to make sure it "sees" our `bun` executable as available.
|
|
96
96
|
- tries to detect and load all possible integrations.
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
## Usage
|
|
99
|
+
|
|
100
|
+
### Binstub
|
|
101
|
+
|
|
102
|
+
The easiest way to interact with bundled Bun is via the binstub at `bin/bun`; it will launch the bundled version of Bun with the arguments provided:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
> bin/bun
|
|
106
|
+
Bun is a fast JavaScript runtime, package manager, bundler, and test runner. (1.1.38+bf2f153f5)
|
|
107
|
+
|
|
108
|
+
Usage: bun <command> [...flags] [...args]
|
|
109
|
+
|
|
110
|
+
...
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### `PATH`
|
|
114
|
+
|
|
115
|
+
The bundlebun gem adds the directory with a binary Bun distribution to your `PATH`: prepends it there, to be exact. That helps existing tools that can detect the presence of `bun` executable to find it and work with no further setup or monkey-patching.
|
|
116
|
+
|
|
117
|
+
### Rake
|
|
118
|
+
|
|
119
|
+
Alternatively, you can use a Rake task. The syntax is far from perfect, but that's a limitation of Rake. You need to add quotes around the parameters and put them into square brackets. If you cannot install the binstub, though, might be your option.
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
rake bun[command] # Run bundled Bun with parameters
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
> rake "bun[outdated]"
|
|
127
|
+
bun outdated v1.1.38 (bf2f153f)
|
|
128
|
+
...
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Ruby
|
|
132
|
+
|
|
133
|
+
**Check bundlebun API: https://rubydoc.info/gems/bundlebun**.
|
|
134
|
+
|
|
135
|
+
The easiest way to call Bun from Ruby is via `Bundlebun.()` (shortcut for `Bundlebun.call()`).
|
|
136
|
+
|
|
137
|
+
**Note:** `Bundlebun.call` replaces the current Ruby process with Bun: it never returns.
|
|
138
|
+
|
|
139
|
+
```ruby
|
|
140
|
+
Bundlebun.('outdated') # runs `bun outdated`
|
|
141
|
+
Bundlebun.call(['add', 'postcss']) # runs `bun add postcss`
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
If you need to run Bun and then continue executing your Ruby code, use `Bundlebun.system`:
|
|
145
|
+
|
|
146
|
+
```ruby
|
|
147
|
+
if Bundlebun.system('install')
|
|
148
|
+
puts 'Dependencies installed!'
|
|
149
|
+
else
|
|
150
|
+
puts 'Installation failed'
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Run tests and check result
|
|
154
|
+
success = Bundlebun.system('test')
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Returns `true` if Bun exited successfully, `false` or `nil` otherwise.
|
|
158
|
+
|
|
159
|
+
Check out the [API documentation](https://rubydoc.info/gems/bundlebun) on `Bundlebun::Runner` for helper methods.
|
|
160
|
+
|
|
161
|
+
## Integrations
|
|
99
162
|
|
|
100
163
|
Usually, if you've placed `gem 'bundlebun'` after your frontend-related gems in the `Gemfile`, and did `rake bun:install`, the integrations should all be working out of the box.
|
|
101
164
|
|
|
@@ -160,52 +223,23 @@ Alternatively, you can load the monkey-patch manually:
|
|
|
160
223
|
Bundlebun::Integrations::ExecJS.bun!
|
|
161
224
|
```
|
|
162
225
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
### Binstub
|
|
166
|
-
|
|
167
|
-
The easiest way to interact with bundled Bun is via the binstub at `bin/bun`; it will launch the bundled version of Bun with the arguments provided:
|
|
168
|
-
|
|
169
|
-
```sh
|
|
170
|
-
> bin/bun
|
|
171
|
-
Bun is a fast JavaScript runtime, package manager, bundler, and test runner. (1.1.38+bf2f153f5)
|
|
172
|
-
|
|
173
|
-
Usage: bun <command> [...flags] [...args]
|
|
174
|
-
|
|
175
|
-
...
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### `PATH`
|
|
226
|
+
#### ActiveSupport::Notifications (Instrumentation)
|
|
179
227
|
|
|
180
|
-
|
|
228
|
+
When ActiveSupport is available, bundlebun emits instrumentation events that you can subscribe to for logging or monitoring:
|
|
181
229
|
|
|
182
|
-
|
|
230
|
+
- `system.bundlebun` for `Bundlebun.system` (calling Bun and returning to Ruby code);
|
|
231
|
+
- `exec.bundlebun` for `Bundlebun.call` / `Bundlebun.exec` (binstubs and wrappers: exiting to Bun).
|
|
183
232
|
|
|
184
|
-
|
|
233
|
+
The payload is `{ command: args }`: the arguments you passed to the method (string or array).
|
|
185
234
|
|
|
186
|
-
|
|
187
|
-
rake bun[command] # Run bundled Bun with parameters
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
```sh
|
|
191
|
-
> rake "bun[outdated]"
|
|
192
|
-
bun outdated v1.1.38 (bf2f153f)
|
|
193
|
-
...
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Ruby
|
|
197
|
-
|
|
198
|
-
**Check bundlebun API: https://rubydoc.info/gems/bundlebun**.
|
|
199
|
-
|
|
200
|
-
The easiest way to call Bun from Ruby would be `Bundlebun.call`:
|
|
235
|
+
Example subscriber:
|
|
201
236
|
|
|
202
237
|
```ruby
|
|
203
|
-
|
|
204
|
-
|
|
238
|
+
ActiveSupport::Notifications.subscribe('system.bundlebun') do |event|
|
|
239
|
+
Rails.logger.info "Bun: #{event.payload[:command]} (#{event.duration.round(1)}ms)"
|
|
240
|
+
end
|
|
205
241
|
```
|
|
206
242
|
|
|
207
|
-
Check out the [API documentation](https://rubydoc.info/gems/bundlebun) on `Bundlebun::Runner` for helper methods.
|
|
208
|
-
|
|
209
243
|
## Versioning
|
|
210
244
|
|
|
211
245
|
bundlebun uses the `#{bundlebun.version}.#{bun.version}` versioning scheme. Meaning: gem bundlebun version `0.1.0.1.1.38` is a distribution that includes a gem with its own code version `0.1.0` and a Bun runtime with version `1.1.38`.
|
data/exe/bundlebun
CHANGED
data/lib/bundlebun/env_path.rb
CHANGED
|
@@ -31,10 +31,13 @@ module Bundlebun
|
|
|
31
31
|
def prepend(new_path)
|
|
32
32
|
return if new_path.nil? || new_path.empty?
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
already_present = if Bundlebun::Platform.windows?
|
|
35
|
+
path.downcase.start_with?(new_path.downcase)
|
|
36
|
+
else
|
|
37
|
+
path.start_with?(new_path)
|
|
38
|
+
end
|
|
36
39
|
|
|
37
|
-
self.path = "#{new_path}#{separator}#{path}" unless
|
|
40
|
+
self.path = "#{new_path}#{separator}#{path}" unless already_present
|
|
38
41
|
path
|
|
39
42
|
end
|
|
40
43
|
|
data/lib/bundlebun/runner.rb
CHANGED
|
@@ -3,29 +3,92 @@
|
|
|
3
3
|
module Bundlebun
|
|
4
4
|
# {Runner} is the class that bundlebun uses to run the bundled Bun executable.
|
|
5
5
|
#
|
|
6
|
+
# bundlebun provides two ways to run Bun:
|
|
7
|
+
#
|
|
8
|
+
# - {.call} (also available as {.exec}): Replaces the current Ruby process with Bun. This is the default.
|
|
9
|
+
#
|
|
10
|
+
# - {.system}: Runs Bun as a subprocess and returns control to Ruby.
|
|
11
|
+
# Use this when you need to continue executing Ruby code after Bun finishes.
|
|
12
|
+
#
|
|
6
13
|
# @see Bundlebun
|
|
14
|
+
#
|
|
15
|
+
# @example Running Bun (replaces process, never returns)
|
|
16
|
+
# Bundlebun.('install')
|
|
17
|
+
# Bundlebun.call('outdated')
|
|
18
|
+
# Bundlebun.call(['add', 'postcss'])
|
|
19
|
+
#
|
|
20
|
+
# @example Running Bun as subprocess (returns to Ruby)
|
|
21
|
+
# if Bundlebun.system('install')
|
|
22
|
+
# puts 'Dependencies installed!'
|
|
23
|
+
# end
|
|
7
24
|
class Runner
|
|
8
25
|
BINSTUB_PATH = 'bin/bun'
|
|
9
26
|
RELATIVE_DIRECTORY = 'lib/bundlebun/vendor/bun'
|
|
10
27
|
|
|
11
28
|
class << self
|
|
12
|
-
#
|
|
29
|
+
# Replaces the current Ruby process with Bun.
|
|
13
30
|
#
|
|
14
|
-
#
|
|
31
|
+
# When `ActiveSupport::Notifications` is available, this method publishes an
|
|
32
|
+
# `exec.bundlebun` event before replacing the process. The payload contains
|
|
33
|
+
# `{ command: arguments }` where `arguments` is what was passed to the method.
|
|
15
34
|
#
|
|
16
35
|
# @param arguments [String, Array<String>] Command arguments to pass to Bun
|
|
17
|
-
# @return [
|
|
36
|
+
# @return [void] This method never returns
|
|
18
37
|
#
|
|
19
|
-
# @example
|
|
20
|
-
#
|
|
38
|
+
# @example In a binstub (bin/bun)
|
|
39
|
+
# #!/usr/bin/env ruby
|
|
40
|
+
# require 'bundlebun'
|
|
41
|
+
# Bundlebun.exec(ARGV)
|
|
42
|
+
#
|
|
43
|
+
# @see .call
|
|
44
|
+
# @see .system
|
|
45
|
+
def exec(...)
|
|
46
|
+
new(...).exec
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Replaces the current Ruby process with Bun. Alias for {.exec}.
|
|
50
|
+
# Also available via the `.()` shorthand syntax.
|
|
51
|
+
#
|
|
52
|
+
# @param arguments [String, Array<String>] Command arguments to pass to Bun
|
|
53
|
+
# @return [void] This method never returns
|
|
21
54
|
#
|
|
22
|
-
# @example
|
|
23
|
-
# Bundlebun.call(
|
|
55
|
+
# @example Basic usage
|
|
56
|
+
# Bundlebun.call('outdated')
|
|
57
|
+
# Bundlebun.call(['add', 'postcss'])
|
|
24
58
|
#
|
|
25
|
-
# @
|
|
26
|
-
#
|
|
59
|
+
# @example Using the .() shorthand
|
|
60
|
+
# Bundlebun.('install')
|
|
61
|
+
#
|
|
62
|
+
# @see .exec
|
|
63
|
+
# @see .system
|
|
27
64
|
def call(...)
|
|
28
|
-
|
|
65
|
+
exec(...)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Runs Bun as a subprocess and returns control to Ruby.
|
|
69
|
+
#
|
|
70
|
+
# Unlike {.call} and {.exec}, this method does not replace the current process.
|
|
71
|
+
# Use this when you need to run Bun and then continue executing Ruby code.
|
|
72
|
+
#
|
|
73
|
+
# When `ActiveSupport::Notifications` is available, this method publishes a
|
|
74
|
+
# `system.bundlebun` event with timing information. The payload contains
|
|
75
|
+
# `{ command: arguments }` where `arguments` is what was passed to the method.
|
|
76
|
+
#
|
|
77
|
+
# @param arguments [String, Array<String>] Command arguments to pass to Bun
|
|
78
|
+
# @return [Boolean, nil] `true` if Bun exited successfully (status 0),
|
|
79
|
+
# `false` if it exited with an error, `nil` if execution failed
|
|
80
|
+
#
|
|
81
|
+
# @example Run install and check result
|
|
82
|
+
# if Bundlebun.system('install')
|
|
83
|
+
# puts 'Dependencies installed!'
|
|
84
|
+
# else
|
|
85
|
+
# puts 'Installation failed'
|
|
86
|
+
# end
|
|
87
|
+
#
|
|
88
|
+
# @see .call
|
|
89
|
+
# @see .exec
|
|
90
|
+
def system(...)
|
|
91
|
+
new(...).system
|
|
29
92
|
end
|
|
30
93
|
|
|
31
94
|
# A relative path to binstub that bundlebun usually generates with installation Rake tasks.
|
|
@@ -98,41 +161,92 @@ module Bundlebun
|
|
|
98
161
|
end
|
|
99
162
|
end
|
|
100
163
|
|
|
101
|
-
#
|
|
164
|
+
# Initialize the {Runner} with arguments to run the Bun runtime later.
|
|
102
165
|
#
|
|
103
166
|
# @param arguments [String, Array<String>] Command arguments to pass to Bun
|
|
104
167
|
#
|
|
105
168
|
# @example String as an argument
|
|
106
|
-
# Bundlebun::Runner.new('--version')
|
|
169
|
+
# Bundlebun::Runner.new('--version')
|
|
107
170
|
#
|
|
108
171
|
# @example Array of strings as an argument
|
|
109
|
-
# Bundlebun::Runner.new(['add', 'postcss'])
|
|
172
|
+
# Bundlebun::Runner.new(['add', 'postcss'])
|
|
110
173
|
#
|
|
111
|
-
# @see
|
|
174
|
+
# @see #system
|
|
175
|
+
# @see #exec
|
|
112
176
|
def initialize(arguments = '')
|
|
113
177
|
@arguments = arguments
|
|
114
178
|
end
|
|
115
179
|
|
|
116
|
-
#
|
|
180
|
+
# Replaces the current Ruby process with Bun.
|
|
181
|
+
# This is the default behavior.
|
|
117
182
|
#
|
|
118
|
-
#
|
|
183
|
+
# When `ActiveSupport::Notifications` is available, this method publishes an
|
|
184
|
+
# `exec.bundlebun` event before replacing the process. The payload contains
|
|
185
|
+
# `{ command: arguments }` where `arguments` is what was passed to the runner.
|
|
119
186
|
#
|
|
120
|
-
# @return [
|
|
187
|
+
# @return [void] This method never returns
|
|
121
188
|
#
|
|
122
189
|
# @example
|
|
123
|
-
#
|
|
124
|
-
#
|
|
190
|
+
# runner = Bundlebun::Runner.new(ARGV)
|
|
191
|
+
# runner.exec # Ruby process ends here, Bun takes over
|
|
125
192
|
#
|
|
126
|
-
# @see
|
|
193
|
+
# @see #system
|
|
194
|
+
def exec
|
|
195
|
+
check_executable!
|
|
196
|
+
instrument('exec.bundlebun')
|
|
197
|
+
Kernel.exec(command)
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Replaces the current Ruby process with Bun. Alias for {#exec}.
|
|
201
|
+
#
|
|
202
|
+
# @return [void] This method never returns
|
|
203
|
+
#
|
|
204
|
+
# @see #exec
|
|
127
205
|
def call
|
|
206
|
+
exec
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Runs Bun as a subprocess and returns control to Ruby.
|
|
210
|
+
#
|
|
211
|
+
# Unlike {#call} and {#exec}, this method does not replace the current process.
|
|
212
|
+
# Use this when you need to run Bun and then continue executing Ruby code.
|
|
213
|
+
#
|
|
214
|
+
# When `ActiveSupport::Notifications` is available, this method publishes a
|
|
215
|
+
# `system.bundlebun` event with timing information. The payload contains
|
|
216
|
+
# `{ command: arguments }` where `arguments` is what was passed to the runner.
|
|
217
|
+
#
|
|
218
|
+
# @return [Boolean, nil] `true` if Bun exited successfully (status 0),
|
|
219
|
+
# `false` if it exited with an error, `nil` if execution failed
|
|
220
|
+
#
|
|
221
|
+
# @example
|
|
222
|
+
# runner = Bundlebun::Runner.new('install')
|
|
223
|
+
# if runner.system
|
|
224
|
+
# puts 'Dependencies installed!'
|
|
225
|
+
# end
|
|
226
|
+
#
|
|
227
|
+
# @see #exec
|
|
228
|
+
def system
|
|
128
229
|
check_executable!
|
|
129
|
-
|
|
230
|
+
instrument('system.bundlebun') do
|
|
231
|
+
Kernel.system(command)
|
|
232
|
+
end
|
|
130
233
|
end
|
|
131
234
|
|
|
132
235
|
private
|
|
133
236
|
|
|
134
237
|
attr_reader :arguments
|
|
135
238
|
|
|
239
|
+
def instrument(event, &block)
|
|
240
|
+
return block&.call unless defined?(ActiveSupport::Notifications)
|
|
241
|
+
|
|
242
|
+
payload = {command: arguments}
|
|
243
|
+
if block
|
|
244
|
+
ActiveSupport::Notifications.instrument(event, payload, &block)
|
|
245
|
+
else
|
|
246
|
+
ActiveSupport::Notifications.instrument(event, payload)
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
|
|
136
250
|
def check_executable!
|
|
137
251
|
return if self.class.binary_path_exist?
|
|
138
252
|
|
data/lib/bundlebun/version.rb
CHANGED
data/lib/bundlebun.rb
CHANGED
|
@@ -9,28 +9,84 @@ require 'zeitwerk'
|
|
|
9
9
|
# bundlebun includes binary distributions of Bun for each of the supported
|
|
10
10
|
# platforms (macOS, Linux, Windows) and architectures.
|
|
11
11
|
#
|
|
12
|
+
# bundlebun provides two ways to run Bun:
|
|
13
|
+
#
|
|
14
|
+
# - {.call} (also available as {.exec}): Replaces the current Ruby process with Bun. The default.
|
|
15
|
+
#
|
|
16
|
+
# - {.system}: Runs Bun as a subprocess and returns control to Ruby.
|
|
17
|
+
# Use this when you need to continue executing Ruby code after Bun finishes.
|
|
18
|
+
#
|
|
12
19
|
# @see Bundlebun::Runner
|
|
13
20
|
# @see Bundlebun::Integrations
|
|
21
|
+
#
|
|
22
|
+
# @example Running Bun (replaces process, never returns)
|
|
23
|
+
# Bundlebun.('install') # .() shorthand syntax
|
|
24
|
+
# Bundlebun.call('outdated')
|
|
25
|
+
# Bundlebun.call(['add', 'postcss'])
|
|
26
|
+
#
|
|
27
|
+
# @example Running Bun as subprocess (returns to Ruby)
|
|
28
|
+
# if Bundlebun.system('install')
|
|
29
|
+
# puts 'Dependencies installed!'
|
|
30
|
+
# end
|
|
14
31
|
module Bundlebun
|
|
15
32
|
class << self
|
|
16
|
-
#
|
|
33
|
+
# Replaces the current Ruby process with Bun.
|
|
17
34
|
#
|
|
18
|
-
#
|
|
35
|
+
# This is the default way to run Bun. The Ruby process is replaced by Bun
|
|
36
|
+
# and never returns. Also available via the `.()` shorthand syntax.
|
|
19
37
|
#
|
|
20
38
|
# @param arguments [String, Array<String>] Command arguments to pass to Bun
|
|
21
|
-
# @return [
|
|
39
|
+
# @return [void] This method never returns
|
|
22
40
|
#
|
|
23
|
-
# @example
|
|
24
|
-
# Bundlebun.call('
|
|
41
|
+
# @example Basic usage
|
|
42
|
+
# Bundlebun.call('outdated')
|
|
43
|
+
# Bundlebun.call(['add', 'postcss'])
|
|
25
44
|
#
|
|
26
|
-
# @example
|
|
27
|
-
# Bundlebun.
|
|
45
|
+
# @example Using the .() shorthand
|
|
46
|
+
# Bundlebun.('install')
|
|
47
|
+
# Bundlebun.(ARGV)
|
|
28
48
|
#
|
|
49
|
+
# @see .exec
|
|
50
|
+
# @see .system
|
|
29
51
|
# @see Bundlebun::Runner.call
|
|
30
52
|
def call(...)
|
|
31
53
|
Runner.call(...)
|
|
32
54
|
end
|
|
33
55
|
|
|
56
|
+
# Replaces the current Ruby process with Bun. Same as {.call}.
|
|
57
|
+
#
|
|
58
|
+
# @param arguments [String, Array<String>] Command arguments to pass to Bun
|
|
59
|
+
# @return [void] This method never returns
|
|
60
|
+
#
|
|
61
|
+
# @see .call
|
|
62
|
+
# @see Bundlebun::Runner.exec
|
|
63
|
+
def exec(...)
|
|
64
|
+
Runner.exec(...)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Runs Bun as a subprocess and returns control to Ruby.
|
|
68
|
+
#
|
|
69
|
+
# Unlike {.call} and {.exec}, this method does not replace the current process.
|
|
70
|
+
# Use this when you need to run Bun and then continue executing Ruby code.
|
|
71
|
+
#
|
|
72
|
+
# @param arguments [String, Array<String>] Command arguments to pass to Bun
|
|
73
|
+
# @return [Boolean, nil] `true` if Bun exited successfully (status 0),
|
|
74
|
+
# `false` if it exited with an error, `nil` if execution failed
|
|
75
|
+
#
|
|
76
|
+
# @example Run install and check result
|
|
77
|
+
# if Bundlebun.system('install')
|
|
78
|
+
# puts 'Dependencies installed!'
|
|
79
|
+
# else
|
|
80
|
+
# puts 'Installation failed'
|
|
81
|
+
# end
|
|
82
|
+
#
|
|
83
|
+
# @see .call
|
|
84
|
+
# @see .exec
|
|
85
|
+
# @see Bundlebun::Runner.system
|
|
86
|
+
def system(...)
|
|
87
|
+
Runner.system(...)
|
|
88
|
+
end
|
|
89
|
+
|
|
34
90
|
def loader # @private
|
|
35
91
|
@loader ||= Zeitwerk::Loader.for_gem.tap do |loader|
|
|
36
92
|
loader.ignore("#{__dir__}/tasks")
|
data/lib/tasks/bun.rake
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module Bundlebun
|
|
2
|
+
class Runner
|
|
3
|
+
BINSTUB_PATH: String
|
|
4
|
+
RELATIVE_DIRECTORY: String
|
|
5
|
+
|
|
6
|
+
# Replaces the current Ruby process with Bun. Never returns.
|
|
7
|
+
def self.exec: (String | Array[String] arguments) -> bot
|
|
8
|
+
|
|
9
|
+
# Replaces the current Ruby process with Bun. Alias for .exec. Never returns.
|
|
10
|
+
def self.call: (String | Array[String] arguments) -> bot
|
|
11
|
+
|
|
12
|
+
# Runs Bun as a subprocess and returns control to Ruby.
|
|
13
|
+
def self.system: (String | Array[String] arguments) -> bool?
|
|
14
|
+
|
|
15
|
+
def self.binstub_path: () -> String
|
|
16
|
+
def self.full_binstub_path: () -> String
|
|
17
|
+
def self.relative_directory: () -> String
|
|
18
|
+
def self.full_directory: () -> String
|
|
19
|
+
def self.binary_path: () -> String
|
|
20
|
+
def self.binary_path_exist?: () -> bool
|
|
21
|
+
def self.binstub_or_binary_path: () -> String
|
|
22
|
+
def self.binstub_exist?: () -> bool
|
|
23
|
+
|
|
24
|
+
def initialize: (?String | Array[String] arguments) -> void
|
|
25
|
+
|
|
26
|
+
# Replaces the current Ruby process with Bun. Never returns.
|
|
27
|
+
def exec: () -> bot
|
|
28
|
+
|
|
29
|
+
# Replaces the current Ruby process with Bun. Alias for #exec. Never returns.
|
|
30
|
+
def call: () -> bot
|
|
31
|
+
|
|
32
|
+
# Runs Bun as a subprocess and returns control to Ruby.
|
|
33
|
+
def system: () -> bool?
|
|
34
|
+
end
|
|
35
|
+
end
|
data/sig/bundlebun.rbs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Bundlebun
|
|
2
|
+
VERSION: String
|
|
3
|
+
|
|
4
|
+
# Replaces the current Ruby process with Bun.
|
|
5
|
+
# This is the default way to run Bun. Never returns.
|
|
6
|
+
def self.call: (String | Array[String] arguments) -> bot
|
|
7
|
+
|
|
8
|
+
# Replaces the current Ruby process with Bun. Same as .call.
|
|
9
|
+
def self.exec: (String | Array[String] arguments) -> bot
|
|
10
|
+
|
|
11
|
+
# Runs Bun as a subprocess and returns control to Ruby.
|
|
12
|
+
# Returns true if Bun exited successfully, false if it failed, nil if execution failed.
|
|
13
|
+
def self.system: (String | Array[String] arguments) -> bool?
|
|
14
|
+
|
|
15
|
+
def self.prepend_to_path: () -> String?
|
|
16
|
+
def self.load_tasks: () -> void
|
|
17
|
+
def self.load_integrations: () -> Array[Module]
|
|
18
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bundlebun
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0.1.3.8
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Yaroslav Markin
|
|
@@ -13,30 +13,30 @@ dependencies:
|
|
|
13
13
|
name: zeitwerk
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
18
|
+
version: '2.5'
|
|
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: '
|
|
25
|
+
version: '2.5'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: json
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
|
-
- - "
|
|
30
|
+
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '0'
|
|
32
|
+
version: '2.0'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
|
-
- - "
|
|
37
|
+
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0'
|
|
39
|
+
version: '2.0'
|
|
40
40
|
description: 'bundlebun bundles Bun, a fast JavaScript runtime, package manager, and
|
|
41
41
|
builder, with your Ruby and Rails applications. No need to use Docker, devcontainers,
|
|
42
42
|
`curl | sh`, or `brew`.
|
|
@@ -71,6 +71,16 @@ files:
|
|
|
71
71
|
- lib/templates/bundling-rails/bundlebun.rake
|
|
72
72
|
- lib/templates/vite-ruby/bun-vite
|
|
73
73
|
- lib/templates/vite-ruby/vite.json
|
|
74
|
+
- sig/bundlebun.rbs
|
|
75
|
+
- sig/bundlebun/env_path.rbs
|
|
76
|
+
- sig/bundlebun/integrations.rbs
|
|
77
|
+
- sig/bundlebun/integrations/cssbundling.rbs
|
|
78
|
+
- sig/bundlebun/integrations/execjs.rbs
|
|
79
|
+
- sig/bundlebun/integrations/jsbundling.rbs
|
|
80
|
+
- sig/bundlebun/integrations/vite_ruby.rbs
|
|
81
|
+
- sig/bundlebun/platform.rbs
|
|
82
|
+
- sig/bundlebun/runner.rbs
|
|
83
|
+
- sig/bundlebun/version.rbs
|
|
74
84
|
homepage: https://github.com/yaroslav/bundlebun
|
|
75
85
|
licenses:
|
|
76
86
|
- MIT
|
|
@@ -80,6 +90,7 @@ metadata:
|
|
|
80
90
|
changelog_uri: https://github.com/yaroslav/bundlebun/blob/master/CHANGELOG.md
|
|
81
91
|
bug_tracker_uri: https://github.com/yaroslav/bundlebun/issues
|
|
82
92
|
documentation_uri: https://rubydoc.info/gems/bundlebun
|
|
93
|
+
rbs_source: sig
|
|
83
94
|
post_install_message: Bun.
|
|
84
95
|
rdoc_options: []
|
|
85
96
|
require_paths:
|