@visulima/rollup-plugin-css 1.0.0-alpha.4 → 1.0.0-alpha.40

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 (122) hide show
  1. package/CHANGELOG.md +329 -0
  2. package/LICENSE.md +83 -79
  3. package/README.md +164 -146
  4. package/dist/css-modules-types.d.ts +38 -0
  5. package/dist/css-plugin.d.ts +44 -0
  6. package/dist/index.d.ts +40 -20
  7. package/dist/index.js +1 -0
  8. package/dist/loaders/less/importer.d.ts +2 -0
  9. package/dist/loaders/less/index.d.ts +37 -9
  10. package/dist/loaders/less/index.js +1 -0
  11. package/dist/loaders/less/types.d.ts +24 -0
  12. package/dist/loaders/lightningcss.d.ts +13 -16
  13. package/dist/loaders/lightningcss.js +3 -0
  14. package/dist/loaders/loader-manager.d.ts +78 -0
  15. package/dist/loaders/postcss/constants.d.ts +20 -0
  16. package/dist/loaders/postcss/icss/index.d.ts +8 -0
  17. package/dist/loaders/postcss/icss/load.d.ts +5 -0
  18. package/dist/loaders/postcss/icss/resolve.d.ts +6 -0
  19. package/dist/loaders/postcss/import/apply-conditions.d.ts +10 -0
  20. package/dist/loaders/postcss/import/apply-raws.d.ts +3 -0
  21. package/dist/loaders/postcss/import/apply-styles.d.ts +10 -0
  22. package/dist/loaders/postcss/import/constants.d.ts +12 -0
  23. package/dist/loaders/postcss/import/import-resolve.d.ts +3 -0
  24. package/dist/loaders/postcss/import/index.d.ts +12 -0
  25. package/dist/loaders/postcss/import/parser/parse-at-import.d.ts +9 -0
  26. package/dist/loaders/postcss/import/parser/parse-styles.d.ts +6 -0
  27. package/dist/loaders/postcss/import/parser/parse-stylesheet.d.ts +10 -0
  28. package/dist/loaders/postcss/import/types.d.ts +95 -0
  29. package/dist/loaders/postcss/import/utils/base64-encoded-import.d.ts +3 -0
  30. package/dist/loaders/postcss/import/utils/data-url.d.ts +2 -0
  31. package/dist/loaders/postcss/import/utils/format-import-prelude.d.ts +2 -0
  32. package/dist/loaders/postcss/import/utils/load-content.d.ts +2 -0
  33. package/dist/loaders/postcss/import/utils/process-content.d.ts +4 -0
  34. package/dist/loaders/postcss/import/utils/statement.d.ts +6 -0
  35. package/dist/loaders/postcss/index.d.ts +27 -16
  36. package/dist/loaders/postcss/index.js +6 -0
  37. package/dist/loaders/postcss/load-config.d.ts +6 -0
  38. package/dist/loaders/postcss/modules/generate.d.ts +11 -0
  39. package/dist/loaders/postcss/modules/index.d.ts +35 -0
  40. package/dist/loaders/postcss/noop.d.ts +22 -0
  41. package/dist/loaders/postcss/url/generate.d.ts +2 -0
  42. package/dist/loaders/postcss/url/index.d.ts +46 -0
  43. package/dist/loaders/postcss/url/inline.d.ts +20 -0
  44. package/dist/loaders/postcss/url/url-resolve.d.ts +12 -0
  45. package/dist/loaders/postcss/url/utils.d.ts +4 -0
  46. package/dist/loaders/sass/index.d.ts +5 -9
  47. package/dist/loaders/sass/{index.mjs → index.js} +5 -5
  48. package/dist/loaders/sass/modern/importer.d.ts +3 -0
  49. package/dist/loaders/sass/types.d.ts +20 -0
  50. package/dist/loaders/sass/utils/get-sass-compiler.d.ts +8 -0
  51. package/dist/loaders/sass/utils/get-sass-options.d.ts +7 -0
  52. package/dist/loaders/sass/utils/normalize-source-map.d.ts +3 -0
  53. package/dist/loaders/sass/utils/resolve-syntax.d.ts +2 -0
  54. package/dist/loaders/sass/utils/sass-error-factory.d.ts +15 -0
  55. package/dist/loaders/sourcemap.d.ts +24 -16
  56. package/dist/loaders/sourcemap.js +1 -0
  57. package/dist/loaders/stylus/index.d.ts +8 -9
  58. package/dist/loaders/stylus/index.js +2 -0
  59. package/dist/loaders/stylus/types.d.ts +87 -0
  60. package/dist/loaders/tailwindcss-oxide.d.ts +5 -16
  61. package/dist/loaders/tailwindcss-oxide.js +1 -0
  62. package/dist/loaders/types.d.ts +102 -0
  63. package/dist/loaders/utils/ensure-auto-modules.d.ts +39 -0
  64. package/dist/loaders/utils/match-file.d.ts +32 -0
  65. package/dist/minifiers/cssnano.d.ts +30 -16
  66. package/dist/minifiers/lightningcss.d.ts +29 -16
  67. package/dist/minifiers/types.d.ts +64 -0
  68. package/dist/packem_shared/concat-WcWAYbOc.js +3 -0
  69. package/dist/packem_shared/{cssModulesTypesPlugin-B9_bJo_B.mjs → cssModulesTypesPlugin-CjGroK2y.js} +1 -1
  70. package/dist/packem_shared/{generate-js-exports-Dqps7nWG.mjs → generate-js-exports-BhS4eLrN.js} +1 -1
  71. package/dist/packem_shared/getMap-TR-0DXUr.js +1 -0
  72. package/dist/packem_shared/inferModeOption-9h3Eq6JH.js +1 -0
  73. package/dist/packem_shared/loadModule-D20jQQNu.js +1 -0
  74. package/dist/packem_shared/resolve-anj9ucIq.js +1 -0
  75. package/dist/packem_shared/rollupCssPlugin-BxRedPmA.js +3 -0
  76. package/dist/packem_shared/{sourcemap-DGfgaUBb.mjs → sourcemap-CB6ochh0.js} +1 -1
  77. package/dist/types.d.ts +224 -0
  78. package/dist/utils/array-fmt.d.ts +18 -0
  79. package/dist/utils/concat.d.ts +34 -0
  80. package/dist/utils/generate-js-exports.d.ts +78 -0
  81. package/dist/utils/index.d.ts +9 -73
  82. package/dist/utils/index.js +1 -0
  83. package/dist/utils/load-module.d.ts +3 -0
  84. package/dist/utils/options.d.ts +155 -0
  85. package/dist/utils/resolve.d.ts +35 -0
  86. package/dist/utils/safe-id.d.ts +23 -0
  87. package/dist/utils/sourcemap.d.ts +42 -0
  88. package/dist/utils/url.d.ts +8 -0
  89. package/package.json +56 -41
  90. package/dist/index.d.mts +0 -20
  91. package/dist/index.mjs +0 -1
  92. package/dist/loaders/less/index.d.mts +0 -17
  93. package/dist/loaders/less/index.mjs +0 -1
  94. package/dist/loaders/lightningcss.d.mts +0 -17
  95. package/dist/loaders/lightningcss.mjs +0 -3
  96. package/dist/loaders/postcss/index.d.mts +0 -17
  97. package/dist/loaders/postcss/index.mjs +0 -6
  98. package/dist/loaders/sass/index.d.mts +0 -18
  99. package/dist/loaders/sourcemap.d.mts +0 -17
  100. package/dist/loaders/sourcemap.mjs +0 -1
  101. package/dist/loaders/stylus/index.d.mts +0 -17
  102. package/dist/loaders/stylus/index.mjs +0 -1
  103. package/dist/loaders/tailwindcss-oxide.d.mts +0 -17
  104. package/dist/loaders/tailwindcss-oxide.mjs +0 -1
  105. package/dist/minifiers/cssnano.d.mts +0 -17
  106. package/dist/minifiers/lightningcss.d.mts +0 -17
  107. package/dist/packem_shared/concat-BbvpVPBg.mjs +0 -3
  108. package/dist/packem_shared/getMap-BL5hKEnR.mjs +0 -1
  109. package/dist/packem_shared/inferModeOption-fAc592HP.mjs +0 -1
  110. package/dist/packem_shared/loadModule-CovDETwT.mjs +0 -1
  111. package/dist/packem_shared/resolve-nqhcPNJ9.mjs +0 -1
  112. package/dist/packem_shared/rollupCssPlugin-CJSS-7Mi.mjs +0 -3
  113. package/dist/packem_shared/types-CA9pSumu.d.mts +0 -189
  114. package/dist/packem_shared/types-CA9pSumu.d.ts +0 -189
  115. package/dist/utils/index.d.mts +0 -73
  116. package/dist/utils/index.mjs +0 -1
  117. /package/dist/minifiers/{cssnano.mjs → cssnano.js} +0 -0
  118. /package/dist/minifiers/{lightningcss.mjs → lightningcss.js} +0 -0
  119. /package/dist/packem_shared/{arrayFmt-Dek5cB7m.mjs → arrayFmt-Dek5cB7m.js} +0 -0
  120. /package/dist/packem_shared/{ensure-auto-modules-BU3xWEjl.mjs → ensure-auto-modules-BU3xWEjl.js} +0 -0
  121. /package/dist/packem_shared/{hasModuleSpecifier-DIZeev_W.mjs → hasModuleSpecifier-DIZeev_W.js} +0 -0
  122. /package/dist/packem_shared/{safeId-BN5akJYJ.mjs → safeId-BN5akJYJ.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,20 +1,40 @@
1
- import { Plugin } from 'rollup';
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
- import { Environment } from '@visulima/packem-share/types';
5
- import 'cssnano';
6
- import 'lightningcss';
7
- import 'postcss';
8
- import 'postcss-load-config';
9
- import 'less';
10
- import 'sass';
11
- import 'sass-embedded';
12
- import 'stylus';
13
- import '@visulima/packem-share/utils';
14
- import 'source-map-js';
15
-
16
- declare const cssModulesTypesPlugin: (options: StyleOptions, rootDirectory: string) => Plugin;
17
-
18
- declare const cssPlugin: (options: StyleOptions, browserTargets: string[], cwd: string, sourceDirectory: string, environment: Environment, useSourcemap: boolean, debug: boolean, minify: boolean, alias: Record<string, string>) => Promise<Plugin>;
19
-
20
- export { StyleOptions, cssModulesTypesPlugin, cssPlugin as rollupCssPlugin };
1
+ /**
2
+ * CSS Modules TypeScript declaration generator plugin.
3
+ *
4
+ * This plugin generates TypeScript declaration files (.d.ts) for CSS modules,
5
+ * enabling type-safe CSS class name usage in TypeScript projects. It works
6
+ * in conjunction with the main CSS plugin to provide a complete CSS modules
7
+ * development experience.
8
+ *
9
+ * Features:
10
+ * - Automatic .d.ts file generation for CSS modules
11
+ * - Support for custom naming patterns
12
+ * - Integration with build tools and IDEs
13
+ * - Real-time updates during development
14
+ * @example
15
+ * ```typescript
16
+ * // Usage alongside main CSS plugin
17
+ * import { rollupCssPlugin, cssModulesTypesPlugin } from '@packem/rollup-plugin-css';
18
+ *
19
+ * export default {
20
+ * plugins: [
21
+ * rollupCssPlugin({ modules: true }),
22
+ * cssModulesTypesPlugin()
23
+ * ]
24
+ * };
25
+ * ```
26
+ * @example
27
+ * ```typescript
28
+ * // Generated .d.ts file example
29
+ * // styles.module.css.d.ts
30
+ * declare const styles: {
31
+ * readonly container: string;
32
+ * readonly button: string;
33
+ * readonly active: string;
34
+ * };
35
+ * export default styles;
36
+ * ```
37
+ */
38
+ export { default as cssModulesTypesPlugin } from './css-modules-types.d.ts';
39
+ export { default as rollupCssPlugin } from './css-plugin.d.ts';
40
+ export type * from './types.d.ts';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{default as e}from"./packem_shared/cssModulesTypesPlugin-CjGroK2y.js";import{default as u}from"./packem_shared/rollupCssPlugin-BxRedPmA.js";export{e as cssModulesTypesPlugin,u as rollupCssPlugin};
@@ -0,0 +1,2 @@
1
+ declare const importer: (alias: Record<string, string>) => Less.Plugin;
2
+ export default importer;
@@ -1,9 +1,37 @@
1
- // @ts-ignore
2
- loader;
3
- export { LESSLoaderOptions };
4
- declare namespace loader {
5
- export const loader: Loader<LESSLoaderOptions>;
6
- import _default = loader;
7
- export { _default as default };
8
- }
9
- export = loader;
1
+ import type { Loader } from "../types.d.ts";
2
+ import type { LESSLoaderOptions } from "./types.d.ts";
3
+ /**
4
+ * Less loader for processing Less stylesheets to CSS.
5
+ *
6
+ * This loader:
7
+ * - Compiles Less syntax to standard CSS
8
+ * - Resolves @import statements and dependencies
9
+ * - Handles alias resolution for imports
10
+ * - Tracks file dependencies for watch mode
11
+ * - Generates source maps for debugging
12
+ * @example
13
+ * ```less
14
+ * // Input Less file
15
+ * @primary-color: #007acc;
16
+ *
17
+ * .button {
18
+ * color: @primary-color;
19
+ * &:hover {
20
+ * opacity: 0.8;
21
+ * }
22
+ * }
23
+ * ```
24
+ * @example
25
+ * ```css
26
+ * // Output CSS
27
+ * .button {
28
+ * color: #007acc;
29
+ * }
30
+ * .button:hover {
31
+ * opacity: 0.8;
32
+ * }
33
+ * ```
34
+ */
35
+ declare const loader: Loader<LESSLoaderOptions>;
36
+ export default loader;
37
+ export type { LESSLoaderOptions } from "./types.d.ts";
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var l=(s,e)=>c(s,"name",{value:e,configurable:!0});import{dirname as u,normalize as d}from"@visulima/path";import f from"less";import{readFileSync as h}from"@visulima/fs";import{resolveAlias as g}from"@visulima/path/utils";import{resolve as y}from"../../packem_shared/resolve-anj9ucIq.js";import{normalizeUrl as F,getUrlOfPartial as v}from"../../packem_shared/hasModuleSpecifier-DIZeev_W.js";var b=Object.defineProperty,m=l((s,e)=>b(s,"name",{value:e,configurable:!0}),"i");const M=[".less",".css"],x=m((s,e)=>new class extends s.FileManager{supports(){return!0}async loadFile(r,a,t){const i=F(g(r,e)),o=v(i),n={baseDirs:[],caller:"Less importer",extensions:M};Array.isArray(t.paths)&&n.baseDirs.push(...t.paths),n.baseDirs.push(a);const p=y([o,i],n);return{contents:h(p),filename:p}}},"getStylesFileManager"),A=m(s=>({install(e,r){r.addFileManager(x(e,s))}}),"importer"),U={name:"less",async process({code:s,map:e}){const r=[A(this.alias)];this.options.plugins&&r.push(...this.options.plugins);const a=f.render,t=await a(s,{...this.options,filename:this.id,plugins:r,sourceMap:{outputSourceFiles:!0,sourceMapBasepath:u(this.id)}}),i=t.imports;for(const o of i)this.deps.add(d(o));return{code:t.css,map:t.map??e}},test:/\.less$/i};export{U as default};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Configuration options for the Less loader.
3
+ *
4
+ * Extends the standard Less.Options with additional loader-specific settings.
5
+ * These options are passed directly to the Less compiler during processing.
6
+ * @example
7
+ * ```typescript
8
+ * const lessOptions: LESSLoaderOptions = {
9
+ * // Less compiler options
10
+ * math: 'parens-division',
11
+ * strictUnits: true,
12
+ *
13
+ * // Custom plugins
14
+ * plugins: [myLessPlugin],
15
+ *
16
+ * // Global variables
17
+ * globalVars: {
18
+ * 'primary-color': '#007acc'
19
+ * }
20
+ * };
21
+ * ```
22
+ * @see {@link https://lesscss.org/usage/#less-options} Less.js Options Documentation
23
+ */
24
+ export type LESSLoaderOptions = Less.Options;
@@ -1,17 +1,14 @@
1
- import { c as Loader, L as LightningCSSOptions } from '../packem_shared/types-CA9pSumu.js';
2
- import 'cssnano';
3
- import 'lightningcss';
4
- import 'postcss';
5
- import 'postcss-load-config';
6
- import 'less';
7
- import '@visulima/packem-share/types';
8
- import 'sass';
9
- import 'sass-embedded';
10
- import 'stylus';
11
- import '@visulima/packem-share/utils';
12
- import 'rollup';
13
- import 'source-map-js';
14
-
1
+ import type { LightningCSSOptions } from "../types.d.ts";
2
+ import type { Loader } from "./types.d.ts";
3
+ /**
4
+ * LightningCSS loader for processing CSS files with the LightningCSS transformer.
5
+ *
6
+ * Supports:
7
+ * - CSS transformation (vendor prefixes, modern syntax → legacy, etc.)
8
+ * - CSS modules with deterministic export ordering and composes resolution
9
+ * - Source map generation
10
+ * - Browser targets via the shared browserslist config
11
+ * - TypeScript declaration generation when `dts: true` is set
12
+ */
15
13
  declare const lightningCSSLoader: Loader<LightningCSSOptions>;
16
-
17
- export = lightningCSSLoader;
14
+ export default lightningCSSLoader;
@@ -0,0 +1,3 @@
1
+ var p=Object.defineProperty;var d=(i,e)=>p(i,"name",{value:e,configurable:!0});import{transform as l,browserslistToTargets as u}from"lightningcss";import{g as f}from"../packem_shared/generate-js-exports-BhS4eLrN.js";import{n as m}from"../packem_shared/ensure-auto-modules-BU3xWEjl.js";var h=Object.defineProperty,g=d((i,e)=>h(i,"name",{value:e,configurable:!0}),"a");const x=g(i=>{const e={},r=Object.entries(i).sort(([s],[t])=>s<t?-1:s>t?1:0);for(const[s,t]of r){const n=[t.name];for(const a of t.composes)(a.type==="local"||a.type==="global")&&n.push(a.name);e[s]=n.join(" ")}return e},"normalizeModulesExports"),j={name:"lightningcss",async process({code:i,map:e}){let r=!1;typeof this.options.modules=="boolean"?r=this.options.modules:typeof this.options.modules=="object"&&(r=m(this.options.modules.include,this.id)),this.autoModules&&this.options.modules===void 0&&(r=m(this.autoModules,this.id));const s=l({...this.options,code:Buffer.from(i),cssModules:this.options.modules??r,filename:this.id,inputSourceMap:e,minify:!1,sourceMap:!!this.sourceMap,targets:u(this.browserTargets)});s.warnings.length>0&&this.logger.warn({message:`warnings when transforming css:
2
+ ${s.warnings.map(c=>c.message).join(`
3
+ `)}`});const t=s.code.toString(),n=s.map?Buffer.from(s.map).toString():void 0,a=s.exports?x(s.exports):{},o=f({css:t,cwd:this.cwd,dts:this.dts,emit:this.emit,extract:this.extract,icssDependencies:[],id:this.id,inject:this.inject,inline:this.inline,logger:this.logger,map:n,modulesExports:a,namedExports:this.namedExports,supportModules:r});return this.extract?{code:o.code,extracted:{css:t,id:this.id,map:n},map:o.map,meta:o.meta,moduleSideEffects:o.moduleSideEffects}:{code:o.code,map:o.map,meta:o.meta,moduleSideEffects:o.moduleSideEffects}},test:/\.css$/i};export{j as default};
@@ -0,0 +1,78 @@
1
+ import type { RollupLogger } from "@visulima/packem-share/utils";
2
+ import type { InternalStyleOptions } from "../types.d.ts";
3
+ import type { Loader, LoaderContext, Payload } from "./types.d.ts";
4
+ /**
5
+ * Configuration options for the LoaderManager.
6
+ */
7
+ interface LoadersOptions {
8
+ /** @see {@link InternalStyleOptions.extensions} */
9
+ extensions: string[];
10
+ /** Array of loaders to manage */
11
+ loaders: Loader[];
12
+ /** Logger instance for debugging and error reporting */
13
+ logger: RollupLogger;
14
+ /** Internal style processing options */
15
+ options: InternalStyleOptions;
16
+ }
17
+ /**
18
+ * Manages and orchestrates multiple CSS loaders in a processing pipeline.
19
+ *
20
+ * The LoaderManager handles:
21
+ * - Registration and management of multiple loaders
22
+ * - File type detection and loader matching
23
+ * - Concurrent processing using a thread pool
24
+ * - Error handling and logging
25
+ * - Context management for each loader
26
+ * @example
27
+ * ```typescript
28
+ * const manager = new LoaderManager({
29
+ * extensions: ['.css', '.scss'],
30
+ * loaders: [sassLoader, postcssLoader],
31
+ * logger: rollupLogger,
32
+ * options: styleOptions
33
+ * });
34
+ *
35
+ * const result = await manager.process(payload, context);
36
+ * ```
37
+ */
38
+ declare class LoaderManager {
39
+ /** Function to test if a file should be processed based on extensions */
40
+ private readonly test;
41
+ /** Map of registered loaders by name */
42
+ private readonly loaders;
43
+ /** Internal style processing options */
44
+ private readonly options;
45
+ /** Queue for managing concurrent loader processing */
46
+ private workQueue?;
47
+ /** Logger instance for debugging and error reporting */
48
+ private readonly logger;
49
+ /**
50
+ * Creates a new LoaderManager instance.
51
+ * @param options Configuration options for the loader manager
52
+ */
53
+ constructor({ extensions, loaders, logger, options }: LoadersOptions);
54
+ /**
55
+ * Adds one or more loaders to the manager.
56
+ * @param loaders Loaders to add to the manager
57
+ * @template T - Type of loader options
58
+ */
59
+ add<T extends Record<string, unknown>>(...loaders: Loader<T>[]): void;
60
+ /**
61
+ * Checks if a file is supported by any registered loader.
62
+ * @param file File path to check
63
+ * @returns True if the file is supported by at least one loader
64
+ */
65
+ isSupported(file: string): boolean;
66
+ /**
67
+ * Processes a payload through all applicable loaders in sequence.
68
+ *
69
+ * Each loader is executed if it either:
70
+ * - Has `alwaysProcess` set to true, or
71
+ * - Has a test that matches the file being processed
72
+ * @param payload The payload to process
73
+ * @param context The loader context
74
+ * @returns The processed payload after all applicable loaders have run
75
+ */
76
+ process(payload: Payload, context: LoaderContext): Promise<Payload>;
77
+ }
78
+ export default LoaderManager;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Default PostCSS file extensions for configuration file detection.
3
+ *
4
+ * These extensions are used when searching for PostCSS configuration files
5
+ * in the project directory hierarchy. Supports both CommonJS and ES module formats.
6
+ * @example
7
+ * ```typescript
8
+ * // Configuration files that will be detected:
9
+ * // - postcss.config.js
10
+ * // - postcss.config.mjs
11
+ * // - postcss.config.cjs
12
+ * // - .postcssrc.js
13
+ * // - .postcssrc.mjs
14
+ * // - .postcssrc.cjs
15
+ * ```
16
+ */
17
+ export declare const POSTCSS_EXTENSIONS: string[];
18
+ export declare const HASH_REGEXP: RegExp;
19
+ export declare const FIRST_EXTENSION_REGEXP: RegExp;
20
+ export declare const DATA_URI_REGEXP: RegExp;
@@ -0,0 +1,8 @@
1
+ import type { PluginCreator } from "postcss";
2
+ import type { Load } from "./loaders/postcss/icss/load.d.ts";
3
+ interface InteroperableCSSOptions {
4
+ extensions?: string[];
5
+ load?: Load;
6
+ }
7
+ declare const plugin: PluginCreator<InteroperableCSSOptions>;
8
+ export default plugin;
@@ -0,0 +1,5 @@
1
+ import type { ProcessOptions } from "postcss";
2
+ import type Processor from "postcss/lib/processor";
3
+ declare const load: Load;
4
+ export type Load = (url: string, file: string, extensions: string[], processor: Processor, options?: ProcessOptions) => Promise<Record<string, string>>;
5
+ export default load;
@@ -0,0 +1,6 @@
1
+ import type { CSSImports } from "icss-utils";
2
+ import type { ProcessOptions } from "postcss";
3
+ import type Processor from "postcss/lib/processor";
4
+ import type { Load } from "./loaders/postcss/icss/load.d.ts";
5
+ declare const resolve: (icssImports: CSSImports, load: Load, file: string, extensions: string[], processor: Processor, options?: ProcessOptions) => Promise<Record<string, string>>;
6
+ export default resolve;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Modified copy of https://github.com/csstools/postcss-plugins/blob/main/plugin-packs/postcss-bundler/src/postcss-import/lib/apply-conditions.ts
3
+ *
4
+ * MIT No Attribution (MIT-0)
5
+ * Copyright © CSSTools Contributors
6
+ */
7
+ import type { AtRule, AtRuleProps } from "postcss";
8
+ import type { Stylesheet } from "./types.d.ts";
9
+ declare const applyConditions: (stylesheet: Stylesheet, atRule: (defaults?: AtRuleProps) => AtRule) => void;
10
+ export default applyConditions;
@@ -0,0 +1,3 @@
1
+ import type { Stylesheet } from "./types.d.ts";
2
+ declare const applyRaws: (stylesheet: Stylesheet) => void;
3
+ export default applyRaws;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Modified copy of https://github.com/csstools/postcss-plugins/blob/main/plugin-packs/postcss-bundler/src/postcss-import/lib/apply-styles.ts
3
+ *
4
+ * MIT No Attribution (MIT-0)
5
+ * Copyright © CSSTools Contributors
6
+ */
7
+ import type { Document, Root } from "postcss";
8
+ import type { Stylesheet } from "./types.d.ts";
9
+ declare const applyStyles: (stylesheet: Stylesheet, styles: Document | Root) => void;
10
+ export default applyStyles;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Modified copy of https://github.com/csstools/postcss-plugins/blob/main/plugin-packs/postcss-bundler/src/postcss-import/lib/names.ts
3
+ *
4
+ * MIT No Attribution (MIT-0)
5
+ * Copyright © CSSTools Contributors
6
+ */
7
+ export declare const IS_CHARSET_REGEX: RegExp;
8
+ export declare const IS_IMPORT_REGEX: RegExp;
9
+ export declare const IS_URL_REGEX: RegExp;
10
+ export declare const IS_LAYER_REGEX: RegExp;
11
+ export declare const IS_SUPPORTS_REGEX: RegExp;
12
+ export declare const IS_SCOPE_REGEX: RegExp;
@@ -0,0 +1,3 @@
1
+ import type { Node } from "postcss";
2
+ export type ImportResolve = (url: string, basedir: string, extensions: string[], atRule: Node) => Promise<string> | string;
3
+ export declare const importResolve: ImportResolve;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Modified copy of https://github.com/csstools/postcss-plugins/blob/main/plugin-packs/postcss-bundler/src/postcss-import/index.ts
3
+ *
4
+ * MIT No Attribution (MIT-0)
5
+ * Copyright © CSSTools Contributors
6
+ */
7
+ import type { PluginCreator } from "postcss";
8
+ import type { ImportOptions } from "./types.d.ts";
9
+ declare const plugin: PluginCreator<Partial<ImportOptions & {
10
+ root: string;
11
+ }>>;
12
+ export default plugin;
@@ -0,0 +1,9 @@
1
+ declare const parseAtImport: (parameters: string) => false | {
2
+ fullUri: string;
3
+ layer?: string;
4
+ media?: string;
5
+ scope?: string;
6
+ supports?: string;
7
+ uri: string;
8
+ };
9
+ export default parseAtImport;
@@ -0,0 +1,6 @@
1
+ import type { AtRule, Document, Postcss, Result, Root } from "postcss";
2
+ import type { Condition, ImportOptions, State, Stylesheet } from "../types.d.ts";
3
+ declare const parseStyles: (options: ImportOptions & {
4
+ root: string;
5
+ }, result: Result, styles: Document | Root, state: State, importingNode: AtRule | undefined, conditions: Condition[], from: string[], postcss: Postcss) => Promise<Stylesheet>;
6
+ export default parseStyles;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Modified copy of https://github.com/csstools/postcss-plugins/blob/main/plugin-packs/postcss-bundler/src/postcss-import/lib/parse-stylesheet.ts
3
+ *
4
+ * MIT No Attribution (MIT-0)
5
+ * Copyright © CSSTools Contributors
6
+ */
7
+ import type { AtRule, Document, Result, Root } from "postcss";
8
+ import type { Condition, Stylesheet } from "../types.d.ts";
9
+ declare const parseStylesheet: (result: Result, styles: Document | Root, importingNode: AtRule | undefined, conditions: Condition[], from: string[]) => Stylesheet;
10
+ export default parseStylesheet;
@@ -0,0 +1,95 @@
1
+ import type { AcceptedPlugin, AtRule, ChildNode, Warning } from "postcss";
2
+ import type { ImportResolve } from "./import-resolve.d.ts";
3
+ export type Condition = {
4
+ layer?: string;
5
+ media?: string;
6
+ scope?: string;
7
+ supports?: string;
8
+ };
9
+ /** `@import` handler options */
10
+ export interface ImportOptions {
11
+ /**
12
+ * Aliases for import paths.
13
+ * Overrides the global `alias` option.
14
+ * - ex.: `{"foo":"bar"}`
15
+ */
16
+ alias: Record<string, string>;
17
+ /**
18
+ * On the debug mode, the file path will be added as a comment in the CSS output.
19
+ */
20
+ debug?: boolean;
21
+ /**
22
+ * Import files ending with these extensions.
23
+ * Overrides the global `extensions` option.
24
+ * @default [".css", ".pcss", ".postcss", ".sss"]
25
+ */
26
+ extensions: string[];
27
+ /**
28
+ * Only transform imports for which the test function returns `true`. Imports for which the test function returns `false` will be left as is. The function gets the path to import as an
29
+ * argument and should return a boolean.
30
+ * @default () => true
31
+ */
32
+ filter?: (id: string) => boolean;
33
+ /**
34
+ * You can overwrite the default loading way by setting this option. This function gets `(filename, importOptions)` arguments and returns content or promised content.
35
+ */
36
+ load: (filename: string, importOptions: ImportOptions) => Promise<string> | string;
37
+ /**
38
+ * A list of plugins for PostCSS,
39
+ * which are used before plugins loaded from PostCSS config file, if any
40
+ */
41
+ plugins: AcceptedPlugin[];
42
+ /**
43
+ * Provide custom resolver for imports
44
+ * in place of the default one
45
+ */
46
+ resolve: ImportResolve;
47
+ /**
48
+ * By default, similar files (based on the same content) are being skipped. It's to optimize output and skip similar files like `normalize.css` for example. If this behavior is not what you
49
+ * want, just set this option to false to disable it.
50
+ * @default true
51
+ */
52
+ skipDuplicates?: boolean | undefined;
53
+ /**
54
+ * By default, css-import warns when an empty file is imported.
55
+ * Set this option to false to disable this warning.
56
+ * @default true
57
+ */
58
+ warnOnEmpty?: boolean;
59
+ }
60
+ export type ImportStatement = {
61
+ conditions: Condition[];
62
+ from: string[];
63
+ fullUri: string;
64
+ importingNode: AtRule | undefined;
65
+ node: AtRule;
66
+ parent?: Statement;
67
+ stylesheet?: Stylesheet;
68
+ type: "import";
69
+ uri: string;
70
+ };
71
+ export type NodesStatement = {
72
+ conditions: Condition[];
73
+ from: string[];
74
+ importingNode: AtRule | undefined;
75
+ nodes: ChildNode[];
76
+ parent?: Statement;
77
+ type: "nodes";
78
+ };
79
+ export type PreImportStatement = {
80
+ conditions: Condition[];
81
+ from: string[];
82
+ importingNode: AtRule | undefined;
83
+ node: ChildNode;
84
+ parent?: Statement;
85
+ type: "pre-import";
86
+ };
87
+ export type State = {
88
+ hashFiles: Record<string, Record<string, boolean>>;
89
+ importedFiles: Record<string, Record<string, boolean>>;
90
+ };
91
+ export type Statement = ImportStatement | NodesStatement | PreImportStatement | Warning;
92
+ export type Stylesheet = {
93
+ charset?: AtRule;
94
+ statements: Statement[];
95
+ };
@@ -0,0 +1,3 @@
1
+ import type { Condition } from "../types.d.ts";
2
+ declare const base64EncodedConditionalImport: (prelude: string, conditions: Condition[]) => string;
3
+ export default base64EncodedConditionalImport;
@@ -0,0 +1,2 @@
1
+ export declare const isValidDataURL: (url?: string) => boolean;
2
+ export declare const dataURLContents: (url: string) => string;
@@ -0,0 +1,2 @@
1
+ declare const formatImportPrelude: (layer: string | undefined, media: string | undefined, supports: string | undefined, scope: string | undefined) => string;
2
+ export default formatImportPrelude;
@@ -0,0 +1,2 @@
1
+ declare const loadContent: (filename: string) => string;
2
+ export default loadContent;
@@ -0,0 +1,4 @@
1
+ import type { LazyResult, Postcss, Result } from "postcss";
2
+ import type { ImportOptions } from "../types.d.ts";
3
+ declare const processContent: (result: Result, content: string, filename: string, options: ImportOptions, postcss: Postcss) => Promise<LazyResult>;
4
+ export default processContent;
@@ -0,0 +1,6 @@
1
+ import type { Warning } from "postcss";
2
+ import type { ImportStatement, NodesStatement, PreImportStatement, Statement } from "../types.d.ts";
3
+ export declare const isWarning: (stmt: Statement) => stmt is Warning;
4
+ export declare const isNodesStatement: (stmt: Statement) => stmt is NodesStatement;
5
+ export declare const isImportStatement: (stmt: Statement) => stmt is ImportStatement;
6
+ export declare const isPreImportStatement: (stmt: Statement) => stmt is PreImportStatement;
@@ -1,17 +1,28 @@
1
- import { c as Loader, a as InternalStyleOptions } from '../../packem_shared/types-CA9pSumu.js';
2
- import 'cssnano';
3
- import 'lightningcss';
4
- import 'postcss';
5
- import 'postcss-load-config';
6
- import 'less';
7
- import '@visulima/packem-share/types';
8
- import 'sass';
9
- import 'sass-embedded';
10
- import 'stylus';
11
- import '@visulima/packem-share/utils';
12
- import 'rollup';
13
- import 'source-map-js';
14
-
1
+ import type { InternalStyleOptions } from "../../types.d.ts";
2
+ import type { Loader } from "../types.d.ts";
3
+ /**
4
+ * PostCSS loader for processing CSS with PostCSS plugins and CSS modules.
5
+ *
6
+ * This loader provides comprehensive CSS processing including:
7
+ * - PostCSS plugin pipeline execution
8
+ * - CSS modules support with automatic detection
9
+ * - Import resolution and dependency tracking
10
+ * - URL processing and asset handling
11
+ * - Source map generation and transformation
12
+ * - JavaScript code generation for CSS injection
13
+ *
14
+ * The loader always processes files since PostCSS can handle any CSS content
15
+ * and provides the base transformation layer for other preprocessors.
16
+ * @example
17
+ * ```typescript
18
+ * // CSS Modules processing
19
+ * // Input: .button { color: red; }
20
+ * // Output: JavaScript with hashed class names and CSS injection
21
+ *
22
+ * // Regular CSS processing
23
+ * // Input: @import "normalize.css"; .app { color: blue; }
24
+ * // Output: Resolved imports and processed CSS
25
+ * ```
26
+ */
15
27
  declare const loader: Loader<NonNullable<InternalStyleOptions["postcss"]>>;
16
-
17
- export = loader;
28
+ export default loader;