bun_bun_bundle 0.3.3 → 0.3.4
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/lib/bun/plugins/aliases.js +1 -1
- data/lib/bun/plugins/jsGlobs.js +6 -3
- 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: e8577e4e56c2c101fa5ecaae691683401dfcb638358f332a61d8fcb7f556bb85
|
|
4
|
+
data.tar.gz: a2a1f34175b30630a2b7fa9473be1c6e4ef86def063acc8e5924a7509f7a3081
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e490c696d6f7c75ff8c99f8b1913fe3433056db2aa30901f9c73c4410fc39956c555c06a6c44921403d96b852e0ef5081138b1c217a522d83a70aaf0dae1bd42
|
|
7
|
+
data.tar.gz: 5a93c2bb33674b419b0f163f1c2e9590ad279f41d19e6f9b0fb16780510264e35ca5d3baf97f14c2fbe510dadbc2d235b7a9c956dfb2f699401d008b9faad770
|
data/lib/bun/plugins/aliases.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const REGEX = /(url\(\s*['"]?|(?<!\w)['"]
|
|
1
|
+
const REGEX = /(url\(\s*['"]?|(?<!\w)['"](?:glob:)?)\$\//g
|
|
2
2
|
|
|
3
3
|
// Resolves `$/` root aliases in CSS url() references and JS/CSS imports.
|
|
4
4
|
// e.g. url('$/app/assets/images/foo.png') → url('/absolute/root/app/assets/images/foo.png')
|
data/lib/bun/plugins/jsGlobs.js
CHANGED
|
@@ -12,14 +12,16 @@ const REGEX = /import\s+(\w+)\s+from\s+['"]glob:([^'"]+)['"]/g
|
|
|
12
12
|
// import _glob_components_theme from './components/theme.js'
|
|
13
13
|
// import _glob_components_shared_tooltip from './components/shared/tooltip.js'
|
|
14
14
|
// const components = {
|
|
15
|
-
// '
|
|
16
|
-
// '
|
|
15
|
+
// 'theme': _glob_components_theme,
|
|
16
|
+
// 'shared/tooltip': _glob_components_shared_tooltip
|
|
17
17
|
// }
|
|
18
18
|
export default function jsGlobs() {
|
|
19
19
|
return (content, args) => {
|
|
20
20
|
return content.replace(REGEX, (_, binding, pattern) => {
|
|
21
21
|
const dir = dirname(args.path)
|
|
22
22
|
const cleanPattern = pattern.replace(/^\.\//, '')
|
|
23
|
+
const baseDir = cleanPattern.slice(0, cleanPattern.search(/[*?{[]|$/))
|
|
24
|
+
.replace(/\/$/, '')
|
|
23
25
|
const glob = new Glob(cleanPattern)
|
|
24
26
|
const files = Array.from(glob.scanSync({cwd: dir})).sort()
|
|
25
27
|
|
|
@@ -30,7 +32,8 @@ export default function jsGlobs() {
|
|
|
30
32
|
|
|
31
33
|
for (const file of files) {
|
|
32
34
|
const ext = extname(file)
|
|
33
|
-
const
|
|
35
|
+
const relative = baseDir ? file.slice(baseDir.length + 1) : file
|
|
36
|
+
const key = relative.slice(0, -ext.length)
|
|
34
37
|
const safe = `_glob_${key.replace(/[^a-zA-Z0-9]/g, '_')}`
|
|
35
38
|
imports.push(`import ${safe} from './${file}'`)
|
|
36
39
|
entries.push(` '${key}': ${safe}`)
|