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 +4 -4
- data/README.md +12 -0
- data/lib/bun/bun_bundle.js +9 -6
- data/lib/bun_bun_bundle/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bff7bd740b838f48ba037bb55c643d9acb9739e1fc2455403295ba2302157b58
|
|
4
|
+
data.tar.gz: 5a5f91ebf61b94f7ee2fe77cb9243db8259172a8b5d7650461763f800a8563e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
data/lib/bun/bun_bundle.js
CHANGED
|
@@ -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
|
|
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
|
|
279
|
+
hostname,
|
|
277
280
|
port,
|
|
278
281
|
fetch(req, server) {
|
|
279
282
|
if (server.upgrade(req)) return
|