bun_bun_bundle 0.15.0 → 0.16.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: 83cae9e5463f7df2c26023e77369676ee32206ee5460fe8e9aa3a9448bf69fae
4
- data.tar.gz: a800d5ce3030e40a0fce533a8adee35036956406dc27e000bd59aa850f6c356a
3
+ metadata.gz: a2e15190a33ba91af0c840a7d84afd1e3e95b5689482492e591c095a2ccea097
4
+ data.tar.gz: 11a47245181f06092afe759fc560e96a20a4dcb15c6829804489bdf0cdd2e538
5
5
  SHA512:
6
- metadata.gz: 8dc2812c44a0a19e59ec112528279a0ba3454808bf8cbab7b650adbf4ec27399f12667c6d85486e8b0ab60a5eb11ac24af728635b8ae0c72b8b0e8d78542affc
7
- data.tar.gz: c8a21adc9822064299c0fa8db67570837ce04b18395b2b0932f4a7bffa33cb9faf6752effe538b62005c737f076d917c8544bdea96e58c2107f3a7149931f8e8
6
+ metadata.gz: c43139a7c5ff8ca1feeec696d72933ffec2efc07e9bbe8dc5187f629baea8155f266b4df47a039cc210b7e683830c83c1a26a890471537c1e043fff2e5d0b83f
7
+ data.tar.gz: '0431696314fbd0045ded2028711cae3fe8033910516183bf0d93b27b36994826b5b6c936cd2e23e485d64cc577bdba39ae398c312c987a316f6e44c8c98dab02'
data/README.md CHANGED
@@ -319,6 +319,20 @@ To exclude specific paths, add one or more `not` clauses:
319
319
  './components/internal/**';
320
320
  ```
321
321
 
322
+ Cascade layer assignments are preserved on each expanded import. Both named
323
+ and anonymous forms are supported:
324
+
325
+ ```css
326
+ @import './components/*.css' layer(components);
327
+ @import './utilities/*.css' layer;
328
+ ```
329
+
330
+ `layer` clauses may be combined with `not` clauses (layer first):
331
+
332
+ ```css
333
+ @import './components/**/*.css' layer(components) not './components/admin/**';
334
+ ```
335
+
322
336
  > [!WARNING]
323
337
  > Always include the file extension in glob patterns (e.g., `**/*.css` instead
324
338
  > of `**/*`). Without it, editor temp files like Vim's `~` backups will be
@@ -462,6 +462,20 @@ export default {
462
462
  } catch {}
463
463
  process.exit(0)
464
464
  })
465
+
466
+ const parentPid = process.ppid
467
+ const parentCheck = setInterval(() => {
468
+ try {
469
+ process.kill(parentPid, 0)
470
+ } catch {
471
+ clearInterval(parentCheck)
472
+ this.shutdown()
473
+ try {
474
+ server.stop(true)
475
+ } catch {}
476
+ process.exit(0)
477
+ }
478
+ }, 1000)
465
479
  },
466
480
 
467
481
  async bake() {
@@ -2,12 +2,16 @@ import {dirname, relative, resolve, join} from 'path'
2
2
  import {Glob} from 'bun'
3
3
 
4
4
  const IMPORT_RE =
5
- /@import\s+['"]([^'"]*\*[^'"]*)['"]((?:\s+not\s+['"][^'"]*['"])*)\s*;/g
5
+ /@import\s+['"]([^'"]*\*[^'"]*)['"](?:\s+(layer(?:\([^)]*\))?))?((?:\s+not\s+['"][^'"]*['"])*)\s*;/g
6
6
  const NOT_RE = /not\s+['"]([^'"]*)['"]/g
7
7
 
8
8
  function parseImport(match) {
9
- const nots = [...(match[2] || '').matchAll(NOT_RE)]
10
- return {pattern: match[1], excludes: nots.map(m => m[1])}
9
+ const nots = [...(match[3] || '').matchAll(NOT_RE)]
10
+ return {
11
+ pattern: match[1],
12
+ layer: match[2] || null,
13
+ excludes: nots.map(m => m[1])
14
+ }
11
15
  }
12
16
 
13
17
  function splitGlob(pattern) {
@@ -48,7 +52,7 @@ export default function cssGlobs() {
48
52
  const replacements = []
49
53
 
50
54
  for (const match of content.matchAll(IMPORT_RE)) {
51
- const {pattern, excludes} = parseImport(match)
55
+ const {pattern, layer, excludes} = parseImport(match)
52
56
  const files = (await scanFiles(fileDir, pattern, excludes)).filter(
53
57
  f => resolve(fileDir, f) !== args.path
54
58
  )
@@ -64,9 +68,10 @@ export default function cssGlobs() {
64
68
  const s = files.length !== 1 ? 's' : ''
65
69
  console.log(` CSS glob: ${label} → ${files.length} file${s}`)
66
70
 
71
+ const suffix = layer ? ` ${layer}` : ''
67
72
  replacements.push({
68
73
  fullMatch: match[0],
69
- expanded: files.map(f => `@import '${f}';`).join('\n')
74
+ expanded: files.map(f => `@import '${f}'${suffix};`).join('\n')
70
75
  })
71
76
  }
72
77
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BunBunBundle
4
- VERSION = '0.15.0'
4
+ VERSION = '0.16.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.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wout Fierens