@visulima/rollup-plugin-css 1.0.0-alpha.30 → 1.0.0-alpha.32

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 (70) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/css-modules-types.d.ts +38 -0
  3. package/dist/css-plugin.d.ts +44 -0
  4. package/dist/index.d.ts +40 -19
  5. package/dist/loaders/less/importer.d.ts +2 -0
  6. package/dist/loaders/less/index.d.ts +36 -15
  7. package/dist/loaders/less/types.d.ts +24 -0
  8. package/dist/loaders/lightningcss.d.ts +13 -15
  9. package/dist/loaders/loader-manager.d.ts +78 -0
  10. package/dist/loaders/postcss/constants.d.ts +20 -0
  11. package/dist/loaders/postcss/icss/index.d.ts +8 -0
  12. package/dist/loaders/postcss/icss/load.d.ts +5 -0
  13. package/dist/loaders/postcss/icss/resolve.d.ts +6 -0
  14. package/dist/loaders/postcss/import/apply-conditions.d.ts +10 -0
  15. package/dist/loaders/postcss/import/apply-raws.d.ts +3 -0
  16. package/dist/loaders/postcss/import/apply-styles.d.ts +10 -0
  17. package/dist/loaders/postcss/import/constants.d.ts +12 -0
  18. package/dist/loaders/postcss/import/import-resolve.d.ts +3 -0
  19. package/dist/loaders/postcss/import/index.d.ts +12 -0
  20. package/dist/loaders/postcss/import/parser/parse-at-import.d.ts +9 -0
  21. package/dist/loaders/postcss/import/parser/parse-styles.d.ts +6 -0
  22. package/dist/loaders/postcss/import/parser/parse-stylesheet.d.ts +10 -0
  23. package/dist/loaders/postcss/import/types.d.ts +95 -0
  24. package/dist/loaders/postcss/import/utils/base64-encoded-import.d.ts +3 -0
  25. package/dist/loaders/postcss/import/utils/data-url.d.ts +2 -0
  26. package/dist/loaders/postcss/import/utils/format-import-prelude.d.ts +2 -0
  27. package/dist/loaders/postcss/import/utils/load-content.d.ts +2 -0
  28. package/dist/loaders/postcss/import/utils/process-content.d.ts +4 -0
  29. package/dist/loaders/postcss/import/utils/statement.d.ts +6 -0
  30. package/dist/loaders/postcss/index.d.ts +27 -15
  31. package/dist/loaders/postcss/load-config.d.ts +6 -0
  32. package/dist/loaders/postcss/modules/generate.d.ts +11 -0
  33. package/dist/loaders/postcss/modules/index.d.ts +35 -0
  34. package/dist/loaders/postcss/noop.d.ts +22 -0
  35. package/dist/loaders/postcss/url/generate.d.ts +2 -0
  36. package/dist/loaders/postcss/url/index.d.ts +46 -0
  37. package/dist/loaders/postcss/url/inline.d.ts +20 -0
  38. package/dist/loaders/postcss/url/url-resolve.d.ts +12 -0
  39. package/dist/loaders/postcss/url/utils.d.ts +4 -0
  40. package/dist/loaders/sass/index.d.ts +4 -16
  41. package/dist/loaders/sass/modern/importer.d.ts +3 -0
  42. package/dist/loaders/sass/types.d.ts +20 -0
  43. package/dist/loaders/sass/utils/get-sass-compiler.d.ts +8 -0
  44. package/dist/loaders/sass/utils/get-sass-options.d.ts +7 -0
  45. package/dist/loaders/sass/utils/normalize-source-map.d.ts +3 -0
  46. package/dist/loaders/sass/utils/resolve-syntax.d.ts +2 -0
  47. package/dist/loaders/sass/utils/sass-error-factory.d.ts +15 -0
  48. package/dist/loaders/sourcemap.d.ts +24 -15
  49. package/dist/loaders/stylus/index.d.ts +7 -16
  50. package/dist/loaders/stylus/types.d.ts +87 -0
  51. package/dist/loaders/tailwindcss-oxide.d.ts +5 -15
  52. package/dist/loaders/types.d.ts +102 -0
  53. package/dist/loaders/utils/ensure-auto-modules.d.ts +39 -0
  54. package/dist/loaders/utils/match-file.d.ts +32 -0
  55. package/dist/minifiers/cssnano.d.ts +30 -15
  56. package/dist/minifiers/lightningcss.d.ts +29 -15
  57. package/dist/minifiers/types.d.ts +64 -0
  58. package/dist/types.d.ts +224 -0
  59. package/dist/utils/array-fmt.d.ts +18 -0
  60. package/dist/utils/concat.d.ts +34 -0
  61. package/dist/utils/generate-js-exports.d.ts +78 -0
  62. package/dist/utils/index.d.ts +9 -72
  63. package/dist/utils/load-module.d.ts +3 -0
  64. package/dist/utils/options.d.ts +155 -0
  65. package/dist/utils/resolve.d.ts +35 -0
  66. package/dist/utils/safe-id.d.ts +23 -0
  67. package/dist/utils/sourcemap.d.ts +42 -0
  68. package/dist/utils/url.d.ts +8 -0
  69. package/package.json +5 -5
  70. package/dist/packem_shared/types-B7InbTq8.d.ts +0 -206
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## @visulima/rollup-plugin-css [1.0.0-alpha.32](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-css@1.0.0-alpha.31...@visulima/rollup-plugin-css@1.0.0-alpha.32) (2026-04-23)
2
+
3
+
4
+ ### Dependencies
5
+
6
+ * **@visulima/packem-share:** upgraded to 1.0.0-alpha.33
7
+
8
+ ## @visulima/rollup-plugin-css [1.0.0-alpha.31](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-css@1.0.0-alpha.30...@visulima/rollup-plugin-css@1.0.0-alpha.31) (2026-04-23)
9
+
10
+ ### Miscellaneous Chores
11
+
12
+ * **rollup-plugin-css:** restore isolatedDeclarationTransformer and annotate POSTCSS_EXTENSIONS ([5a0752e](https://github.com/visulima/packem/commit/5a0752ecad1376fe4f693cc00bf4231833842848))
13
+
14
+
15
+ ### Dependencies
16
+
17
+ * **@visulima/packem-share:** upgraded to 1.0.0-alpha.32
18
+
1
19
  ## @visulima/rollup-plugin-css [1.0.0-alpha.30](https://github.com/visulima/packem/compare/@visulima/rollup-plugin-css@1.0.0-alpha.29...@visulima/rollup-plugin-css@1.0.0-alpha.30) (2026-04-18)
2
20
 
3
21
  ### Features
@@ -0,0 +1,38 @@
1
+ import type { Plugin } from "rollup";
2
+ import type { StyleOptions } from "./types.d.ts";
3
+ /**
4
+ * Creates a Rollup plugin that generates TypeScript declaration files for CSS modules.
5
+ *
6
+ * This plugin automatically generates `.d.ts` files alongside CSS module files,
7
+ * providing type safety for CSS class names in TypeScript projects. The generated
8
+ * declarations include typed exports for all CSS classes found in the modules.
9
+ *
10
+ * The plugin:
11
+ * - Detects CSS modules based on configuration (autoModules, postcss.modules, etc.)
12
+ * - Extracts type information from processed CSS modules
13
+ * - Generates TypeScript declaration files with proper exports
14
+ * - Adds watch file dependencies for proper rebuilds
15
+ * - Logs generation progress
16
+ * @param options Style options containing CSS modules configuration
17
+ * @param rootDirectory Root directory for relative path logging
18
+ * @returns Rollup plugin for CSS modules type generation
19
+ * @example
20
+ * ```typescript
21
+ * // Plugin usage
22
+ * const plugin = cssModulesTypesPlugin({
23
+ * autoModules: true,
24
+ * postcss: {
25
+ * modules: {
26
+ * include: /\.module\./
27
+ * }
28
+ * }
29
+ * }, process.cwd());
30
+ *
31
+ * // Generated .d.ts file for styles.module.css:
32
+ * // declare const button: string;
33
+ * // declare const header: string;
34
+ * // export { button, header };
35
+ * ```
36
+ */
37
+ declare const cssModulesTypesPlugin: (options: StyleOptions, rootDirectory: string) => Plugin;
38
+ export default cssModulesTypesPlugin;
@@ -0,0 +1,44 @@
1
+ import type { Environment } from "@visulima/packem-share/types";
2
+ import type { Plugin } from "rollup";
3
+ import type { StyleOptions } from "./types.d.ts";
4
+ /**
5
+ * Creates the main CSS processing plugin for Rollup.
6
+ *
7
+ * This plugin provides comprehensive CSS processing capabilities including:
8
+ * - Multiple preprocessor support (Sass, Less, Stylus)
9
+ * - PostCSS processing with plugin ecosystem
10
+ * - CSS modules with automatic detection
11
+ * - Source map generation and processing
12
+ * - CSS injection or extraction modes
13
+ * - Minification support
14
+ * - TypeScript declaration generation
15
+ * - Asset handling and optimization
16
+ * @param options CSS processing options and loader configurations
17
+ * @param browserTargets Target browsers for compatibility transformations
18
+ * @param cwd Current working directory for resolving paths
19
+ * @param sourceDirectory Source directory for relative path resolution
20
+ * @param environment Build environment (development/production)
21
+ * @param useSourcemap Whether to generate source maps
22
+ * @param debug Enable debug logging and performance monitoring
23
+ * @param minify Enable CSS minification
24
+ * @param alias Path aliases for import resolution
25
+ * @returns Promise resolving to configured Rollup plugin
26
+ * @example
27
+ * ```typescript
28
+ * // Basic usage
29
+ * const plugin = await cssPlugin({
30
+ * mode: 'extract',
31
+ * extensions: ['.css', '.scss'],
32
+ * postcss: { plugins: [autoprefixer] }
33
+ * }, ['> 1%'], process.cwd(), 'src', 'development', true, false, false, {});
34
+ *
35
+ * // CSS Modules with injection
36
+ * const plugin = await cssPlugin({
37
+ * mode: 'inject',
38
+ * autoModules: true,
39
+ * namedExports: true
40
+ * }, ['> 1%'], process.cwd(), 'src', 'production', false, false, true, {});
41
+ * ```
42
+ */
43
+ 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>;
44
+ export default cssPlugin;
package/dist/index.d.ts CHANGED
@@ -1,19 +1,40 @@
1
- import { Plugin } from 'rollup';
2
- import { S as StyleOptions } from './packem_shared/types-B7InbTq8.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-B7InbTq8.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 'sass';
10
- import 'sass-embedded';
11
- import 'stylus';
12
- import '@visulima/packem-share/utils';
13
- import 'source-map-js';
14
-
15
- declare const cssModulesTypesPlugin: (options: StyleOptions, rootDirectory: string) => Plugin;
16
-
17
- 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>;
18
-
19
- 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';
@@ -0,0 +1,2 @@
1
+ declare const importer: (alias: Record<string, string>) => Less.Plugin;
2
+ export default importer;
@@ -1,16 +1,37 @@
1
- import { c as Loader, d as LESSLoaderOptions } from '../../packem_shared/types-B7InbTq8.js';
2
- import 'cssnano';
3
- import 'lightningcss';
4
- import 'postcss';
5
- import 'postcss-load-config';
6
- import '@visulima/packem-share/types';
7
- import 'sass';
8
- import 'sass-embedded';
9
- import 'stylus';
10
- import '@visulima/packem-share/utils';
11
- import 'rollup';
12
- import 'source-map-js';
13
-
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
+ */
14
35
  declare const loader: Loader<LESSLoaderOptions>;
15
-
16
- export { LESSLoaderOptions, loader as default };
36
+ export default loader;
37
+ export type { LESSLoaderOptions } from "./types.d.ts";
@@ -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,16 +1,14 @@
1
- import { c as Loader, L as LightningCSSOptions } from '../packem_shared/types-B7InbTq8.js';
2
- import 'cssnano';
3
- import 'lightningcss';
4
- import 'postcss';
5
- import 'postcss-load-config';
6
- import '@visulima/packem-share/types';
7
- import 'sass';
8
- import 'sass-embedded';
9
- import 'stylus';
10
- import '@visulima/packem-share/utils';
11
- import 'rollup';
12
- import 'source-map-js';
13
-
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
+ */
14
13
  declare const lightningCSSLoader: Loader<LightningCSSOptions>;
15
-
16
- export { lightningCSSLoader as default };
14
+ export default lightningCSSLoader;
@@ -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;