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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed4eb6b19bbc39f10e111df1a241ea304a8b3a721e6c145e37b1f03ddb40148c
4
- data.tar.gz: 165c9387b70bdc78a1f2833a7eef50a8ccf049eb93006ef3ad7011f255b100b1
3
+ metadata.gz: e8577e4e56c2c101fa5ecaae691683401dfcb638358f332a61d8fcb7f556bb85
4
+ data.tar.gz: a2a1f34175b30630a2b7fa9473be1c6e4ef86def063acc8e5924a7509f7a3081
5
5
  SHA512:
6
- metadata.gz: b5a080a198f25399da430676e6c35452b886f596de315a27dc0659c6dec7acb75101088a798787c2220f3de202d4ae6e7523892c0de61efac8723133b2c77a13
7
- data.tar.gz: 73a5a30b33d2bae41ddd25fd3ad271ecee0ee9a4e8b038dcafb17f4fa27130ed11869d40b9606bdb4a5d64481027b00db88adec1e7302940fa59e8f23dfdd287
6
+ metadata.gz: e490c696d6f7c75ff8c99f8b1913fe3433056db2aa30901f9c73c4410fc39956c555c06a6c44921403d96b852e0ef5081138b1c217a522d83a70aaf0dae1bd42
7
+ data.tar.gz: 5a93c2bb33674b419b0f163f1c2e9590ad279f41d19e6f9b0fb16780510264e35ca5d3baf97f14c2fbe510dadbc2d235b7a9c956dfb2f699401d008b9faad770
@@ -1,4 +1,4 @@
1
- const REGEX = /(url\(\s*['"]?|(?<!\w)['"][^'"]*)\$\//g
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')
@@ -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
- // 'components/theme': _glob_components_theme,
16
- // 'components/shared/tooltip': _glob_components_shared_tooltip
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 key = file.slice(0, -ext.length)
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}`)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BunBunBundle
4
- VERSION = '0.3.3'
4
+ VERSION = '0.3.4'
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.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wout Fierens