bun_bun_bundle 0.16.0 → 0.17.1
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 +4 -0
- data/lib/bun/bun_bundle.js +18 -4
- data/lib/bun/plugins/aliases.js +1 -1
- data/lib/bun_bun_bundle/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c387e6ad8916429ab55c3c5d40d242e38e07ec119c18a67ef2a26e822c838930
|
|
4
|
+
data.tar.gz: '0378dea82862a785be22673192f81fbb418df6c1b6316e09699ff1f4b7238e48'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7bd880d07c868b9a6ae9f7583d478c620937e17f8e1cb4739af7b166e9d21f4980ef735703182991f72806ae68044d78e0f5c7813b34af4b4a1ef7c90d4ac16d
|
|
7
|
+
data.tar.gz: c6e6731f9bd81ba9b4acc2396fa530c2f9e527569c4e7129a9aa4e70967936b8bc5aa9bebfc50587f1742b304a369feb9b282c887376ec710c24693ce34b92a1
|
data/README.md
CHANGED
|
@@ -447,6 +447,10 @@ Reference custom plugins by their file path in your config:
|
|
|
447
447
|
}
|
|
448
448
|
```
|
|
449
449
|
|
|
450
|
+
A plugin list replaces the built-in list for that asset type only. In the
|
|
451
|
+
example above both lists re-include the defaults, but overriding just `"js"`
|
|
452
|
+
leaves the default `css` plugins (`aliases`, `cssGlobs`) in place.
|
|
453
|
+
|
|
450
454
|
> [!WARNING]
|
|
451
455
|
> The order of the plugins matters here. For example, the aliases plugin needs
|
|
452
456
|
> to resolve the paths first before the glob plugin can do its work. Keep that
|
data/lib/bun/bun_bundle.js
CHANGED
|
@@ -85,7 +85,10 @@ export default {
|
|
|
85
85
|
parseSriFlag(argv) {
|
|
86
86
|
const value = this.findValueFlag(argv, 'sri', 'sha384')
|
|
87
87
|
if (value === null) return {}
|
|
88
|
-
const algos = value
|
|
88
|
+
const algos = value
|
|
89
|
+
.split(',')
|
|
90
|
+
.map(a => a.trim())
|
|
91
|
+
.filter(Boolean)
|
|
89
92
|
const valid = algos.filter(a => this.SRI_ALGORITHMS.includes(a))
|
|
90
93
|
const invalid = algos.filter(a => !this.SRI_ALGORITHMS.includes(a))
|
|
91
94
|
if (invalid.length) {
|
|
@@ -141,7 +144,6 @@ export default {
|
|
|
141
144
|
const json = readFileSync(join(this.root, this.CONFIG_PATH), 'utf-8')
|
|
142
145
|
const user = JSON.parse(json)
|
|
143
146
|
this.config = this.deepMerge(defaults, user)
|
|
144
|
-
if (user.plugins != null) this.config.plugins = user.plugins
|
|
145
147
|
} catch {
|
|
146
148
|
this.config = defaults
|
|
147
149
|
}
|
|
@@ -238,6 +240,14 @@ export default {
|
|
|
238
240
|
`${type}/${fileName}`,
|
|
239
241
|
content
|
|
240
242
|
)
|
|
243
|
+
|
|
244
|
+
// Write extra outputs (CSS url() assets above Bun's 128KiB inline limit)
|
|
245
|
+
for (const output of result.outputs) {
|
|
246
|
+
if (output === mainOutput || output === mapOutput) continue
|
|
247
|
+
const dest = join(outDir, output.path)
|
|
248
|
+
mkdirSync(dirname(dest), {recursive: true})
|
|
249
|
+
await Bun.write(dest, output)
|
|
250
|
+
}
|
|
241
251
|
}
|
|
242
252
|
},
|
|
243
253
|
|
|
@@ -307,7 +317,9 @@ export default {
|
|
|
307
317
|
await this.buildCSS()
|
|
308
318
|
await this.writeManifest()
|
|
309
319
|
const ms = Math.round(performance.now() - start)
|
|
310
|
-
const status = this.ok
|
|
320
|
+
const status = this.ok
|
|
321
|
+
? 'DONE Built successfully'
|
|
322
|
+
: ' ✖ Built with errors'
|
|
311
323
|
console.log(`${status} in ${ms} ms`, this.prettyManifest())
|
|
312
324
|
return this.ok
|
|
313
325
|
},
|
|
@@ -391,7 +403,9 @@ export default {
|
|
|
391
403
|
|
|
392
404
|
for (const pattern of this.config.watchDirs) {
|
|
393
405
|
const dirs = pattern.includes('*')
|
|
394
|
-
? await Array.fromAsync(
|
|
406
|
+
? await Array.fromAsync(
|
|
407
|
+
new Glob(pattern).scan({cwd: this.root, onlyFiles: false})
|
|
408
|
+
)
|
|
395
409
|
: [pattern]
|
|
396
410
|
for (const dir of dirs) {
|
|
397
411
|
const fullDir = join(this.root, dir)
|
data/lib/bun/plugins/aliases.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const CSS_REGEX = /((?:url\(\s*|@import\s+|not\s+)['"]?(?:glob:)?)\$\//g
|
|
2
2
|
const JS_REGEX =
|
|
3
|
-
/((?:from\s+|require\s*\(\s*|import\s*\(\s*)['"](?:glob:)?)\$\//g
|
|
3
|
+
/((?:from\s+|import\s+|require\s*\(\s*|import\s*\(\s*)['"](?:glob:)?)\$\//g
|
|
4
4
|
|
|
5
5
|
// Resolves `$/` root aliases in CSS url() references and JS/CSS imports.
|
|
6
6
|
// e.g. url('$/app/assets/images/foo.png') → url('/absolute/root/app/assets/images/foo.png')
|
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.
|
|
4
|
+
version: 0.17.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wout Fierens
|
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
74
|
version: '0'
|
|
75
75
|
requirements: []
|
|
76
|
-
rubygems_version: 4.0.
|
|
76
|
+
rubygems_version: 4.0.20
|
|
77
77
|
specification_version: 4
|
|
78
78
|
summary: A self-contained asset bundler powered by Bun
|
|
79
79
|
test_files: []
|