@visulima/rollup-plugin-css 1.0.0-alpha.1 → 1.0.0-alpha.2

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +235 -13
  3. package/dist/index.d.mts +2 -2
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.mjs +1 -1
  6. package/dist/loaders/less/index.d.mts +1 -1
  7. package/dist/loaders/lightningcss.d.mts +1 -1
  8. package/dist/loaders/lightningcss.d.ts +1 -1
  9. package/dist/loaders/postcss/index.d.mts +1 -1
  10. package/dist/loaders/postcss/index.d.ts +1 -1
  11. package/dist/loaders/postcss/index.mjs +1 -1
  12. package/dist/loaders/sass/index.d.mts +2 -2
  13. package/dist/loaders/sourcemap.d.mts +1 -1
  14. package/dist/loaders/sourcemap.d.ts +1 -1
  15. package/dist/loaders/stylus/index.d.mts +1 -1
  16. package/dist/loaders/tailwindcss-oxide.d.mts +1 -1
  17. package/dist/loaders/tailwindcss-oxide.d.ts +1 -1
  18. package/dist/loaders/tailwindcss-oxide.mjs +1 -1
  19. package/dist/minifiers/cssnano.d.mts +1 -1
  20. package/dist/minifiers/cssnano.d.ts +1 -1
  21. package/dist/minifiers/lightningcss.d.mts +1 -1
  22. package/dist/minifiers/lightningcss.d.ts +1 -1
  23. package/dist/packem_shared/generate-js-exports-Dqps7nWG.mjs +23 -0
  24. package/dist/packem_shared/inferModeOption-BWjmFhVF.mjs +1 -0
  25. package/dist/packem_shared/{rollupCssPlugin-D-7azn92.mjs → rollupCssPlugin-BTt64HIx.mjs} +2 -2
  26. package/dist/packem_shared/{types-BS4hXME3.d.ts → types-CA9pSumu.d.mts} +5 -1
  27. package/dist/packem_shared/{types-BS4hXME3.d.mts → types-CA9pSumu.d.ts} +5 -1
  28. package/dist/utils/index.d.mts +4 -2
  29. package/dist/utils/index.d.ts +4 -2
  30. package/dist/utils/index.mjs +1 -1
  31. package/package.json +1 -1
  32. package/dist/packem_shared/generate-js-exports-Cg7EXFF1.mjs +0 -14
  33. package/dist/packem_shared/inferModeOption-DYyLMRb2.mjs +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## @visulima/rollup-plugin-css [1.0.0-alpha.2](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-css@1.0.0-alpha.1...@visulima/rollup-plugin-css@1.0.0-alpha.2) (2025-09-01)
