bun_bun_bundle 0.5.1 → 0.6.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: 01053ee4f895f8d24614790b64ba21f8b61ba6acbeb538007e88fed6b20d1a92
4
- data.tar.gz: 3f55e7edfa1b5fede049bad52c22a6e28faac5c77cef230083d3ecd48a2c7cbc
3
+ metadata.gz: bff7bd740b838f48ba037bb55c643d9acb9739e1fc2455403295ba2302157b58
4
+ data.tar.gz: 5a5f91ebf61b94f7ee2fe77cb9243db8259172a8b5d7650461763f800a8563e7
5
5
  SHA512:
6
- metadata.gz: 90d8e766d94a452ea7364a1c55e061d927a9e5af80e35aa616ef418eadacaccdd85248845ba912e98d83e08b07440c40bbc984b3632f805549977f52879e543f
7
- data.tar.gz: c62aed94154ca7066a12fde9aa994013b36c67f28ed8c894de902564b4b3a802a08f8103fe71d6e2efd28d557fa5b6463dc5226058f099c9c739f94e47115d9e
6
+ metadata.gz: a266d1e7f52c59eeb0ded668af5c10ee8f8924c55b0768cda805772a2211b4936d21ea5a3f804b4d2d2fdfd8422960d5c0e418b58ba4d4c0c04ae8b248310bb9
7
+ data.tar.gz: bd81cf02e502d776d05718877b30433d6c2700fbc8a26d6fac78db37f55f68433a6a1cfb4ef5cc47029786c180aaa2c0b6a521335d5009c43056ed1895d71304
data/README.md CHANGED
@@ -200,6 +200,7 @@ Place a `config/bun.json` in your project root:
200
200
  "outDir": "public/assets",
201
201
  "publicPath": "/assets",
202
202
  "manifestPath": "public/bun-manifest.json",
203
+ "watchDirs": ["app/assets"],
203
204
  "staticDirs": ["app/assets/images", "app/assets/fonts"],
204
205
  "devServer": {
205
206
  "host": "127.0.0.1",
@@ -217,6 +218,17 @@ Place a `config/bun.json` in your project root:
217
218
  > Creating a `bun.json` file is entirely optional. All values shown above are
218
219
  > defaults, you only need to specify what you want to override.
219
220
 
221
+ If you're developing inside a Docker container, set `listenHost` so the
222
+ WebSocket server accepts connections from the host machine:
223
+
224
+ ```json
225
+ {
226
+ "devServer": {
227
+ "listenHost": "0.0.0.0"
228
+ }
229
+ }
230
+ ```
231
+
220
232
  ## Plugins
221
233
 
222
234
  Three plugins are included out of the box.
@@ -45,6 +45,7 @@ export default {
45
45
  const defaults = {
46
46
  entryPoints: {js: ['app/assets/js/app.js'], css: ['app/assets/css/app.css']},
47
47
  plugins: {css: ['aliases', 'cssGlobs'], js: ['aliases', 'jsGlobs']},
48
+ watchDirs: ['app/assets'],
48
49
  staticDirs: ['app/assets/images', 'app/assets/fonts'],
49
50
  outDir: 'public/assets',
50
51
  publicPath: '/assets',
@@ -222,9 +223,7 @@ export default {
222
223
  },
223
224
 
224
225
  async watch() {
225
- const srcDir = join(this.root, this.config.watchDir || 'app/assets')
226
-
227
- watch(srcDir, {recursive: true}, (event, filename) => {
226
+ const handler = (event, filename) => {
228
227
  if (!filename) return
229
228
 
230
229
  let normalizedFilename = filename.replace(/\\/g, '/')
@@ -259,7 +258,10 @@ export default {
259
258
  if (err.errors) for (const e of err.errors) console.error(e)
260
259
  }
261
260
  })()
262
- })
261
+ }
262
+
263
+ for (const dir of this.config.watchDirs)
264
+ watch(join(this.root, dir), {recursive: true}, handler)
263
265
 
264
266
  console.log('Beginning to watch your project')
265
267
  },
@@ -268,12 +270,13 @@ export default {
268
270
  await this.build()
269
271
  await this.watch()
270
272
 
271
- const {host, port, secure} = this.config.devServer
273
+ const {host, listenHost, port, secure} = this.config.devServer
274
+ const hostname = listenHost || (secure ? '0.0.0.0' : host)
272
275
  const debug = this.debug
273
276
  const wsClients = this.wsClients
274
277
 
275
278
  Bun.serve({
276
- hostname: secure ? '0.0.0.0' : host,
279
+ hostname,
277
280
  port,
278
281
  fetch(req, server) {
279
282
  if (server.upgrade(req)) return
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BunBunBundle
4
- VERSION = '0.5.1'
4
+ VERSION = '0.6.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bun_bun_bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wout Fierens