2
+
3
+ ### Features
4
+
5
+ * add inline CSS processing mode to rollup-plugin-css ([2605997](https://github.com/visulima/packem/commit/2605997bc1e76a80b22529fd71ec053c02111ea2))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * update dependencies and versions in package.json and pnpm-lock.yaml ([e6086fb](https://github.com/visulima/packem/commit/e6086fbd6ad21bbc35b8365b03e8a5d543354154))
10
+
1
11
  ## @visulima/rollup-plugin-css 1.0.0-alpha.1 (2025-08-29)
2
12
 
3
13
  ### Features
package/README.md CHANGED
@@ -7,7 +7,7 @@ A comprehensive CSS processing plugin for [Packem](https://github.com/visulima/p
7
7
  ### 🎨 CSS Preprocessors
8
8
 
9
9
  - **PostCSS** - Modern CSS transformations with plugin ecosystem
10
- - **Sass/SCSS** - Popular CSS extension language
10
+ - **Sass/SCSS** - Popular CSS extension language
11
11
  - **Less** - Dynamic stylesheet language
12
12
  - **Stylus** - Expressive, dynamic, robust CSS
13
13
  - **Tailwind CSS v4** - Latest Tailwind CSS with PostCSS integration
@@ -22,9 +22,10 @@ A comprehensive CSS processing plugin for [Packem](https://github.com/visulima/p
22
22
 
23
23
  ### 📦 Integration Modes
24
24
 
25
- - **Inject** - Embed CSS in JavaScript and inject at runtime
25
+ - **Inject** - Embed CSS in JavaScript and inject at runtime (with customizable package and method)
26
26
  - **Extract** - Extract CSS to separate `.css` files
27
27
  - **Emit** - Pass processed CSS through the build pipeline
28
+ - **Inline** - Embed CSS as strings in JavaScript modules
28
29
 
29
30
  ### 🔤 TypeScript Support
30
31
 
@@ -95,13 +96,13 @@ export default {
95
96
  rollupCssPlugin({
96
97
  // Extract CSS to separate files
97
98
  mode: "extract",
98
-
99
+
99
100
  // Enable CSS modules for .module.css files
100
101
  autoModules: /\.module\./,
101
-
102
+
102
103
  // Enable source maps
103
104
  sourceMap: true,
104
-
105
+
105
106
  // CSS minification
106
107
  minifier: "cssnano",
107
108
  })
@@ -119,11 +120,11 @@ export default {
119
120
  rollupCssPlugin({
120
121
  // File extensions to process
121
122
  extensions: [".css", ".scss", ".sass", ".less", ".styl"],
122
-
123
+
123
124
  // CSS Modules configuration
124
125
  autoModules: true,
125
126
  namedExports: true,
126
-
127
+
127
128
  // PostCSS configuration
128
129
  postcss: {
129
130
  plugins: [
@@ -134,13 +135,13 @@ export default {
134
135
  generateScopedName: "[name]__[local]___[hash:base64:5]",
135
136
  },
136
137
  },
137
-
138
+
138
139
  // Sass configuration
139
140
  sass: {
140
141
  includePaths: ["node_modules"],
141
142
  outputStyle: "compressed",
142
143
  },
143
-
144
+
144
145
  // Minification
145
146
  minifier: "lightningcss",
146
147
  })
@@ -160,15 +161,15 @@ export default {
160
161
  rollupCssPlugin({
161
162
  // Inject CSS into JavaScript
162
163
  mode: "inject",
163
-
164
+
164
165
  // Enable CSS modules
165
166
  autoModules: true,
166
-
167
+
167
168
  // PostCSS with autoprefixer
168
169
  postcss: {
169
170
  plugins: [require("autoprefixer")],
170
171
  },
171
-
172
+
172
173
  // Minification
173
174
  minifier: "cssnano",
174
175
  })
@@ -176,6 +177,30 @@ export default {
176
177
  };
177
178
  ```
178
179
 
180
+ #### Custom Injection Package and Method
181
+
182
+ You can customize the CSS injection by specifying a custom package and method:
183
+
184
+ ```typescript
185
+ rollupCssPlugin({
186
+ mode: ["inject", {
187
+ // Use your own CSS injection library
188
+ package: "my-custom-injector",
189
+ method: "injectCSS",
190
+
191
+ // Other inject options...
192
+ container: "body",
193
+ prepend: true,
194
+ }],
195
+ autoModules: true,
196
+ })
197
+ ```
198
+
199
+ This allows you to:
200
+ - Use alternative CSS injection libraries
201
+ - Implement custom injection logic
202
+ - Override the default `@visulima/css-style-inject` behavior
203
+
179
204
  ### Tailwind CSS v4 with PostCSS
180
205
 
181
206
  ```typescript
@@ -228,6 +253,59 @@ export default {
228
253
  };
229
254
  ```
230
255
 
256
+ ### Inline Mode
257
+
258
+ Embed CSS directly as strings in JavaScript modules. This reduces HTTP requests but increases bundle size. Ideal for small CSS files or critical CSS that needs to be available immediately.
259
+
260
+ ```typescript
261
+ import { rollupCssPlugin } from "@visulima/rollup-plugin-css";
262
+
263
+ export default {
264
+ plugins: [
265
+ rollupCssPlugin({
266
+ mode: "inline",
267
+ autoModules: true,
268
+ namedExports: true,
269
+ minifier: "cssnano",
270
+ })
271
+ ]
272
+ };
273
+ ```
274
+
275
+ **Benefits:**
276
+ - **Zero HTTP requests** - CSS is embedded directly in JavaScript
277
+ - **No race conditions** - CSS is available immediately when JavaScript executes
278
+ - **Smaller initial bundle** - No separate CSS file to load
279
+ - **Better caching** - CSS is cached with JavaScript bundle
280
+
281
+ **Trade-offs:**
282
+ - **Increased bundle size** - CSS content is included in JavaScript
283
+ - **No separate caching** - CSS can't be cached independently
284
+ - **Larger JavaScript** - Affects JavaScript parsing and execution time
285
+
286
+ **Use cases:**
287
+ - Critical CSS that must be available immediately
288
+ - Small CSS files where the overhead of a separate request isn't worth it
289
+ - Applications where CSS is dynamically generated or modified at runtime
290
+ - Components that need their CSS to be self-contained
291
+
292
+ ```css
293
+ /* Input: styles.css */
294
+ .button {
295
+ background: blue;
296
+ color: white;
297
+ padding: 10px 20px;
298
+ }
299
+ ```
300
+
301
+ ```javascript
302
+ // Output: JavaScript module with embedded CSS
303
+ var css = ".button{background:blue;color:white;padding:10px 20px;}";
304
+
305
+ export { css };
306
+ export default css;
307
+ ```
308
+
231
309
  ## Examples
232
310
 
233
311
  ### CSS Modules with React
@@ -389,6 +467,26 @@ rollupCssPlugin({
389
467
  })
390
468
  ```
391
469
 
470
+ **Benefits:**
471
+ - **Separate caching** - CSS can be cached independently from JavaScript
472
+ - **Parallel loading** - CSS and JavaScript can load simultaneously
473
+ - **Better performance** - Smaller JavaScript bundles, faster parsing
474
+ - **CDN optimization** - CSS can be served from CDN with different cache strategies
475
+ - **Selective loading** - Only load CSS for specific routes or components
476
+
477
+ **Trade-offs:**
478
+ - **Additional HTTP requests** - Separate CSS file must be fetched
479
+ - **Potential FOUC** - Flash of unstyled content if CSS loads after HTML
480
+ - **Build complexity** - Requires additional build step for CSS extraction
481
+ - **Dependency management** - Need to ensure CSS is loaded before JavaScript execution
482
+
483
+ **Use cases:**
484
+ - Large CSS files where separate caching is beneficial
485
+ - Applications with multiple CSS themes or variants
486
+ - Production builds where performance optimization is critical
487
+ - CDN-based deployments requiring separate asset optimization
488
+ - Applications where CSS needs to be loaded conditionally
489
+
392
490
  ### Inject Mode
393
491
 
394
492
  Injects CSS directly into JavaScript at runtime. **Requires `@visulima/css-style-inject`:**
@@ -401,13 +499,137 @@ rollupCssPlugin({
401
499
  })
402
500
  ```
403
501
 
502
+ **Benefits:**
503
+ - **No separate HTTP requests** - CSS is bundled with JavaScript
504
+ - **Guaranteed availability** - CSS is always available when JavaScript executes
505
+ - **Simplified deployment** - Single JavaScript bundle to manage
506
+ - **Dynamic injection** - CSS can be injected conditionally or on-demand
507
+ - **Runtime control** - Full control over when and how CSS is applied
508
+
509
+ **Trade-offs:**
510
+ - **Larger JavaScript bundles** - CSS content increases JavaScript file size
511
+ - **Slower initial parsing** - JavaScript engine must process CSS content
512
+ - **No separate caching** - CSS can't be cached independently from JavaScript
513
+ - **Memory usage** - CSS content remains in JavaScript memory
514
+
515
+ **Use cases:**
516
+ - Single-page applications (SPAs) where CSS is always needed
517
+ - Applications requiring dynamic CSS injection
518
+ - Development builds where simplicity is preferred
519
+ - Applications with complex CSS loading logic
520
+ - Components that need guaranteed CSS availability
521
+
522
+ #### Advanced Inject Configuration
523
+
524
+ You can customize the injection behavior by passing an object to the `mode` option:
525
+
526
+ ```typescript
527
+ rollupCssPlugin({
528
+ mode: ["inject", {
529
+ // Custom package to import the injector from
530
+ package: "my-custom-css-injector",
531
+
532
+ // Custom method name to import
533
+ method: "injectStyles",
534
+
535
+ // Container for style injection (default: "head")
536
+ container: "body",
537
+
538
+ // Insert styles at the beginning of container
539
+ prepend: true,
540
+
541
+ // Use single style tag
542
+ singleTag: true,
543
+
544
+ // Custom attributes for style tag
545
+ attributes: { "data-theme": "dark" },
546
+
547
+ // Make injector treeshakeable
548
+ treeshakeable: true,
549
+ }],
550
+ autoModules: true,
551
+ minifier: "cssnano",
552
+ })
553
+ ```
554
+
555
+ **Custom Package and Method:**
556
+ - **`package`**: Override the default `@visulima/css-style-inject` package
557
+ - **`method`**: Override the default `cssStyleInject` method name
558
+ - **Use case**: When you want to use your own CSS injection library or have custom injection logic
559
+
560
+ ### Inline Mode
561
+
562
+ Embeds CSS directly as strings in JavaScript modules:
563
+
564
+ ```typescript
565
+ rollupCssPlugin({
566
+ mode: "inline", // CSS embedded as strings in JS
567
+ autoModules: true,
568
+ namedExports: true,
569
+ minifier: "cssnano",
570
+ })
571
+ ```
572
+
573
+ **When to use inline mode:**
574
+ - Small CSS files where HTTP request overhead isn't worth it
575
+ - Critical CSS that must be available immediately
576
+ - Applications with dynamic CSS generation
577
+ - Components that need self-contained styles
578
+
579
+ ### Emit Mode
580
+
581
+ Passes processed CSS through the build pipeline without injection or extraction:
582
+
583
+ ```typescript
584
+ rollupCssPlugin({
585
+ mode: "emit", // CSS passed through build pipeline
586
+ autoModules: true,
587
+ minifier: "cssnano",
588
+ })
589
+ ```
590
+
591
+ **Benefits:**
592
+ - **Build pipeline integration** - CSS can be processed by other Rollup plugins
593
+ - **Flexible output** - CSS can be transformed, bundled, or processed further
594
+ - **Custom handling** - Full control over how CSS is processed and output
595
+ - **Plugin ecosystem** - Leverage other Rollup plugins for CSS processing
596
+ - **No assumptions** - Plugin doesn't make assumptions about CSS output
597
+
598
+ **Trade-offs:**
599
+ - **Manual handling required** - Need to configure other plugins to handle CSS
600
+ - **Build complexity** - Requires understanding of Rollup plugin pipeline
601
+ - **No automatic optimization** - CSS optimization must be handled separately
602
+ - **Configuration overhead** - More setup required for complete CSS handling
603
+
604
+ **Use cases:**
605
+ - Custom CSS processing pipelines
606
+ - Integration with other Rollup plugins
607
+ - Applications requiring specific CSS output formats
608
+ - Build systems with custom CSS handling logic
609
+ - Development of CSS processing tools and plugins
610
+
611
+ ## Mode Comparison
612
+
613
+ | Mode | Best For | Bundle Size | HTTP Requests | Caching | Complexity |
614
+ |------|----------|-------------|---------------|---------|------------|
615
+ | **Inject** | SPAs, dynamic injection | Larger JS | Single | Shared | Low |
616
+ | **Extract** | Production, CDN | Smaller JS | Multiple | Separate | Medium |
617
+ | **Inline** | Small files, critical CSS | Larger JS | Single | Shared | Low |
618
+ | **Emit** | Custom pipelines | Variable | Variable | Custom | High |
619
+
620
+ **Quick Decision Guide:**
621
+ - **Choose Inject** when you need guaranteed CSS availability and don't mind larger JS bundles
622
+ - **Choose Extract** when performance and caching are critical, especially for production
623
+ - **Choose Inline** when you have small CSS files and want to eliminate HTTP requests
624
+ - **Choose Emit** when you need full control over CSS processing and output
625
+
404
626
  ## CSS Modules Features
405
627
 
406
628
  CSS Modules provide automatic class name scoping and TypeScript integration:
407
629
 
408
630
  ### Automatic TypeScript Declarations
409
631
  - **Generated .d.ts files** for full IntelliSense support
410
- - **Named exports** for individual class names
632
+ - **Named exports** for individual class names
411
633
  - **Default export** with complete module interface
412
634
  - **Build-time type checking** prevents runtime errors
413
635
 
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from 'rollup';
2
- import { S as StyleOptions } from './packem_shared/types-BS4hXME3.mjs';
3
- export { A as AutoModules, E as ExtractedData, I as InjectOptions, a as InternalStyleOptions, L as LightningCSSOptions, P as PostCSSConfigLoaderOptions, b as PostCSSOptions } from './packem_shared/types-BS4hXME3.mjs';
2
+ import { S as StyleOptions } from './packem_shared/types-CA9pSumu.mjs';
3
+ export { A as AutoModules, E as ExtractedData, I as InjectOptions, a as InternalStyleOptions, L as LightningCSSOptions, P as PostCSSConfigLoaderOptions, b as PostCSSOptions } from './packem_shared/types-CA9pSumu.mjs';
4
4
  import { Environment } from '@visulima/packem-share/types';
5
5
  import 'cssnano';
6
6
  import 'lightningcss';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from 'rollup';
2
- import { S as StyleOptions } from './packem_shared/types-BS4hXME3.js';
3
- export { A as AutoModules, E as ExtractedData, I as InjectOptions, a as InternalStyleOptions, L as LightningCSSOptions, P as PostCSSConfigLoaderOptions, b as PostCSSOptions } from './packem_shared/types-BS4hXME3.js';
2
+ import { S as StyleOptions } from './packem_shared/types-CA9pSumu.js';
3
+ export { A as AutoModules, E as ExtractedData, I as InjectOptions, a as InternalStyleOptions, L as LightningCSSOptions, P as PostCSSConfigLoaderOptions, b as PostCSSOptions } from './packem_shared/types-CA9pSumu.js';
4
4
  import { Environment } from '@visulima/packem-share/types';
5
5
  import 'cssnano';
6
6
  import 'lightningcss';
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{default as e}from"./packem_shared/cssModulesTypesPlugin-B9_bJo_B.mjs";import{default as u}from"./packem_shared/rollupCssPlugin-D-7azn92.mjs";export{e as cssModulesTypesPlugin,u as rollupCssPlugin};
1
+ import{default as e}from"./packem_shared/cssModulesTypesPlugin-B9_bJo_B.mjs";import{default as u}from"./packem_shared/rollupCssPlugin-BTt64HIx.mjs";export{e as cssModulesTypesPlugin,u as rollupCssPlugin};
@@ -1,4 +1,4 @@
1
- import { c as Loader, d as LESSLoaderOptions } from '../../packem_shared/types-BS4hXME3.mjs';
1
+ import { c as Loader, d as LESSLoaderOptions } from '../../packem_shared/types-CA9pSumu.mjs';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -1,4 +1,4 @@
1
- import { c as Loader, L as LightningCSSOptions } from '../packem_shared/types-BS4hXME3.mjs';
1
+ import { c as Loader, L as LightningCSSOptions } from '../packem_shared/types-CA9pSumu.mjs';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -1,4 +1,4 @@
1
- import { c as Loader, L as LightningCSSOptions } from '../packem_shared/types-BS4hXME3.js';
1
+ import { c as Loader, L as LightningCSSOptions } from '../packem_shared/types-CA9pSumu.js';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -1,4 +1,4 @@
1
- import { c as Loader, a as InternalStyleOptions } from '../../packem_shared/types-BS4hXME3.mjs';
1
+ import { c as Loader, a as InternalStyleOptions } from '../../packem_shared/types-CA9pSumu.mjs';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -1,4 +1,4 @@
1
- import { c as Loader, a as InternalStyleOptions } from '../../packem_shared/types-BS4hXME3.js';
1
+ import { c as Loader, a as InternalStyleOptions } from '../../packem_shared/types-CA9pSumu.js';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -1,4 +1,4 @@
1
- var ke=Object.defineProperty;var d=(t,e)=>ke(t,"name",{value:e,configurable:!0});import Se from"@csstools/postcss-slow-plugins";import{dirname as b,normalize as O,parse as J,resolve as Pe,basename as N,isAbsolute as Oe,join as Ee}from"@visulima/path";import Re from"postcss";import{g as Ie}from"../../packem_shared/generate-js-exports-Cg7EXFF1.mjs";import{H as U,m as C,D as Ce,F as te}from"../../packem_shared/sourcemap-DGfgaUBb.mjs";import{n as ie}from"../../packem_shared/ensure-auto-modules-BU3xWEjl.mjs";import{extractICSS as Ne,replaceSymbols as Ue,replaceValueSymbols as Le}from"icss-utils";import{readFile as ze,readFileSync as le}from"@visulima/fs";import{resolve as Q}from"../../packem_shared/resolve-nqhcPNJ9.mjs";import{isRelative as De}from"@visulima/path/utils";import{isWhiteSpaceOrCommentNode as G,isSimpleBlockNode as _e,SimpleBlockNode as We,parseListOfComponentValues as Me,isTokenNode as W,isFunctionNode as I,stringify as S}from"@csstools/css-parser-algorithms";import{isTokenOpenParen as qe,TokenType as ae,tokenize as Te,isTokenString as M,isTokenURL as se,isTokenIdent as Fe}from"@csstools/css-tokenizer";import{findMonorepoRoot as Ae,findPackageRoot as Ge}from"@visulima/package";import Xe from"postcss-load-config";import{ensurePCSSPlugins as Be,ensurePCSSOption as q}from"../../packem_shared/inferModeOption-DYyLMRb2.mjs";import He from"postcss-modules-extract-imports";import Ve from"postcss-modules-local-by-default";import Je from"postcss-modules-scope";import Qe from"postcss-modules-values";import{makeLegalIdentifier as Ye}from"@rollup/pluginutils";import{getHash as ce}from"@visulima/packem-share/utils";import X from"postcss-value-parser";var Ke=Object.defineProperty,Ze=d((t,e)=>Ke(t,"name",{value:e,configurable:!0}),"i$5");const et=Ze(async(t,e,i,a,s)=>{const o=Q([t,`./${t}`],{baseDirs:[b(e)],caller:"ICSS loader",extensions:i}),r=await ze(o),{messages:l}=await a.process(r,{...s,from:o}),c={};for(const n of l)n.type==="icss"&&Object.assign(c,n.export);return c},"load");var tt=Object.defineProperty,it=d((t,e)=>tt(t,"name",{value:e,configurable:!0}),"t$3");const at=it(async(t,e,i,a,s,o)=>{const r={};for await(const[l,c]of Object.entries(t)){const n=await e(l,i,a,s,o);for(const[p,m]of Object.entries(c))r[p]=n[m]}return r},"resolve");var st=Object.defineProperty,ot=d((t,e)=>st(t,"name",{value:e,configurable:!0}),"c$5");const T="styles-icss",nt=[".css",".pcss",".postcss",".sss"],me=ot(t=>{const e=t?.load??et,i=t?.extensions??nt;return{async OnceExit(a,{result:s}){if(!a.source?.input.file)return;const o={...s.opts,map:void 0},{icssExports:r,icssImports:l}=Ne(a),c=await at(l,e,a.source.input.file,i,s.processor,o);Ue(a,c);for(const[n,p]of Object.entries(r))s.messages.push({export:{[n]:Le(p,c)},plugin:T,type:"icss"});for(const n of Object.keys(l))s.messages.push({import:n,plugin:T,type:"icss-dependency"})},postcssPlugin:T}},"plugin");me.postcss=!0;var rt=Object.defineProperty,pt=d((t,e)=>rt(t,"name",{value:e,configurable:!0}),"t$2");const B=pt((t,e,i,a)=>{const s=[];if(t!==void 0){let o="layer";t&&(o=`layer(${t})`),s.push(o)}return i!==void 0&&s.push(`supports(${i})`),a!==void 0&&s.push(`scope(${a})`),e!==void 0&&s.push(e),s.join(" ")},"formatImportPrelude");var lt=Object.defineProperty,ct=d((t,e)=>lt(t,"name",{value:e,configurable:!0}),"p$7");const mt=ct((t,e)=>{e.reverse();const i=e.pop();if(!i)return t;let a=`${t} ${B(i.layer,i.media,i.supports,i.scope)}`;for(const s of e)a=`'data:text/css;base64,${Buffer.from(`@import ${a}`).toString("base64")}' ${B(s.layer,s.media,s.supports,s.scope)}`;return a},"base64EncodedConditionalImport");var ut=Object.defineProperty,z=d((t,e)=>ut(t,"name",{value:e,configurable:!0}),"e$1");const dt=z(t=>t.type==="warning","isWarning"),H=z(t=>t.type==="nodes","isNodesStatement"),L=z(t=>t.type==="import","isImportStatement"),ft=z(t=>t.type==="pre-import","isPreImportStatement");var gt=Object.defineProperty,ht=d((t,e)=>gt(t,"name",{value:e,configurable:!0}),"u$2");const xt=ht((t,e)=>{t.statements.forEach((i,a)=>{if(dt(i)||ft(i)||i.conditions.length===0)return;if(L(i)){i.node.params=mt(i.fullUri,i.conditions);return}const{nodes:s}=i;if(s.length===0)return;const{parent:o}=s[0];if(!o)return;const r=[];for(const n of i.conditions){if(n.media!==void 0){const p=e({name:"media",params:n.media,source:i.importingNode?.source??o.source});r.push(p)}if(n.scope!==void 0){const p=e({name:"scope",params:n.scope,source:i.importingNode?.source??o.source});r.push(p)}if(n.supports!==void 0){const p=e({name:"supports",params:`(${n.supports})`,source:i.importingNode?.source??o.source});r.push(p)}if(n.layer!==void 0){const p=e({name:"layer",params:n.layer,source:i.importingNode?.source??o.source});r.push(p)}}const l=r[0];if(!l)return;for(let n=0;n<r.length-1;n++)r[n].append(r[n+1]);const c=r.at(-1);o.insertBefore(s[0],l),s.forEach(n=>{n.parent=void 0}),c.append(s),t.statements[a]={conditions:i.conditions,from:i.from,importingNode:i.importingNode,nodes:[l],type:"nodes"}})},"applyConditions");var vt=Object.defineProperty,yt=d((t,e)=>vt(t,"name",{value:e,configurable:!0}),"r$4");const bt=yt(t=>{t.statements.forEach((e,i)=>{if(i!==0)if(e.parent!==void 0){const{before:a}=e.parent.node.raws;H(e)?e.nodes[0].raws.before=a:e.node.raws.before=a}else H(e)&&(e.nodes[0].raws.before=e.nodes[0].raws.before??`
1
+ var ke=Object.defineProperty;var d=(t,e)=>ke(t,"name",{value:e,configurable:!0});import Se from"@csstools/postcss-slow-plugins";import{dirname as b,normalize as O,parse as J,resolve as Pe,basename as N,isAbsolute as Oe,join as Ee}from"@visulima/path";import Re from"postcss";import{g as Ie}from"../../packem_shared/generate-js-exports-Dqps7nWG.mjs";import{H as U,m as C,D as Ce,F as te}from"../../packem_shared/sourcemap-DGfgaUBb.mjs";import{n as ie}from"../../packem_shared/ensure-auto-modules-BU3xWEjl.mjs";import{extractICSS as Ne,replaceSymbols as Ue,replaceValueSymbols as Le}from"icss-utils";import{readFile as ze,readFileSync as le}from"@visulima/fs";import{resolve as Q}from"../../packem_shared/resolve-nqhcPNJ9.mjs";import{isRelative as De}from"@visulima/path/utils";import{isWhiteSpaceOrCommentNode as G,isSimpleBlockNode as _e,SimpleBlockNode as We,parseListOfComponentValues as Me,isTokenNode as W,isFunctionNode as I,stringify as S}from"@csstools/css-parser-algorithms";import{isTokenOpenParen as qe,TokenType as ae,tokenize as Te,isTokenString as M,isTokenURL as se,isTokenIdent as Fe}from"@csstools/css-tokenizer";import{findMonorepoRoot as Ae,findPackageRoot as Ge}from"@visulima/package";import Xe from"postcss-load-config";import{ensurePCSSPlugins as Be,ensurePCSSOption as q}from"../../packem_shared/inferModeOption-BWjmFhVF.mjs";import He from"postcss-modules-extract-imports";import Ve from"postcss-modules-local-by-default";import Je from"postcss-modules-scope";import Qe from"postcss-modules-values";import{makeLegalIdentifier as Ye}from"@rollup/pluginutils";import{getHash as ce}from"@visulima/packem-share/utils";import X from"postcss-value-parser";var Ke=Object.defineProperty,Ze=d((t,e)=>Ke(t,"name",{value:e,configurable:!0}),"i$5");const et=Ze(async(t,e,i,a,s)=>{const o=Q([t,`./${t}`],{baseDirs:[b(e)],caller:"ICSS loader",extensions:i}),r=await ze(o),{messages:l}=await a.process(r,{...s,from:o}),c={};for(const n of l)n.type==="icss"&&Object.assign(c,n.export);return c},"load");var tt=Object.defineProperty,it=d((t,e)=>tt(t,"name",{value:e,configurable:!0}),"t$3");const at=it(async(t,e,i,a,s,o)=>{const r={};for await(const[l,c]of Object.entries(t)){const n=await e(l,i,a,s,o);for(const[p,m]of Object.entries(c))r[p]=n[m]}return r},"resolve");var st=Object.defineProperty,ot=d((t,e)=>st(t,"name",{value:e,configurable:!0}),"c$5");const T="styles-icss",nt=[".css",".pcss",".postcss",".sss"],me=ot(t=>{const e=t?.load??et,i=t?.extensions??nt;return{async OnceExit(a,{result:s}){if(!a.source?.input.file)return;const o={...s.opts,map:void 0},{icssExports:r,icssImports:l}=Ne(a),c=await at(l,e,a.source.input.file,i,s.processor,o);Ue(a,c);for(const[n,p]of Object.entries(r))s.messages.push({export:{[n]:Le(p,c)},plugin:T,type:"icss"});for(const n of Object.keys(l))s.messages.push({import:n,plugin:T,type:"icss-dependency"})},postcssPlugin:T}},"plugin");me.postcss=!0;var rt=Object.defineProperty,pt=d((t,e)=>rt(t,"name",{value:e,configurable:!0}),"t$2");const B=pt((t,e,i,a)=>{const s=[];if(t!==void 0){let o="layer";t&&(o=`layer(${t})`),s.push(o)}return i!==void 0&&s.push(`supports(${i})`),a!==void 0&&s.push(`scope(${a})`),e!==void 0&&s.push(e),s.join(" ")},"formatImportPrelude");var lt=Object.defineProperty,ct=d((t,e)=>lt(t,"name",{value:e,configurable:!0}),"p$7");const mt=ct((t,e)=>{e.reverse();const i=e.pop();if(!i)return t;let a=`${t} ${B(i.layer,i.media,i.supports,i.scope)}`;for(const s of e)a=`'data:text/css;base64,${Buffer.from(`@import ${a}`).toString("base64")}' ${B(s.layer,s.media,s.supports,s.scope)}`;return a},"base64EncodedConditionalImport");var ut=Object.defineProperty,z=d((t,e)=>ut(t,"name",{value:e,configurable:!0}),"e$1");const dt=z(t=>t.type==="warning","isWarning"),H=z(t=>t.type==="nodes","isNodesStatement"),L=z(t=>t.type==="import","isImportStatement"),ft=z(t=>t.type==="pre-import","isPreImportStatement");var gt=Object.defineProperty,ht=d((t,e)=>gt(t,"name",{value:e,configurable:!0}),"u$2");const xt=ht((t,e)=>{t.statements.forEach((i,a)=>{if(dt(i)||ft(i)||i.conditions.length===0)return;if(L(i)){i.node.params=mt(i.fullUri,i.conditions);return}const{nodes:s}=i;if(s.length===0)return;const{parent:o}=s[0];if(!o)return;const r=[];for(const n of i.conditions){if(n.media!==void 0){const p=e({name:"media",params:n.media,source:i.importingNode?.source??o.source});r.push(p)}if(n.scope!==void 0){const p=e({name:"scope",params:n.scope,source:i.importingNode?.source??o.source});r.push(p)}if(n.supports!==void 0){const p=e({name:"supports",params:`(${n.supports})`,source:i.importingNode?.source??o.source});r.push(p)}if(n.layer!==void 0){const p=e({name:"layer",params:n.layer,source:i.importingNode?.source??o.source});r.push(p)}}const l=r[0];if(!l)return;for(let n=0;n<r.length-1;n++)r[n].append(r[n+1]);const c=r.at(-1);o.insertBefore(s[0],l),s.forEach(n=>{n.parent=void 0}),c.append(s),t.statements[a]={conditions:i.conditions,from:i.from,importingNode:i.importingNode,nodes:[l],type:"nodes"}})},"applyConditions");var vt=Object.defineProperty,yt=d((t,e)=>vt(t,"name",{value:e,configurable:!0}),"r$4");const bt=yt(t=>{t.statements.forEach((e,i)=>{if(i!==0)if(e.parent!==void 0){const{before:a}=e.parent.node.raws;H(e)?e.nodes[0].raws.before=a:e.node.raws.before=a}else H(e)&&(e.nodes[0].raws.before=e.nodes[0].raws.before??`
2
2
  `)})},"applyRaws");var wt=Object.defineProperty,$t=d((t,e)=>wt(t,"name",{value:e,configurable:!0}),"t$1");const jt=$t((t,e)=>{e.nodes=[],t.charset&&(t.charset.parent=void 0,e.append(t.charset)),t.statements.forEach(i=>{L(i)?(i.node.parent=void 0,e.append(i.node)):H(i)&&i.nodes.forEach(a=>{a.parent=void 0,e.append(a)})})},"applyStyles");var kt=Object.defineProperty,St=d((t,e)=>kt(t,"name",{value:e,configurable:!0}),"o$3");const Pt=St((t,e,i)=>{const a={baseDirs:[e],caller:"@import resolver",extensions:i},s=new URL(t,"file://").pathname,o=[s];return(De(s)||s.startsWith("/"))&&o.push(`.${s}`),s.startsWith("/")&&o.push(s.slice(1)),Q(o,a)},"importResolve");var Ot=Object.defineProperty,ue=d((t,e)=>Ot(t,"name",{value:e,configurable:!0}),"e");const Et=/^data:text\/css(?:;(?:base64|plain))?,/i,Rt=/^data:text\/css;base64,/i,It=/^data:text\/css;plain,/i,V=ue(t=>t!==void 0&&Et.test(t),"isValidDataURL"),Ct=ue(t=>Rt.test(t)?Buffer.from(t.slice(21),"base64").toString():It.test(t)?decodeURIComponent(t.slice(20)):decodeURIComponent(t.slice(14)),"dataURLContents");var Nt=Object.defineProperty,oe=d((t,e)=>Nt(t,"name",{value:e,configurable:!0}),"o$1");const Y=oe(()=>({postcssPlugin:"css-noop",prepare:oe(()=>({}),"prepare")}),"postcssNoop");Y.postcss=!0;var Ut=Object.defineProperty,de=d((t,e)=>Ut(t,"name",{value:e,configurable:!0}),"a$3");const fe=de(async(t,e,i,a,s,o)=>(o===void 0&&(o=0),a.length===0&&a.push(Y()),await t(a).process(e,{from:i,parser:s[o]}).catch(async r=>{if(o++,o===s.length)throw r;return await fe(t,e,i,a,s,o)})),"runPostcss"),Lt=de(async(t,e,i,a,s)=>{const{plugins:o}=a,r=[];return t.opts.syntax?.parse&&r.push(t.opts.syntax.parse),t.opts.parser&&r.push(t.opts.parser),r.push(void 0),await fe(s,e,i,o,r)},"processContent"),zt=/^charset$/i,ge=/^import$/i,Dt=/^url$/i,E=/^layer$/i,_t=/^supports$/i,Wt=/^scope$/i;var Mt=Object.defineProperty,K=d((t,e)=>Mt(t,"name",{value:e,configurable:!0}),"a$2");const qt=K(t=>{for(let e=0;e<t.length;e++){const i=t[e];if(!G(i)&&_e(i)&&qe(i.startToken))return t}return[new We([ae.OpenParen,"(",-1,-1,void 0],[ae.CloseParen,")",-1,-1,void 0],t)]},"wrapInParenthesisIfNeeded"),ne=K(t=>{if(t.startsWith("#"))return"";if(!t.includes("#"))return t;try{const e=new URL(t,"http://example.com");return e.hash?t.slice(0,t.length-e.hash.length):t}catch{return t}},"stripHash"),Tt=K(t=>{const e=Te({css:t});if(e.length===2&&(M(e[0])||se(e[0]))){let n=e[0][4].value;return n=ne(n),n?{fullUri:e[0][1],uri:n}:!1}const i=Me(e);let a="",s="",o,r,l,c;for(let n=0;n<i.length;n++){const p=i[n];if(!G(p)){if(W(p)&&(M(p.value)||se(p.value))){if(a)return!1;a=p.value[4].value,s=p.value[1];continue}if(I(p)&&Dt.test(p.getName())){if(a)return!1;for(let m=0;m<p.value.length;m++){const u=p.value[m];if(!G(u)){if(!a&&W(u)&&M(u.value)){a=u.value[4].value,s=S([[p]]);continue}return!1}}continue}if(!a)return!1;if(W(p)&&Fe(p.value)&&E.test(p.value[4].value)){if(o!==void 0||l!==void 0)return!1;o="";continue}if(I(p)&&E.test(p.getName())){if(o!==void 0||l!==void 0)return!1;o=S([p.value]);continue}if(I(p)&&_t.test(p.getName())){if(l!==void 0)return!1;l=S([p.value]);continue}if(I(p)&&Wt.test(p.getName())){if(c!==void 0)return!1;c=S([qt(p.value)]);continue}r=S([i.slice(n)]);break}}return a=ne(a),a?{fullUri:s,layer:o,media:r,scope:c,supports:l,uri:a}:!1},"parseAtImport");var Ft=Object.defineProperty,k=d((t,e)=>Ft(t,"name",{value:e,configurable:!0}),"l$2");const he=k((t,e,i,a)=>{const s=[];let o=e;const r=t.length;for(o;o<r;o++){const l=t[o];if(s.push(l),t[o+1]?.type!=="comment")break}return[o,{conditions:[],from:a,importingNode:i,nodes:s,type:"nodes"}]},"consumeComments"),At=k((t,e,i,a,s)=>{const o=Tt(e.params);if(!o)return t.warn(`Invalid @import statement in '${e.toString()}'`,{node:e});const r={conditions:[...a],from:s,fullUri:o.fullUri,importingNode:i,node:e,type:"import",uri:o.uri};return(o.layer!==void 0||o.media!==void 0||o.supports!==void 0||o.scope!==void 0)&&r.conditions.push({layer:o.layer,media:o.media,scope:o.scope,supports:o.supports}),r},"parseImport"),Gt=k((t,e,i,a,s,o)=>{const r=[];let l=a;const c=e.length;for(l;l<c;l++){const n=e[l];if(n.type==="comment"){const[p,m]=he(e,l,s,o);r.push(m),l=p;continue}if(n.type==="atrule"&&ge.test(n.name)){r.push(At(t,n,s,i,o));continue}break}return[l-1,r]},"consumeImports"),Xt=k((t,e,i,a,s)=>{const o=[];let r=i;const l=t.length;for(r;r<l;r++){const c=t[r];o.push(c);const n=t[r+1];if(!(n&&n.type==="atrule"&&E.test(n.name)&&!n.nodes))break}return[r,{conditions:[...e],from:s,importingNode:a,nodes:o,type:"nodes"}]},"consumeLayers"),Bt=k((t,e,i,a,s)=>{const o=[];let r=i;const l=t.length;for(r;r<l;r++){const c=t[r];if(c.type==="comment"){const[n,p]=he(t,r,a,s);o.push(p),r=n;continue}if(c.type==="atrule"&&E.test(c.name)&&!c.nodes)if(e.length>0){o.push({conditions:[...e],from:s,importingNode:a,node:c,type:"pre-import"});continue}else{const[n,p]=Xt(t,e,r,a,s);o.push(p),r=n;continue}break}return[r-1,o]},"consumeBeforeImports"),xe=k((t,e,i,a,s)=>{const o={statements:[]};if(e.type==="document")return e.each(m=>{const u=xe(t,m,i,a,s);if(o.charset&&u.charset&&o.charset.params.toLowerCase()!==u.charset.params.toLowerCase())throw u.charset.error(`Incompatible @charset statements:
3
3
  ${u.charset.params} specified in ${u.charset.source?.input.file}
4
4
  ${o.charset.params} specified in ${o.charset.source?.input.file}`);!o.charset&&u.charset&&(o.charset=u.charset),o.statements.push(...u.statements)}),o;let r,l=[],c=[],n;for(let m=0;m<e.nodes.length;m++){const u=e.nodes[m];if(m===0&&u.type==="atrule"&&zt.test(u.name)){r=u;continue}if(c.length===0&&(u.type==="comment"||u.type==="atrule"&&E.test(u.name)&&!u.nodes)){[m,l]=Bt(e.nodes,a,m,i,s);continue}if(c.length===0&&u.type==="atrule"&&ge.test(u.name)){[m,c]=Gt(t,e.nodes,a,m,i,s);continue}n={conditions:[...a],from:s,importingNode:i,nodes:e.nodes.slice(m),type:"nodes"};break}const p=[];return l.length>0&&p.push(...l),c.length>0&&p.push(...c),n&&p.push(n),{charset:r,statements:p}},"parseStylesheet");var Ht=Object.defineProperty,D=d((t,e)=>Ht(t,"name",{value:e,configurable:!0}),"h");const Vt=/^(?:[a-z]+:)?\/\//i,Jt=D(t=>{if(Vt.test(t))return!1;try{if(new URL(t,"https://example.com").search)return!1}catch{}return!0},"isProcessableURL"),re=D(async(t,e,i,a,s,o)=>{const{conditions:r,from:l,node:c}=e,n=r.map(f=>B(f.layer,f.media,f.supports,f.scope)).join(":");if(a.skipDuplicates){if(s.importedFiles[i]?.[n])return{statements:[]};s.importedFiles[i]||(s.importedFiles[i]={}),s.importedFiles[i][n]=!0}if(l.includes(i))return{statements:[]};const p=await a.load(i,a);if(p.trim()===""&&a.warnOnEmpty)return t.warn(`${i} is empty`,{node:c}),{statements:[]};if(a.skipDuplicates&&s.hashFiles[p]?.[n])return{statements:[]};const m=await Lt(t,p,i,a,o),u=m.root;return a.debug&&u.append({text:i}),t.messages=[...t.messages,...m.messages],a.skipDuplicates&&(u.some(f=>f.type==="atrule"&&f.name==="import")||(s.hashFiles[p]||(s.hashFiles[p]={}),s.hashFiles[p][n]=!0)),await ve(a,t,u,s,c,r,[...l,i],o)},"loadImportContent"),Qt=D(async(t,e,i,a,s)=>{if(V(i.uri)){i.stylesheet=await re(e,i,i.uri,t,a,s);return}if(V(i.from.at(-1))){i.stylesheet={statements:[]},e.warn(`Unable to import '${i.uri}' from a stylesheet that is embedded in a data url`,{node:i.node});return}const o=i.node;let r;o.source?.input.file&&(r=o.source.input.file);const l=r?b(r):t.root;for(const[n,p]of Object.entries(t.alias))i.uri!==n&&!i.uri.startsWith(`${n}/`)||(i.uri=O(p)+i.uri.slice(n.length));let c;try{c=await t.resolve(i.uri,l,t.extensions,o)}catch{i.node.warn(e,`Unable to resolve "${i.uri}" from "${l}"`);return}e.messages.push({file:c,parent:r,plugin:"packem-postcss-import",type:"dependency"}),i.stylesheet=await re(e,i,c,t,a,s)},"resolveImportId"),ve=D(async(t,e,i,a,s,o,r,l)=>{let{charset:c,statements:n}=xe(e,i,s,o,r);{const p=[];for await(const m of n)!L(m)||!Jt(m.uri)||t.filter&&!t.filter(m.uri)||p.push(Qt(t,e,m,a,l));p.length>0&&await Promise.all(p)}for(let p=0;p<n.length;p++){const m=n[p];if(L(m)&&m.stylesheet){if(c&&m.stylesheet.charset&&c.params.toLowerCase()!==m.stylesheet.charset.params.toLowerCase())throw m.stylesheet.charset.error(`Incompatible @charset statements:
@@ -1,5 +1,5 @@
1
- import { c as Loader, e as SassLoaderOptions } from '../../packem_shared/types-BS4hXME3.mjs';
2
- export { f as SassLoaderContext } from '../../packem_shared/types-BS4hXME3.mjs';
1
+ import { c as Loader, e as SassLoaderOptions } from '../../packem_shared/types-CA9pSumu.mjs';
2
+ export { f as SassLoaderContext } from '../../packem_shared/types-CA9pSumu.mjs';
3
3
  import 'cssnano';
4
4
  import 'lightningcss';
5
5
  import 'postcss';
@@ -1,4 +1,4 @@
1
- import { c as Loader } from '../packem_shared/types-BS4hXME3.mjs';
1
+ import { c as Loader } from '../packem_shared/types-CA9pSumu.mjs';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -1,4 +1,4 @@
1
- import { c as Loader } from '../packem_shared/types-BS4hXME3.js';
1
+ import { c as Loader } from '../packem_shared/types-CA9pSumu.js';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -1,4 +1,4 @@
1
- import { c as Loader, g as StylusLoaderOptions } from '../../packem_shared/types-BS4hXME3.mjs';
1
+ import { c as Loader, g as StylusLoaderOptions } from '../../packem_shared/types-CA9pSumu.mjs';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -1,4 +1,4 @@
1
- import { c as Loader } from '../packem_shared/types-BS4hXME3.mjs';
1
+ import { c as Loader } from '../packem_shared/types-CA9pSumu.mjs';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -1,4 +1,4 @@
1
- import { c as Loader } from '../packem_shared/types-BS4hXME3.js';
1
+ import { c as Loader } from '../packem_shared/types-CA9pSumu.js';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -1 +1 @@
1
- var J=Object.defineProperty;var S=(g,a)=>J(g,"name",{value:a,configurable:!0});import{stat as y}from"node:fs/promises";import{compile as P,Features as i,toSourceMap as x,optimize as z}from"@tailwindcss/node";import{clearRequireCache as M}from"@tailwindcss/node/require-cache";import{Scanner as $}from"@tailwindcss/oxide";import{findPackageJson as R}from"@visulima/package";import{resolve as v,dirname as w,relative as E,join as C,normalize as T}from"@visulima/path";import{resolveAlias as F}from"@visulima/path/utils";import{g as U}from"../packem_shared/generate-js-exports-Cg7EXFF1.mjs";import{resolve as A}from"../packem_shared/resolve-nqhcPNJ9.mjs";var k=Object.defineProperty,f=S((g,a)=>k(g,"name",{value:a,configurable:!0}),"p");class B{static{S(this,"U")}constructor(a,r,u,l,s,n){this.id=a,this.base=r,this.enableSourceMaps=u,this.customCssResolver=l,this.customJsResolver=s,this.logger=n}static{f(this,"TailwindRoot")}compiler;scanner;candidates=new Set;buildDependencies=new Map;async generate(a,r){const u=v(this.id.replace(/\?.*$/u,"")),l=f(e=>{e!==u&&(/[#?].*\.svg$/u.test(e)||r(e))},"addWatchFileWrapper"),s=this.requiresBuild(),n=w(v(u));if(!this.compiler||!this.scanner||await s){M([...this.buildDependencies.keys()]),this.buildDependencies.clear(),this.addBuildDependency(u),this.logger.debug({message:"Setup compiler"});const e=[];this.compiler=await P(a,{base:n,customCssResolver:this.customCssResolver,customJsResolver:this.customJsResolver,from:this.enableSourceMaps?this.id:void 0,onDependency:f(m=>{l(m),e.push(this.addBuildDependency(m))},"onDependency"),shouldRewriteUrls:!0}),await Promise.all(e),this.logger.debug({message:"Setup scanner"});const d=[...this.compiler.root==="none"?[]:this.compiler.root===null?[{base:this.base,negated:!1,pattern:"**/*"}]:[{...this.compiler.root,negated:!1}],...this.compiler.sources];this.scanner=new $({sources:d})}else for(const e of this.buildDependencies.keys())l(e);const t=this.compiler.features&(i.AtApply|i.JsPluginCompat|i.ThemeFunction|i.Utilities);if(this.logger.debug({data:{availableFeatures:this.compiler.features,hasAtApply:!!(this.compiler.features&i.AtApply),hasJsPluginCompat:!!(this.compiler.features&i.JsPluginCompat),hasRequiredFeatures:!!t,hasThemeFunction:!!(this.compiler.features&i.ThemeFunction),hasUtilities:!!(this.compiler.features&i.Utilities),requiredFeatures:i.AtApply|i.JsPluginCompat|i.ThemeFunction|i.Utilities},message:"Feature analysis"}),!t)return this.logger.debug({data:{missingFeatures:{AtApply:!(this.compiler.features&i.AtApply),JsPluginCompat:!(this.compiler.features&i.JsPluginCompat),ThemeFunction:!(this.compiler.features&i.ThemeFunction),Utilities:!(this.compiler.features&i.Utilities)}},message:"Missing required features, returning false"}),!1;if(this.compiler.features&i.Utilities)if(this.logger.debug({data:{candidatesCountBefore:this.candidates.size,scannerExists:!!this.scanner,scannerHasScan:!!(this.scanner&&typeof this.scanner.scan=="function")},message:"Scan for candidates - Utilities feature enabled"}),this.scanner){const e=this.scanner.scan();this.logger.debug({data:{scannedCandidates:e.slice(0,10),scannedCandidatesCount:e.length},message:"Scanner results"});for(const d of e)this.candidates.add(d);this.logger.debug({data:{candidatesCountAfter:this.candidates.size,newCandidatesAdded:e.length},message:"Candidates updated"})}else this.logger.debug({data:{hasScanMethod:!!(this.scanner&&typeof this.scanner.scan=="function"),scannerType:typeof this.scanner},message:"Scanner not available or missing scan method"});else this.logger.debug({message:"Utilities feature not enabled, skipping candidate scanning"});if(this.compiler.features&i.Utilities){if(this.scanner&&this.scanner.files){this.logger.debug({data:{files:this.scanner.files.slice(0,5),filesCount:this.scanner.files.length},message:"Watching individual files from scanner"});for(const e of this.scanner.files)l(e)}else this.logger.debug({message:"No individual files to watch from scanner"});if(this.scanner&&this.scanner.globs){this.logger.debug({data:{globs:this.scanner.globs.slice(0,3),globsCount:this.scanner.globs.length},message:"Processing globs from scanner"});for await(const e of this.scanner.globs){if(e.pattern[0]==="!"){this.logger.debug({data:{pattern:e.pattern},message:"Skipping negated glob pattern"});continue}let d=E(this.base,e.base);d[0]!=="."&&(d=`./${d}`);const m=C(d,e.pattern);this.logger.debug({data:{base:e.base,glob:e.pattern,watchPath:m},message:"Adding glob to watch list"}),l(m);const{root:b}=this.compiler;if(b!=="none"&&b!==null){const p=v(b.base,b.pattern);try{const h=await y(p);if(h.isDirectory())this.logger.debug({data:{basePath:p,isDirectory:h.isDirectory()},message:"Valid source directory confirmed"});else{const D=`The path given to \`source(…)\` must be a directory but got \`source(${p})\` instead.`;throw this.logger.debug({data:{basePath:p,error:D,isDirectory:h.isDirectory()},message:"Invalid source path detected"}),new Error(D)}}catch(h){this.logger.debug({data:{basePath:p,error:h instanceof Error?h.message:String(h)},message:"Error checking source directory"})}}}}else this.logger.debug({message:"No globs to process from scanner"})}else this.logger.debug({message:"Utilities feature not enabled, skipping file watching"});this.logger.debug({data:{candidates:[...this.candidates].slice(0,10),candidatesCount:this.candidates.size},message:"Build CSS"});const o=this.compiler.build([...this.candidates]);this.logger.debug({data:{cssLength:o.length,cssPreview:o.slice(0,200)+(o.length>200?"...":"")},message:"CSS build completed"}),this.logger.debug({data:{enableSourceMaps:this.enableSourceMaps},message:"Build Source Map"});const c=(this.enableSourceMaps?x(this.compiler.buildSourceMap()):void 0)?.raw;return c?this.logger.debug({data:{hasMappings:!!c.mappings,mapSize:JSON.stringify(c).length,sourcesCount:c.sources?.length||0},message:"Source map generated"}):this.logger.debug({message:"No source map generated"}),{code:o,map:c}}async addBuildDependency(a){let r;try{r=(await y(a)).mtimeMs}catch{}this.buildDependencies.set(a,r)}async requiresBuild(){for await(const[a,r]of this.buildDependencies){if(r===void 0)return!0;try{if((await y(a)).mtimeMs>r)return!0}catch{return!0}}return!1}}const V={name:"tailwindcss",async process({code:g,map:a}){const r=this.alias,u=f(async(t,o)=>{try{const c=await R(o),e=A([t,F(t,r??{})],{baseDirs:[o,C(w(c.path),"node_modules")],caller:"Tailwind CSS Resolver",conditionNames:["style","development|production"],extensions:[".css"],mainFields:["style"],preferRelative:!0});if(e)return this.logger.debug({message:`Resolved CSS import: ${t} -> ${e}`}),e}catch{}return this.logger.debug({message:`Failed to resolve CSS import: ${t} from ${o}`}),!1},"customCssResolver"),l=f(async(t,o)=>{try{const c=await R(o),e=A([t,F(t,r??{})],{baseDirs:[o,C(w(c.path),"node_modules")],caller:"Tailwind JS Resolver",extensions:[".js",".mjs",".cjs",".ts",".tsx",".jsx"]});if(e)return this.logger.debug({message:`Resolved JS import: ${t} -> ${e}`}),e}catch{}return this.logger.debug({message:`Failed to resolve JS import: ${t} from ${o}`}),!1},"customJsResolver");let s=await new B(this.id,this.sourceDir||process.cwd(),this.useSourcemap,u,l,this.logger).generate(g,t=>this.deps.add(T(t)));if(!s)return this.logger.debug({data:{returningOriginalContent:!0},message:"Tailwind generation returned false - not a Tailwind file or missing features"}),{code:g,map:a};if(this.logger.debug({message:"[@tailwindcss/rollup] Generate CSS"}),this.environment==="production"){this.logger.debug({data:{minify:!0,originalSize:s.code.length},message:"[@tailwindcss/rollup] Optimize CSS"});const t=z(s.code,{file:this.id,map:s.map,minify:!0});this.logger.debug({data:{optimizedSize:t.code.length,originalSize:s.code.length,sizeReduction:s.code.length-t.code.length,sizeReductionPercent:`${((s.code.length-t.code.length)/s.code.length*100).toFixed(2)}%`},message:"CSS optimization completed"}),s=t}else this.logger.debug({data:{environment:this.environment},message:"Development mode - skipping CSS optimization"});if(this.emit)return{...s,meta:{moduleContents:s,types:void 0},moduleSideEffects:!0};const n=U({css:s.code,cwd:this.cwd,dts:this.dts,emit:this.emit,extract:this.extract,icssDependencies:[],id:this.id,inject:this.inject,logger:this.logger,map:s.map,modulesExports:{},namedExports:this.namedExports,supportModules:!1});return this.extract?{code:n.code,extracted:{css:s.code,id:this.id,map:s.map},map:n.map,meta:n.meta,moduleSideEffects:n.moduleSideEffects}:{code:n.code,map:n.map,meta:n.meta,moduleSideEffects:n.moduleSideEffects}},test:/\.css$/i};export{V as default};
1
+ var J=Object.defineProperty;var S=(g,a)=>J(g,"name",{value:a,configurable:!0});import{stat as y}from"node:fs/promises";import{compile as P,Features as i,toSourceMap as x,optimize as z}from"@tailwindcss/node";import{clearRequireCache as M}from"@tailwindcss/node/require-cache";import{Scanner as $}from"@tailwindcss/oxide";import{findPackageJson as R}from"@visulima/package";import{resolve as v,dirname as w,relative as E,join as C,normalize as T}from"@visulima/path";import{resolveAlias as F}from"@visulima/path/utils";import{g as U}from"../packem_shared/generate-js-exports-Dqps7nWG.mjs";import{resolve as A}from"../packem_shared/resolve-nqhcPNJ9.mjs";var k=Object.defineProperty,f=S((g,a)=>k(g,"name",{value:a,configurable:!0}),"p");class B{static{S(this,"U")}constructor(a,r,u,l,s,n){this.id=a,this.base=r,this.enableSourceMaps=u,this.customCssResolver=l,this.customJsResolver=s,this.logger=n}static{f(this,"TailwindRoot")}compiler;scanner;candidates=new Set;buildDependencies=new Map;async generate(a,r){const u=v(this.id.replace(/\?.*$/u,"")),l=f(e=>{e!==u&&(/[#?].*\.svg$/u.test(e)||r(e))},"addWatchFileWrapper"),s=this.requiresBuild(),n=w(v(u));if(!this.compiler||!this.scanner||await s){M([...this.buildDependencies.keys()]),this.buildDependencies.clear(),this.addBuildDependency(u),this.logger.debug({message:"Setup compiler"});const e=[];this.compiler=await P(a,{base:n,customCssResolver:this.customCssResolver,customJsResolver:this.customJsResolver,from:this.enableSourceMaps?this.id:void 0,onDependency:f(m=>{l(m),e.push(this.addBuildDependency(m))},"onDependency"),shouldRewriteUrls:!0}),await Promise.all(e),this.logger.debug({message:"Setup scanner"});const d=[...this.compiler.root==="none"?[]:this.compiler.root===null?[{base:this.base,negated:!1,pattern:"**/*"}]:[{...this.compiler.root,negated:!1}],...this.compiler.sources];this.scanner=new $({sources:d})}else for(const e of this.buildDependencies.keys())l(e);const t=this.compiler.features&(i.AtApply|i.JsPluginCompat|i.ThemeFunction|i.Utilities);if(this.logger.debug({data:{availableFeatures:this.compiler.features,hasAtApply:!!(this.compiler.features&i.AtApply),hasJsPluginCompat:!!(this.compiler.features&i.JsPluginCompat),hasRequiredFeatures:!!t,hasThemeFunction:!!(this.compiler.features&i.ThemeFunction),hasUtilities:!!(this.compiler.features&i.Utilities),requiredFeatures:i.AtApply|i.JsPluginCompat|i.ThemeFunction|i.Utilities},message:"Feature analysis"}),!t)return this.logger.debug({data:{missingFeatures:{AtApply:!(this.compiler.features&i.AtApply),JsPluginCompat:!(this.compiler.features&i.JsPluginCompat),ThemeFunction:!(this.compiler.features&i.ThemeFunction),Utilities:!(this.compiler.features&i.Utilities)}},message:"Missing required features, returning false"}),!1;if(this.compiler.features&i.Utilities)if(this.logger.debug({data:{candidatesCountBefore:this.candidates.size,scannerExists:!!this.scanner,scannerHasScan:!!(this.scanner&&typeof this.scanner.scan=="function")},message:"Scan for candidates - Utilities feature enabled"}),this.scanner){const e=this.scanner.scan();this.logger.debug({data:{scannedCandidates:e.slice(0,10),scannedCandidatesCount:e.length},message:"Scanner results"});for(const d of e)this.candidates.add(d);this.logger.debug({data:{candidatesCountAfter:this.candidates.size,newCandidatesAdded:e.length},message:"Candidates updated"})}else this.logger.debug({data:{hasScanMethod:!!(this.scanner&&typeof this.scanner.scan=="function"),scannerType:typeof this.scanner},message:"Scanner not available or missing scan method"});else this.logger.debug({message:"Utilities feature not enabled, skipping candidate scanning"});if(this.compiler.features&i.Utilities){if(this.scanner&&this.scanner.files){this.logger.debug({data:{files:this.scanner.files.slice(0,5),filesCount:this.scanner.files.length},message:"Watching individual files from scanner"});for(const e of this.scanner.files)l(e)}else this.logger.debug({message:"No individual files to watch from scanner"});if(this.scanner&&this.scanner.globs){this.logger.debug({data:{globs:this.scanner.globs.slice(0,3),globsCount:this.scanner.globs.length},message:"Processing globs from scanner"});for await(const e of this.scanner.globs){if(e.pattern[0]==="!"){this.logger.debug({data:{pattern:e.pattern},message:"Skipping negated glob pattern"});continue}let d=E(this.base,e.base);d[0]!=="."&&(d=`./${d}`);const m=C(d,e.pattern);this.logger.debug({data:{base:e.base,glob:e.pattern,watchPath:m},message:"Adding glob to watch list"}),l(m);const{root:b}=this.compiler;if(b!=="none"&&b!==null){const p=v(b.base,b.pattern);try{const h=await y(p);if(h.isDirectory())this.logger.debug({data:{basePath:p,isDirectory:h.isDirectory()},message:"Valid source directory confirmed"});else{const D=`The path given to \`source(…)\` must be a directory but got \`source(${p})\` instead.`;throw this.logger.debug({data:{basePath:p,error:D,isDirectory:h.isDirectory()},message:"Invalid source path detected"}),new Error(D)}}catch(h){this.logger.debug({data:{basePath:p,error:h instanceof Error?h.message:String(h)},message:"Error checking source directory"})}}}}else this.logger.debug({message:"No globs to process from scanner"})}else this.logger.debug({message:"Utilities feature not enabled, skipping file watching"});this.logger.debug({data:{candidates:[...this.candidates].slice(0,10),candidatesCount:this.candidates.size},message:"Build CSS"});const o=this.compiler.build([...this.candidates]);this.logger.debug({data:{cssLength:o.length,cssPreview:o.slice(0,200)+(o.length>200?"...":"")},message:"CSS build completed"}),this.logger.debug({data:{enableSourceMaps:this.enableSourceMaps},message:"Build Source Map"});const c=(this.enableSourceMaps?x(this.compiler.buildSourceMap()):void 0)?.raw;return c?this.logger.debug({data:{hasMappings:!!c.mappings,mapSize:JSON.stringify(c).length,sourcesCount:c.sources?.length||0},message:"Source map generated"}):this.logger.debug({message:"No source map generated"}),{code:o,map:c}}async addBuildDependency(a){let r;try{r=(await y(a)).mtimeMs}catch{}this.buildDependencies.set(a,r)}async requiresBuild(){for await(const[a,r]of this.buildDependencies){if(r===void 0)return!0;try{if((await y(a)).mtimeMs>r)return!0}catch{return!0}}return!1}}const V={name:"tailwindcss",async process({code:g,map:a}){const r=this.alias,u=f(async(t,o)=>{try{const c=await R(o),e=A([t,F(t,r??{})],{baseDirs:[o,C(w(c.path),"node_modules")],caller:"Tailwind CSS Resolver",conditionNames:["style","development|production"],extensions:[".css"],mainFields:["style"],preferRelative:!0});if(e)return this.logger.debug({message:`Resolved CSS import: ${t} -> ${e}`}),e}catch{}return this.logger.debug({message:`Failed to resolve CSS import: ${t} from ${o}`}),!1},"customCssResolver"),l=f(async(t,o)=>{try{const c=await R(o),e=A([t,F(t,r??{})],{baseDirs:[o,C(w(c.path),"node_modules")],caller:"Tailwind JS Resolver",extensions:[".js",".mjs",".cjs",".ts",".tsx",".jsx"]});if(e)return this.logger.debug({message:`Resolved JS import: ${t} -> ${e}`}),e}catch{}return this.logger.debug({message:`Failed to resolve JS import: ${t} from ${o}`}),!1},"customJsResolver");let s=await new B(this.id,this.sourceDir||process.cwd(),this.useSourcemap,u,l,this.logger).generate(g,t=>this.deps.add(T(t)));if(!s)return this.logger.debug({data:{returningOriginalContent:!0},message:"Tailwind generation returned false - not a Tailwind file or missing features"}),{code:g,map:a};if(this.logger.debug({message:"[@tailwindcss/rollup] Generate CSS"}),this.environment==="production"){this.logger.debug({data:{minify:!0,originalSize:s.code.length},message:"[@tailwindcss/rollup] Optimize CSS"});const t=z(s.code,{file:this.id,map:s.map,minify:!0});this.logger.debug({data:{optimizedSize:t.code.length,originalSize:s.code.length,sizeReduction:s.code.length-t.code.length,sizeReductionPercent:`${((s.code.length-t.code.length)/s.code.length*100).toFixed(2)}%`},message:"CSS optimization completed"}),s=t}else this.logger.debug({data:{environment:this.environment},message:"Development mode - skipping CSS optimization"});if(this.emit)return{...s,meta:{moduleContents:s,types:void 0},moduleSideEffects:!0};const n=U({css:s.code,cwd:this.cwd,dts:this.dts,emit:this.emit,extract:this.extract,icssDependencies:[],id:this.id,inject:this.inject,logger:this.logger,map:s.map,modulesExports:{},namedExports:this.namedExports,supportModules:!1});return this.extract?{code:n.code,extracted:{css:s.code,id:this.id,map:s.map},map:n.map,meta:n.meta,moduleSideEffects:n.moduleSideEffects}:{code:n.code,map:n.map,meta:n.meta,moduleSideEffects:n.moduleSideEffects}},test:/\.css$/i};export{V as default};
@@ -1,5 +1,5 @@
1
1
  import { Options } from 'cssnano';
2
- import { M as Minifier } from '../packem_shared/types-BS4hXME3.mjs';
2
+ import { M as Minifier } from '../packem_shared/types-CA9pSumu.mjs';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
5
5
  import 'postcss-load-config';
@@ -1,5 +1,5 @@
1
1
  import { Options } from 'cssnano';
2
- import { M as Minifier } from '../packem_shared/types-BS4hXME3.js';
2
+ import { M as Minifier } from '../packem_shared/types-CA9pSumu.js';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
5
5
  import 'postcss-load-config';
@@ -1,4 +1,4 @@
1
- import { M as Minifier, a as InternalStyleOptions } from '../packem_shared/types-BS4hXME3.mjs';
1
+ import { M as Minifier, a as InternalStyleOptions } from '../packem_shared/types-CA9pSumu.mjs';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -1,4 +1,4 @@
1
- import { M as Minifier, a as InternalStyleOptions } from '../packem_shared/types-BS4hXME3.js';
1
+ import { M as Minifier, a as InternalStyleOptions } from '../packem_shared/types-CA9pSumu.js';
2
2
  import 'cssnano';
3
3
  import 'lightningcss';
4
4
  import 'postcss';
@@ -0,0 +1,23 @@
1
+ var G=Object.defineProperty;var C=(r,s)=>G(r,"name",{value:s,configurable:!0});import{relative as V,basename as P}from"@visulima/path";import R from"./safeId-BN5akJYJ.mjs";var W=Object.defineProperty,w=C((r,s)=>W(r,"name",{value:s,configurable:!0}),"j");const d="css",F=new Set(["abstract","arguments","await","boolean","break","byte","case","catch","char","class","const","continue",d,"debugger","default","delete","do","double","else","enum","eval","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with","yield"]),D=w(r=>{const s=r.replaceAll(/[^\w$]/g,"_");return F.has(s)?`_${s}`:s},"getClassNameIdentifier"),H=w(({css:r,cssVariableName:s,cwd:l,dts:y,dtsOutput:m,id:j,logger:c,modulesExports:e,modulesVariableName:b,namedExports:$,supportModules:g})=>{const o=[`var ${s} = ${JSON.stringify(r)};`];if($&&Object.keys(e).length>0){const u=typeof $=="function"?$:D;for(const[h,a]of Object.entries(e)){const t=u(h);if(h!==t&&c){const v=l?V(l,j):j;c.warn({message:`Exported \`${h}\` as \`${t}\` in ${v}`})}const n=JSON.stringify(a);o.push(`var ${t} = ${n};`),y&&m.push(`declare const ${t}: ${n};`)}}Object.keys(e).length>0&&o.push(`var ${b} = ${JSON.stringify(e)};`);const p=`
2
+ export default ${g?b:s};
3
+ `;return o.push(p),y&&(m.push(`declare const ${s}: string;`),g&&m.push(`
4
+ interface ModulesExports {
5
+ ${Object.keys(e).map(u=>` '${u}': string;`).join(`
6
+ `)}
7
+ }
8
+ `,`declare const ${b}: ModulesExports;`),m.push(p)),{code:o.join(`
9
+ `),moduleSideEffects:!1,types:y?m.join(`
10
+ `):void 0}},"generateInlineExports"),T=w(({css:r,cwd:s,dts:l=!1,emit:y=!1,extract:m=!1,icssDependencies:j=[],id:c,inject:e,inline:b=!1,logger:$,map:g,modulesExports:o,namedExports:p,supportModules:u})=>{const h=w(i=>R(i,P(c)),"saferId"),a=h("modules"),t=[`var ${d} = ${JSON.stringify(r)};`],n=[],v=[d];if(p){l&&n.push(`declare const ${d}: string;`);const i=typeof p=="function"?p:D;for(const[x,O]of Object.entries(o)){const f=i(x);if(x!==f&&$){const S=s?V(s,c):c;$.warn({message:`Exported \`${x}\` as \`${f}\` in ${S}`})}const E=JSON.stringify(O);t.push(`var ${f} = ${E};`),l&&n.push(`declare const ${f}: ${E};`),v.push(f)}}if(b)return H({css:r,cssVariableName:d,cwd:s,dts:l,dtsOutput:n,id:c,logger:$,modulesExports:o,modulesVariableName:a,namedExports:p,supportModules:u});if(e)if(typeof e=="function")t.push(e(d,c,t),`var ${a} = ${JSON.stringify(o)};`);else{const{treeshakeable:i,...x}=typeof e=="object"?e:{},O=h("injector"),f=`${O}(${d},${JSON.stringify(x)});`,E=typeof e=="object"&&e.package?e.package:"@visulima/css-style-inject",S=typeof e=="object"&&e.method?e.method:"cssStyleInject";if(t.unshift(`import { ${S} as ${O} } from "${E}";`),i||t.push(`var ${a} = ${JSON.stringify(o)};`,f),i){t.push("var injected = false;");const B=`if (!injected) { injected = true; ${f} }`;if(o.inject)throw new Error("`inject` keyword is reserved when using `inject.treeshakeable` option");let k="";for(const[_,z]of Object.entries(o)){const A=JSON.stringify(_),q=JSON.stringify(z);k+=`get ${A}() { ${B} return ${q}; },
11
+ `}k+=`inject: function inject() { ${B} },`,t.push(`var ${a} = {${k}};`)}}!e&&Object.keys(o).length>0&&t.push(`var ${a} = ${JSON.stringify(o)};`);const J=`
12
+ export default ${u?a:d};
13
+ `;if(t.push(J),l&&(u&&n.push(`
14
+ interface ModulesExports {
15
+ ${Object.keys(o).map(i=>` '${i}': string;`).join(`
16
+ `)}
17
+ }
18
+ `,typeof e=="object"&&e.treeshakeable?"interface ModulesExports {inject:()=>void}":"",`declare const ${a}: ModulesExports;`),n.push(J)),p){const i=`export {
19
+ ${v.filter(Boolean).join(`,
20
+ `)}
21
+ };`;t.push(i),l&&n.push(i)}const N=t.filter(Boolean).join(`
22
+ `),M=n.length>0?n.filter(Boolean).join(`
23
+ `):void 0;if(y)return{code:r,map:g,meta:{icssDependencies:j,moduleContents:N,types:void 0},moduleSideEffects:!0};let I;return m&&(I={css:r,id:c,map:g}),{code:N,extracted:I,map:g,meta:{icssDependencies:j,moduleContents:N,types:M},moduleSideEffects:u||typeof e=="object"&&e.treeshakeable?!1:"no-treeshake",types:M}},"generateJsExports");export{T as g};
@@ -0,0 +1 @@
1
+ var l=Object.defineProperty;var u=(n,r)=>l(n,"name",{value:r,configurable:!0});import f from"./arrayFmt-Dek5cB7m.mjs";import d from"./loadModule-CovDETwT.mjs";var y=Object.defineProperty,o=u((n,r)=>y(n,"name",{value:r,configurable:!0}),"o");const p=["inject","extract","emit","inline"],S=f(p),P=o(n=>{const r=Array.isArray(n)?n:[n];if(r[0]&&!p.includes(r[0]))throw new Error(`Incorrect mode provided, allowed modes are ${S}`);const t=r[0]??"inject";return{emit:t==="emit",extract:!!(t==="extract"&&(r[1]??!0)),inject:!!(t==="inject"&&(r[1]??!0)),inline:t==="inline"}},"inferModeOption"),O=o((n,r)=>typeof n=="boolean"?n&&{}:typeof n=="object"?n:r,"inferOption"),j=o(n=>{const r=Array.isArray(n)?n:[n];return r[0]?{content:!0,...r[1],inline:r[0]==="inline"}:!1},"inferSourceMapOption"),b=o((n,r)=>{const t=O(n,{});return r&&typeof t=="object"&&!t.alias&&(t.alias=r),t},"inferHandlerOption"),a=o(async(n,r,t,e)=>{if(typeof n!="string")return n;const i=await d(n,t,e);if(!i)throw new Error(`Unable to load PostCSS ${r} \`${n}\``);return i},"ensurePCSSOption"),h=o(async(n,r,t)=>{if(n===void 0)return[];if(n.length===0)return[];const e=[];for await(const i of n.filter(Boolean)){if(!Array.isArray(i)){e.push(await a(i,"plugin",r,t));continue}const[s,c]=i;c?e.push((await a(s,"plugin",r,t))(c)):e.push(await a(s,"plugin",r,t))}return e},"ensurePCSSPlugins");export{a as ensurePCSSOption,h as ensurePCSSPlugins,b as inferHandlerOption,P as inferModeOption,O as inferOption,j as inferSourceMapOption};
@@ -1,3 +1,3 @@
1
- var Y=Object.defineProperty;var N=(e,t)=>Y(e,"name",{value:t,configurable:!0});import{createFilter as ee}from"@rollup/pluginutils";import{createRollupLogger as se}from"@visulima/packem-share/utils";import{dirname as L,normalize as M,isAbsolute as te,relative as U,resolve as oe,parse as T,join as _,basename as V}from"@visulima/path";import{isRelative as ie}from"@visulima/path/utils";import re from"p-queue";import ne from"./concat-BbvpVPBg.mjs";import{inferSourceMapOption as ae,inferModeOption as ce,inferHandlerOption as W,inferOption as G,ensurePCSSOption as R,ensurePCSSPlugins as le}from"./inferModeOption-DYyLMRb2.mjs";import{m as q}from"./sourcemap-DGfgaUBb.mjs";var ue=Object.defineProperty,de=N((e,t)=>ue(e,"name",{value:t,configurable:!0}),"r");const J=de((e,t)=>{if(!t)return!1;if(typeof t=="function")return t(e);if(typeof t.test=="function")return t.test(e);throw new Error("Invalid condition type")},"matchFile");var pe=Object.defineProperty,fe=N((e,t)=>pe(e,"name",{value:t,configurable:!0}),"a");const me=4,ge=process.env.UV_THREADPOOL_SIZE?Number.parseInt(process.env.UV_THREADPOOL_SIZE,10):me;class he{static{N(this,"c")}static{fe(this,"LoaderManager")}test;loaders=new Map;options;workQueue;logger;constructor({extensions:t,loaders:c,logger:y,options:O}){this.test=S=>t.some(g=>S.toLowerCase().endsWith(g)),c.length>0&&this.add(...c),this.options=O,this.logger=y}add(...t){for(const c of t)this.loaders.has(c.name)||this.loaders.set(c.name,c)}isSupported(t){if(this.test(t))return!0;for(const[,c]of this.loaders)if(J(t,c.test))return!0;return!1}async process(t,c){this.workQueue||(this.workQueue=new re({concurrency:ge-1}));for await(const[y,O]of this.loaders){const S={...c,options:this.options[y]??{}};if(O.alwaysProcess||J(S.id,O.test)){this.logger.debug({message:`Processing ${y} loader for ${S.id}`,plugin:"css"});try{const g=await this.workQueue.add(O.process.bind(S,t));g&&(t=g,this.logger.debug({message:`Completed ${y} loader for ${S.id}`,outputSize:g.code?.length||0,plugin:"css"}))}catch(g){throw this.logger.error({file:S.id,loader:y,message:`Error in ${y} loader for ${S.id}: ${g instanceof Error?g.message:String(g)}`,plugin:"css"}),g}}}return t}}var xe=Object.defineProperty,z=N((e,t)=>xe(e,"name",{value:t,configurable:!0}),"b");const ye=z(async(e,t)=>e.sort((c,y)=>t.indexOf(c.name)-t.indexOf(y.name)),"sortByNameOrder"),Fe=z(async(e,t,c,y,O,S,g,Z,K)=>{const C={...K,...e.alias},B=ee(e.include,e.exclude),b=ae(e.sourceMap),i={...ce(e.mode),autoModules:e.autoModules??!1,dts:e.dts,extensions:e.extensions,namedExports:e.namedExports};let a,I,H=!1;if(e.loaders)for(const r of e.loaders)r.name==="postcss"&&(H=!0);else e.loaders=[];H&&(i.postcss={...e.postcss,config:G(e.postcss?.config,{}),import:W(e.postcss?.import,C),modules:G(e.postcss?.modules,void 0),to:e.postcss?.to,url:W(e.postcss?.url,C)});let E=[];const F=z((r,u)=>{const m=[];for(const o of Object.keys(r)){const d=new Set;let h=[o];do{const $=[];for(const f of h){if(d.has(f))continue;if(I.isSupported(f)){B(f)&&$.push(f);continue}d.add(f);const P=u(f);P&&$.push(...P.importedIds)}h=$}while(h.some($=>!I.isSupported($)));m.push(...h)}return m},"traverseImportedModules");return{augmentChunkHash(r){if(E.length===0)return;const u=F(r.modules,this.getModuleInfo),m=E.filter(o=>u.includes(o.id)).sort((o,d)=>u.lastIndexOf(o.id)-u.lastIndexOf(d.id)).map(o=>`${V(o.id)}:${o.css}`);if(m.length!==0)return m.join(":")},async buildStart(){a=se(this,"css"),H&&i.postcss&&(e.postcss?.parser&&(i.postcss.parser=await R(e.postcss.parser,"parser",c,a)),e.postcss?.syntax&&(i.postcss.syntax=await R(e.postcss.syntax,"syntax",c,a)),e.postcss?.stringifier&&(i.postcss.stringifier=await R(e.postcss.stringifier,"stringifier",c,a)),e.postcss?.plugins&&(i.postcss.plugins=await le(e.postcss.plugins,c,a))),I=new he({extensions:i.extensions,loaders:await ye(e.loaders||[],["sourcemap","stylus","less","sass","postcss"]),logger:a,options:{...e,...i,alias:C}}),a.info({extract:typeof i.extract=="string"?i.extract:"individual",loaders:e.loaders?.map(r=>r.name)||[],message:"CSS plugin initialized",minify:!!(Z&&e.minifier),namedExports:!!i.namedExports,plugin:"css",sourceMap:!!S}),typeof i.inject=="object"&&i.inject.treeshakeable&&(i.namedExports=!1,a.info({message:"Disabling named exports due to `inject.treeshakeable` option",plugin:"css"}))},async generateBundle(r,u){if(E.length===0||!(r.dir||r.file))return;const m=Object.values(u),o=r.dir??L(r.file),d=m.filter(n=>n.type==="chunk"),h=d.filter(n=>!n.facadeModuleId),$=r.preserveModules?d:d.filter(n=>n.isEntry||n.isDynamicEntry),f=[],P=z(async(n,l)=>{const s=typeof i.extract=="string"?M(i.extract).replace(/^\.[/\\]/,""):M(`${n}.css`);te(s)&&this.error(["Extraction path must be relative to the output directory,",`which is ${U(c,o)}`].join(`
1
+ var Y=Object.defineProperty;var N=(e,t)=>Y(e,"name",{value:t,configurable:!0});import{createFilter as ee}from"@rollup/pluginutils";import{createRollupLogger as se}from"@visulima/packem-share/utils";import{dirname as L,normalize as M,isAbsolute as te,relative as U,resolve as oe,parse as T,join as _,basename as V}from"@visulima/path";import{isRelative as ie}from"@visulima/path/utils";import re from"p-queue";import ne from"./concat-BbvpVPBg.mjs";import{inferSourceMapOption as ae,inferModeOption as ce,inferHandlerOption as W,inferOption as G,ensurePCSSOption as R,ensurePCSSPlugins as le}from"./inferModeOption-BWjmFhVF.mjs";import{m as q}from"./sourcemap-DGfgaUBb.mjs";var ue=Object.defineProperty,de=N((e,t)=>ue(e,"name",{value:t,configurable:!0}),"r");const J=de((e,t)=>{if(!t)return!1;if(typeof t=="function")return t(e);if(typeof t.test=="function")return t.test(e);throw new Error("Invalid condition type")},"matchFile");var pe=Object.defineProperty,fe=N((e,t)=>pe(e,"name",{value:t,configurable:!0}),"a");const me=4,ge=process.env.UV_THREADPOOL_SIZE?Number.parseInt(process.env.UV_THREADPOOL_SIZE,10):me;class he{static{N(this,"c")}static{fe(this,"LoaderManager")}test;loaders=new Map;options;workQueue;logger;constructor({extensions:t,loaders:c,logger:y,options:O}){this.test=S=>t.some(g=>S.toLowerCase().endsWith(g)),c.length>0&&this.add(...c),this.options=O,this.logger=y}add(...t){for(const c of t)this.loaders.has(c.name)||this.loaders.set(c.name,c)}isSupported(t){if(this.test(t))return!0;for(const[,c]of this.loaders)if(J(t,c.test))return!0;return!1}async process(t,c){this.workQueue||(this.workQueue=new re({concurrency:ge-1}));for await(const[y,O]of this.loaders){const S={...c,options:this.options[y]??{}};if(O.alwaysProcess||J(S.id,O.test)){this.logger.debug({message:`Processing ${y} loader for ${S.id}`,plugin:"css"});try{const g=await this.workQueue.add(O.process.bind(S,t));g&&(t=g,this.logger.debug({message:`Completed ${y} loader for ${S.id}`,outputSize:g.code?.length||0,plugin:"css"}))}catch(g){throw this.logger.error({file:S.id,loader:y,message:`Error in ${y} loader for ${S.id}: ${g instanceof Error?g.message:String(g)}`,plugin:"css"}),g}}}return t}}var xe=Object.defineProperty,z=N((e,t)=>xe(e,"name",{value:t,configurable:!0}),"b");const ye=z(async(e,t)=>e.sort((c,y)=>t.indexOf(c.name)-t.indexOf(y.name)),"sortByNameOrder"),Fe=z(async(e,t,c,y,O,S,g,Z,K)=>{const C={...K,...e.alias},B=ee(e.include,e.exclude),b=ae(e.sourceMap),i={...ce(e.mode),autoModules:e.autoModules??!1,dts:e.dts,extensions:e.extensions,namedExports:e.namedExports};let a,I,H=!1;if(e.loaders)for(const r of e.loaders)r.name==="postcss"&&(H=!0);else e.loaders=[];H&&(i.postcss={...e.postcss,config:G(e.postcss?.config,{}),import:W(e.postcss?.import,C),modules:G(e.postcss?.modules,void 0),to:e.postcss?.to,url:W(e.postcss?.url,C)});let E=[];const F=z((r,u)=>{const m=[];for(const o of Object.keys(r)){const d=new Set;let h=[o];do{const $=[];for(const f of h){if(d.has(f))continue;if(I.isSupported(f)){B(f)&&$.push(f);continue}d.add(f);const P=u(f);P&&$.push(...P.importedIds)}h=$}while(h.some($=>!I.isSupported($)));m.push(...h)}return m},"traverseImportedModules");return{augmentChunkHash(r){if(E.length===0)return;const u=F(r.modules,this.getModuleInfo),m=E.filter(o=>u.includes(o.id)).sort((o,d)=>u.lastIndexOf(o.id)-u.lastIndexOf(d.id)).map(o=>`${V(o.id)}:${o.css}`);if(m.length!==0)return m.join(":")},async buildStart(){a=se(this,"css"),H&&i.postcss&&(e.postcss?.parser&&(i.postcss.parser=await R(e.postcss.parser,"parser",c,a)),e.postcss?.syntax&&(i.postcss.syntax=await R(e.postcss.syntax,"syntax",c,a)),e.postcss?.stringifier&&(i.postcss.stringifier=await R(e.postcss.stringifier,"stringifier",c,a)),e.postcss?.plugins&&(i.postcss.plugins=await le(e.postcss.plugins,c,a))),I=new he({extensions:i.extensions,loaders:await ye(e.loaders||[],["sourcemap","stylus","less","sass","postcss"]),logger:a,options:{...e,...i,alias:C}}),a.info({extract:typeof i.extract=="string"?i.extract:"individual",loaders:e.loaders?.map(r=>r.name)||[],message:"CSS plugin initialized",minify:!!(Z&&e.minifier),namedExports:!!i.namedExports,plugin:"css",sourceMap:!!S}),typeof i.inject=="object"&&i.inject.treeshakeable&&(i.namedExports=!1,a.info({message:"Disabling named exports due to `inject.treeshakeable` option",plugin:"css"}))},async generateBundle(r,u){if(E.length===0||!(r.dir||r.file))return;const m=Object.values(u),o=r.dir??L(r.file),d=m.filter(n=>n.type==="chunk"),h=d.filter(n=>!n.facadeModuleId),$=r.preserveModules?d:d.filter(n=>n.isEntry||n.isDynamicEntry),f=[],P=z(async(n,l)=>{const s=typeof i.extract=="string"?M(i.extract).replace(/^\.[/\\]/,""):M(`${n}.css`);te(s)&&this.error(["Extraction path must be relative to the output directory,",`which is ${U(c,o)}`].join(`
2
2
  `)),ie(s)&&this.error(["Extraction path must be nested inside output directory,",`which is ${U(c,o)}`].join(`
3
- `));const w=E.filter(x=>l.includes(x.id)).sort((x,v)=>l.lastIndexOf(x.id)-l.lastIndexOf(v.id)),D=await ne(w);return{css:D.css,map:q(D.map.toString()).relative(L(oe(o,s))).toString(),name:s}},"getExtractedData"),A=z(n=>{if(r.file)return T(r.file).name;if(r.preserveModules){const{dir:l,name:s}=T(n.fileName);return l?_(l,s):s}return n.name},"getName"),k=[];if(typeof i.extract=="string"){a.debug({message:`Extracting to ${i.extract}`,prefix:"css"});const n=[];for(const s of h){const w=F(s.modules,this.getModuleInfo);k.push(...w),n.push(...w)}for(const s of $)n.push(...F(s.modules,this.getModuleInfo).filter(w=>!k.includes(w)));const l=A(d[0]);f.push([l,n])}else{a.debug({message:"Extracting to individual files",prefix:"css"});for(const n of h){const l=F(n.modules,this.getModuleInfo);if(l.length===0)continue;k.push(...l);const s=A(n);f.push([s,l])}for(const n of $){const l=F(n.modules,this.getModuleInfo).filter(w=>!k.includes(w));if(l.length===0)continue;const s=A(n);f.push([s,l])}}for await(const[n,l]of f){const s=await P(n,l);if(typeof e.onExtract=="function"&&!e.onExtract(s))continue;if(Z&&e.minifier){a.info({message:`Minifying ${s.name} with ${e.minifier.name}`,prefix:"css"});const{css:x,map:v}=await e.minifier.handler.bind({browserTargets:t,logger:a})(s,b,e[e.minifier.name]??{});s.css=x,s.map=v}const w={fileName:s.name,name:s.name,names:[s.name],originalFileName:s.name,originalFileNames:[s.name],source:s.css,type:"asset"},D=this.emitFile(w);if(a.info({chunkIds:l.length,hasSourceMap:!!(s.map&&b),message:`Emitted CSS file: ${s.name}`,plugin:"css",size:s.css.length}),s.map&&b){const x=this.getFileName(D);let v="assert";typeof r.assetFileNames=="string"?v=M(L(r.assetFileNames)):typeof r.assetFileNames=="function"&&(v=M(L(r.assetFileNames(w))));const j=q(s.map).modify(p=>(p.file=V(x),p)).modifySources(p=>{if(p==="<no source>"||v.length<=1)return p;p=`../${p}`;for(const Q of v)Q==="/"&&(p=`../${p}`);return p});if(b.inline)j.modify(p=>b.transform?.(p,M(_(o,x)))),u[x].source+=j.toCommentData(),a.debug({message:`Generated inline source map for ${x}`,plugin:"css"});else{const p=`${x}.map`;j.modify(X=>b.transform?.(X,M(_(o,p)))),this.emitFile({fileName:p,source:j.toString(),type:"asset"});const{base:Q}=T(p);u[x].source+=j.toCommentFile(Q),a.debug({message:`Generated external source map: ${p}`,plugin:"css"})}}}f.length>0&&a.info({filesEmitted:f.length,message:"CSS processing complete",plugin:"css",totalExtracted:E.length,totalSize:f.reduce((n,[,l])=>n+l.length,0)})},name:"rollup-plugin-css",async transform(r,u){if(!B(u)||!I.isSupported(u))return;if(r.replaceAll(/\s/g,"")===""){a.debug({message:`Skipping empty file: ${u}`,plugin:"css"});return}a.info({message:`Processing CSS file: ${u}`,plugin:"css",size:r.length}),typeof e.onImport=="function"&&e.onImport(r,u);const m={alias:C,assets:new Map,autoModules:i.autoModules,browserTargets:t,cwd:c,debug:g,deps:new Set,dts:i.dts,emit:i.emit,environment:O,extensions:i.extensions,extract:i.extract,id:u,inject:i.inject,logger:a,namedExports:i.namedExports,options:{},plugin:this,sourceDir:y,sourceMap:b,useSourcemap:S},o=await I.process({code:r},m);a.info({assets:m.assets.size,dependencies:m.deps.size,hasExtracted:!!o.extracted,message:`Processed ${u}`,outputSize:o.code.length,plugin:"css"});for(const d of m.deps)this.addWatchFile(d);for(const[d,h]of m.assets)this.emitFile({fileName:d,source:h,type:"asset"}),a.debug({message:`Emitted asset: ${d}`,plugin:"css",size:h.length});if(o.extracted){const{id:d}=o.extracted;E=E.filter(h=>h.id!==d),E.push(o.extracted),a.debug({cssSize:o.extracted.css.length,hasSourceMap:!!o.extracted.map,message:`Extracted CSS from ${d}`,plugin:"css"})}return{code:o.code,map:b&&o.map?o.map:{mappings:""},meta:{styles:o.meta},moduleSideEffects:o.extracted?!0:void 0}}}},"cssPlugin");export{Fe as default};
3
+ `));const w=E.filter(x=>l.includes(x.id)).sort((x,v)=>l.lastIndexOf(x.id)-l.lastIndexOf(v.id)),D=await ne(w);return{css:D.css,map:q(D.map.toString()).relative(L(oe(o,s))).toString(),name:s}},"getExtractedData"),A=z(n=>{if(r.file)return T(r.file).name;if(r.preserveModules){const{dir:l,name:s}=T(n.fileName);return l?_(l,s):s}return n.name},"getName"),k=[];if(typeof i.extract=="string"){a.debug({message:`Extracting to ${i.extract}`,prefix:"css"});const n=[];for(const s of h){const w=F(s.modules,this.getModuleInfo);k.push(...w),n.push(...w)}for(const s of $)n.push(...F(s.modules,this.getModuleInfo).filter(w=>!k.includes(w)));const l=A(d[0]);f.push([l,n])}else{a.debug({message:"Extracting to individual files",prefix:"css"});for(const n of h){const l=F(n.modules,this.getModuleInfo);if(l.length===0)continue;k.push(...l);const s=A(n);f.push([s,l])}for(const n of $){const l=F(n.modules,this.getModuleInfo).filter(w=>!k.includes(w));if(l.length===0)continue;const s=A(n);f.push([s,l])}}for await(const[n,l]of f){const s=await P(n,l);if(typeof e.onExtract=="function"&&!e.onExtract(s))continue;if(Z&&e.minifier){a.info({message:`Minifying ${s.name} with ${e.minifier.name}`,prefix:"css"});const{css:x,map:v}=await e.minifier.handler.bind({browserTargets:t,logger:a})(s,b,e[e.minifier.name]??{});s.css=x,s.map=v}const w={fileName:s.name,name:s.name,names:[s.name],originalFileName:s.name,originalFileNames:[s.name],source:s.css,type:"asset"},D=this.emitFile(w);if(a.info({chunkIds:l.length,hasSourceMap:!!(s.map&&b),message:`Emitted CSS file: ${s.name}`,plugin:"css",size:s.css.length}),s.map&&b){const x=this.getFileName(D);let v="assert";typeof r.assetFileNames=="string"?v=M(L(r.assetFileNames)):typeof r.assetFileNames=="function"&&(v=M(L(r.assetFileNames(w))));const j=q(s.map).modify(p=>(p.file=V(x),p)).modifySources(p=>{if(p==="<no source>"||v.length<=1)return p;p=`../${p}`;for(const Q of v)Q==="/"&&(p=`../${p}`);return p});if(b.inline)j.modify(p=>b.transform?.(p,M(_(o,x)))),u[x].source+=j.toCommentData(),a.debug({message:`Generated inline source map for ${x}`,plugin:"css"});else{const p=`${x}.map`;j.modify(X=>b.transform?.(X,M(_(o,p)))),this.emitFile({fileName:p,source:j.toString(),type:"asset"});const{base:Q}=T(p);u[x].source+=j.toCommentFile(Q),a.debug({message:`Generated external source map: ${p}`,plugin:"css"})}}}f.length>0&&a.info({filesEmitted:f.length,message:"CSS processing complete",plugin:"css",totalExtracted:E.length,totalSize:f.reduce((n,[,l])=>n+l.length,0)})},name:"rollup-plugin-css",async transform(r,u){if(!B(u)||!I.isSupported(u))return;if(r.replaceAll(/\s/g,"")===""){a.debug({message:`Skipping empty file: ${u}`,plugin:"css"});return}a.info({message:`Processing CSS file: ${u}`,plugin:"css",size:r.length}),typeof e.onImport=="function"&&e.onImport(r,u);const m={alias:C,assets:new Map,autoModules:i.autoModules,browserTargets:t,cwd:c,debug:g,deps:new Set,dts:i.dts,emit:i.emit,environment:O,extensions:i.extensions,extract:i.extract,id:u,inject:i.inject,inline:i.inline,logger:a,namedExports:i.namedExports,options:{},plugin:this,sourceDir:y,sourceMap:b,useSourcemap:S},o=await I.process({code:r},m);a.info({assets:m.assets.size,dependencies:m.deps.size,hasExtracted:!!o.extracted,message:`Processed ${u}`,outputSize:o.code.length,plugin:"css"});for(const d of m.deps)this.addWatchFile(d);for(const[d,h]of m.assets)this.emitFile({fileName:d,source:h,type:"asset"}),a.debug({message:`Emitted asset: ${d}`,plugin:"css",size:h.length});if(o.extracted){const{id:d}=o.extracted;E=E.filter(h=>h.id!==d),E.push(o.extracted),a.debug({cssSize:o.extracted.css.length,hasSourceMap:!!o.extracted.map,message:`Extracted CSS from ${d}`,plugin:"css"})}return{code:o.code,map:b&&o.map?o.map:{mappings:""},meta:{styles:o.meta},moduleSideEffects:o.extracted?!0:void 0}}}},"cssPlugin");export{Fe as default};
@@ -90,6 +90,7 @@ interface LoaderContext<T = Record<string, unknown>> {
90
90
  readonly extract: InternalStyleOptions["extract"];
91
91
  readonly id: string;
92
92
  readonly inject: InternalStyleOptions["inject"];
93
+ readonly inline: InternalStyleOptions["inline"];
93
94
  readonly logger: RollupLogger;
94
95
  readonly namedExports: InternalStyleOptions["namedExports"];
95
96
  readonly options: T;
@@ -130,6 +131,8 @@ interface ExtractedData {
130
131
  interface InjectOptions {
131
132
  attributes?: Record<string, string>;
132
133
  container?: string;
134
+ method?: string;
135
+ package?: string;
133
136
  prepend?: boolean;
134
137
  singleTag?: boolean;
135
138
  treeshakeable?: boolean;
@@ -139,6 +142,7 @@ interface InternalStyleOptions extends StyleOptions {
139
142
  extensions: NonNullable<StyleOptions["extensions"]>;
140
143
  extract: boolean | string;
141
144
  inject: InjectOptions | boolean | ((varname: string, id: string, output: string[]) => string);
145
+ inline: boolean;
142
146
  }
143
147
  type LightningCSSOptions = Omit<TransformOptions<CustomAtRules>, "code" | "cssModules" | "filename" | "minify" | "targets"> & {
144
148
  modules?: TransformOptions<CustomAtRules>["cssModules"] & {
@@ -172,7 +176,7 @@ interface StyleOptions {
172
176
  lightningcss?: LightningCSSOptions;
173
177
  loaders?: Loader[];
174
178
  minifier?: Minifier;
175
- mode?: "emit" | "extract" | "inject" | ["extract", string] | ["inject", InjectOptions | ((varname: string, id: string) => string)];
179
+ mode?: "emit" | "extract" | "inject" | "inline" | ["extract", string] | ["inject", InjectOptions | ((varname: string, id: string) => string)];
176
180
  namedExports?: boolean | ((name: string) => string);
177
181
  onExtract?: (data: ExtractedData) => boolean;
178
182
  onImport?: (code: string, id: string) => void;
@@ -90,6 +90,7 @@ interface LoaderContext<T = Record<string, unknown>> {
90
90
  readonly extract: InternalStyleOptions["extract"];
91
91
  readonly id: string;
92
92
  readonly inject: InternalStyleOptions["inject"];
93
+ readonly inline: InternalStyleOptions["inline"];
93
94
  readonly logger: RollupLogger;
94
95
  readonly namedExports: InternalStyleOptions["namedExports"];
95
96
  readonly options: T;
@@ -130,6 +131,8 @@ interface ExtractedData {
130
131
  interface InjectOptions {
131
132
  attributes?: Record<string, string>;
132
133
  container?: string;
134
+ method?: string;
135
+ package?: string;
133
136
  prepend?: boolean;
134
137
  singleTag?: boolean;
135
138
  treeshakeable?: boolean;
@@ -139,6 +142,7 @@ interface InternalStyleOptions extends StyleOptions {
139
142
  extensions: NonNullable<StyleOptions["extensions"]>;
140
143
  extract: boolean | string;
141
144
  inject: InjectOptions | boolean | ((varname: string, id: string, output: string[]) => string);
145
+ inline: boolean;
142
146
  }
143
147
  type LightningCSSOptions = Omit<TransformOptions<CustomAtRules>, "code" | "cssModules" | "filename" | "minify" | "targets"> & {
144
148
  modules?: TransformOptions<CustomAtRules>["cssModules"] & {
@@ -172,7 +176,7 @@ interface StyleOptions {
172
176
  lightningcss?: LightningCSSOptions;
173
177
  loaders?: Loader[];
174
178
  minifier?: Minifier;
175
- mode?: "emit" | "extract" | "inject" | ["extract", string] | ["inject", InjectOptions | ((varname: string, id: string) => string)];
179
+ mode?: "emit" | "extract" | "inject" | "inline" | ["extract", string] | ["inject", InjectOptions | ((varname: string, id: string) => string)];
176
180
  namedExports?: boolean | ((name: string) => string);
177
181
  onExtract?: (data: ExtractedData) => boolean;
178
182
  onImport?: (code: string, id: string) => void;
@@ -1,5 +1,5 @@
1
1
  import { SourceMapGenerator, RawSourceMap, SourceMapConsumer } from 'source-map-js';
2
- import { h as Extracted, b as PostCSSOptions, S as StyleOptions, a as InternalStyleOptions, i as LoaderContext } from '../packem_shared/types-BS4hXME3.mjs';
2
+ import { h as Extracted, b as PostCSSOptions, S as StyleOptions, a as InternalStyleOptions, i as LoaderContext } from '../packem_shared/types-CA9pSumu.mjs';
3
3
  import { RollupLogger } from '@visulima/packem-share/utils';
4
4
  import { Result } from 'postcss-load-config';
5
5
  import { NapiResolveOptions } from 'oxc-resolver';
@@ -27,16 +27,18 @@ interface Mode {
27
27
  emit: InternalStyleOptions["emit"];
28
28
  extract: InternalStyleOptions["extract"];
29
29
  inject: InternalStyleOptions["inject"];
30
+ inline: InternalStyleOptions["inline"];
30
31
  }
31
32
  type PCSSOption = "parser" | "plugin" | "stringifier" | "syntax";
32
33
  declare const inferModeOption: (mode: StyleOptions["mode"]) => Mode;
33
- declare const inferOption: <T, TDefine extends T | boolean | undefined>(option: T | boolean | undefined, defaultValue: TDefine) => T | TDefine | false;
34
+ declare const inferOption: <T, TDefine extends T | boolean | undefined>(option: T | boolean | undefined, defaultValue: TDefine) => OptionType<T, TDefine>;
34
35
  declare const inferSourceMapOption: (sourceMap: StyleOptions["sourceMap"]) => LoaderContext["sourceMap"];
35
36
  declare const inferHandlerOption: <T extends {
36
37
  alias?: Record<string, string>;
37
38
  }>(option: T | boolean | undefined, alias: T["alias"]) => T | false;
38
39
  declare const ensurePCSSOption: <T>(option: T | string, type: PCSSOption, cwd: string, logger: RollupLogger) => Promise<T>;
39
40
  declare const ensurePCSSPlugins: (plugins: PostCSSOptions["plugins"], cwd: string, logger: RollupLogger) => Promise<Result["plugins"]>;
41
+ type OptionType<T, TDefine extends T | boolean | undefined> = T | TDefine | false;
40
42
 
41
43
  declare const resolve: (ids: string[], userOptions: ResolveOptions) => string;
42
44
  interface ResolveOptions extends NapiResolveOptions {
@@ -1,5 +1,5 @@
1
1
  import { SourceMapGenerator, RawSourceMap, SourceMapConsumer } from 'source-map-js';
2
- import { h as Extracted, b as PostCSSOptions, S as StyleOptions, a as InternalStyleOptions, i as LoaderContext } from '../packem_shared/types-BS4hXME3.js';
2
+ import { h as Extracted, b as PostCSSOptions, S as StyleOptions, a as InternalStyleOptions, i as LoaderContext } from '../packem_shared/types-CA9pSumu.js';
3
3
  import { RollupLogger } from '@visulima/packem-share/utils';
4
4
  import { Result } from 'postcss-load-config';
5
5
  import { NapiResolveOptions } from 'oxc-resolver';
@@ -27,16 +27,18 @@ interface Mode {
27
27
  emit: InternalStyleOptions["emit"];
28
28
  extract: InternalStyleOptions["extract"];
29
29
  inject: InternalStyleOptions["inject"];
30
+ inline: InternalStyleOptions["inline"];
30
31
  }
31
32
  type PCSSOption = "parser" | "plugin" | "stringifier" | "syntax";
32
33
  declare const inferModeOption: (mode: StyleOptions["mode"]) => Mode;
33
- declare const inferOption: <T, TDefine extends T | boolean | undefined>(option: T | boolean | undefined, defaultValue: TDefine) => T | TDefine | false;
34
+ declare const inferOption: <T, TDefine extends T | boolean | undefined>(option: T | boolean | undefined, defaultValue: TDefine) => OptionType<T, TDefine>;
34
35
  declare const inferSourceMapOption: (sourceMap: StyleOptions["sourceMap"]) => LoaderContext["sourceMap"];
35
36
  declare const inferHandlerOption: <T extends {
36
37
  alias?: Record<string, string>;
37
38
  }>(option: T | boolean | undefined, alias: T["alias"]) => T | false;
38
39
  declare const ensurePCSSOption: <T>(option: T | string, type: PCSSOption, cwd: string, logger: RollupLogger) => Promise<T>;
39
40
  declare const ensurePCSSPlugins: (plugins: PostCSSOptions["plugins"], cwd: string, logger: RollupLogger) => Promise<Result["plugins"]>;
41
+ type OptionType<T, TDefine extends T | boolean | undefined> = T | TDefine | false;
40
42
 
41
43
  declare const resolve: (ids: string[], userOptions: ResolveOptions) => string;
42
44
  interface ResolveOptions extends NapiResolveOptions {
@@ -1 +1 @@
1
- import{default as o}from"../packem_shared/arrayFmt-Dek5cB7m.mjs";import{default as t}from"../packem_shared/concat-BbvpVPBg.mjs";import{default as p}from"../packem_shared/loadModule-CovDETwT.mjs";import{ensurePCSSOption as n,ensurePCSSPlugins as s,inferHandlerOption as l,inferModeOption as m,inferOption as d,inferSourceMapOption as u}from"../packem_shared/inferModeOption-DYyLMRb2.mjs";import{resolve as M}from"../packem_shared/resolve-nqhcPNJ9.mjs";import{default as S}from"../packem_shared/safeId-BN5akJYJ.mjs";import{g,m as P,s as C}from"../packem_shared/sourcemap-DGfgaUBb.mjs";import{getUrlOfPartial as h,hasModuleSpecifier as v,normalizeUrl as y}from"../packem_shared/hasModuleSpecifier-DIZeev_W.mjs";export{o as arrayFmt,t as concat,n as ensurePCSSOption,s as ensurePCSSPlugins,g as getMap,h as getUrlOfPartial,v as hasModuleSpecifier,l as inferHandlerOption,m as inferModeOption,d as inferOption,u as inferSourceMapOption,p as loadModule,P as mm,y as normalizeUrl,M as resolve,S as safeId,C as stripMap};
1
+ import{default as o}from"../packem_shared/arrayFmt-Dek5cB7m.mjs";import{default as t}from"../packem_shared/concat-BbvpVPBg.mjs";import{default as p}from"../packem_shared/loadModule-CovDETwT.mjs";import{ensurePCSSOption as n,ensurePCSSPlugins as s,inferHandlerOption as l,inferModeOption as m,inferOption as d,inferSourceMapOption as u}from"../packem_shared/inferModeOption-BWjmFhVF.mjs";import{resolve as M}from"../packem_shared/resolve-nqhcPNJ9.mjs";import{default as S}from"../packem_shared/safeId-BN5akJYJ.mjs";import{g,m as P,s as C}from"../packem_shared/sourcemap-DGfgaUBb.mjs";import{getUrlOfPartial as h,hasModuleSpecifier as v,normalizeUrl as y}from"../packem_shared/hasModuleSpecifier-DIZeev_W.mjs";export{o as arrayFmt,t as concat,n as ensurePCSSOption,s as ensurePCSSPlugins,g as getMap,h as getUrlOfPartial,v as hasModuleSpecifier,l as inferHandlerOption,m as inferModeOption,d as inferOption,u as inferSourceMapOption,p as loadModule,P as mm,y as normalizeUrl,M as resolve,S as safeId,C as stripMap};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/rollup-plugin-css",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.2",
4
4
  "description": "CSS processing plugin for packem",
5
5
  "keywords": [
6
6
  "visulima",
@@ -1,14 +0,0 @@
1
- var z=Object.defineProperty;var k=(r,s)=>z(r,"name",{value:s,configurable:!0});import{basename as A,relative as _}from"@visulima/path";import P from"./safeId-BN5akJYJ.mjs";var R=Object.defineProperty,v=k((r,s)=>R(r,"name",{value:s,configurable:!0}),"$");const c="css",q=new Set(["abstract","arguments","await","boolean","break","byte","case","catch","char","class","const","continue",c,"debugger","default","delete","do","double","else","enum","eval","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with","yield"]),F=v(r=>{const s=r.replaceAll(/[^\w$]/g,"_");return q.has(s)?`_${s}`:s},"getClassNameDefault"),L=v(({css:r,cwd:s,dts:$=!1,emit:N=!1,extract:D=!1,icssDependencies:b=[],id:l,inject:o,logger:w,map:g,modulesExports:n,namedExports:m,supportModules:y})=>{const x=v(t=>P(t,A(l)),"saferId"),f=x("modules"),e=[`var ${c} = ${JSON.stringify(r)};`],a=[],S=[c];if(m){$&&a.push(`declare const ${c}: string;`);const t=typeof m=="function"?m:F;for(const[p,h]of Object.entries(n)){const i=t(p);if(p!==i&&w){const d=s?_(s,l):l;w.warn({message:`Exported \`${p}\` as \`${i}\` in ${d}`})}const u=JSON.stringify(h);e.push(`var ${i} = ${u};`),$&&a.push(`declare const ${i}: ${u};`),S.push(i)}}if(o)if(typeof o=="function")e.push(o(c,l,e),`var ${f} = ${JSON.stringify(n)};`);else{const{treeshakeable:t,...p}=typeof o=="object"?o:{},h=x("injector"),i=`${h}(${c},${JSON.stringify(p)});`;if(e.unshift(`import { cssStyleInject as ${h} } from "@visulima/css-style-inject";`),t||e.push(`var ${f} = ${JSON.stringify(n)};`,i),t){e.push("var injected = false;");const u=`if (!injected) { injected = true; ${i} }`;if(n.inject)throw new Error("`inject` keyword is reserved when using `inject.treeshakeable` option");let d="";for(const[B,C]of Object.entries(n)){const M=JSON.stringify(B),I=JSON.stringify(C);d+=`get ${M}() { ${u} return ${I}; },
2
- `}d+=`inject: function inject() { ${u} },`,e.push(`var ${f} = {${d}};`)}}!o&&Object.keys(n).length>0&&e.push(`var ${f} = ${JSON.stringify(n)};`);const O=`
3
- export default ${y?f:c};
4
- `;if(e.push(O),$&&(y&&a.push(`
5
- interface ModulesExports {
6
- ${Object.keys(n).map(t=>` '${t}': string;`).join(`
7
- `)}
8
- }
9
- `,typeof o=="object"&&o.treeshakeable?"interface ModulesExports {inject:()=>void}":"",`declare const ${f}: ModulesExports;`),a.push(O)),m){const t=`export {
10
- ${S.filter(Boolean).join(`,
11
- `)}
12
- };`;e.push(t),$&&a.push(t)}const j=e.filter(Boolean).join(`
13
- `),E=a.length>0?a.filter(Boolean).join(`
14
- `):void 0;if(N)return{code:r,map:g,meta:{icssDependencies:b,moduleContents:j,types:void 0},moduleSideEffects:!0};let J;return D&&(J={css:r,id:l,map:g}),{code:j,extracted:J,map:g,meta:{icssDependencies:b,moduleContents:j,types:E},moduleSideEffects:y||typeof o=="object"&&o.treeshakeable?!1:"no-treeshake",types:E}},"generateJsExports");export{L as g};
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var c=(r,n)=>f(r,"name",{value:n,configurable:!0});import l from"./arrayFmt-Dek5cB7m.mjs";import d from"./loadModule-CovDETwT.mjs";var y=Object.defineProperty,o=c((r,n)=>y(r,"name",{value:n,configurable:!0}),"r");const p=["inject","extract","emit"],S=l(p),P=o(r=>{const n=Array.isArray(r)?r:[r];if(n[0]&&!p.includes(n[0]))throw new Error(`Incorrect mode provided, allowed modes are ${S}`);return{emit:n[0]==="emit",extract:n[0]==="extract"&&(n[1]??!0),inject:(!n[0]||n[0]==="inject")&&(n[1]??!0)}},"inferModeOption"),O=o((r,n)=>typeof r=="boolean"?r&&{}:typeof r=="object"?r:n,"inferOption"),b=o(r=>{const n=Array.isArray(r)?r:[r];return n[0]?{content:!0,...n[1],inline:n[0]==="inline"}:!1},"inferSourceMapOption"),h=o((r,n)=>{const t=O(r,{});return n&&typeof t=="object"&&!t.alias&&(t.alias=n),t},"inferHandlerOption"),a=o(async(r,n,t,e)=>{if(typeof r!="string")return r;const i=await d(r,t,e);if(!i)throw new Error(`Unable to load PostCSS ${n} \`${r}\``);return i},"ensurePCSSOption"),j=o(async(r,n,t)=>{if(r===void 0)return[];if(r.length===0)return[];const e=[];for await(const i of r.filter(Boolean)){if(!Array.isArray(i)){e.push(await a(i,"plugin",n,t));continue}const[s,u]=i;u?e.push((await a(s,"plugin",n,t))(u)):e.push(await a(s,"plugin",n,t))}return e},"ensurePCSSPlugins");export{a as ensurePCSSOption,j as ensurePCSSPlugins,h as inferHandlerOption,P as inferModeOption,O as inferOption,b as inferSourceMapOption};