@visulima/rollup-plugin-css 1.0.0-alpha.45 → 1.0.0-alpha.46

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 (99) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/index.d.ts +16 -40
  3. package/dist/index.js +1 -1
  4. package/dist/loaders/less/index.d.ts +13 -36
  5. package/dist/loaders/less/index.js +1 -1
  6. package/dist/loaders/lightningcss.d.ts +13 -13
  7. package/dist/loaders/lightningcss.js +3 -3
  8. package/dist/loaders/postcss/index.d.ts +13 -27
  9. package/dist/loaders/postcss/index.js +6 -6
  10. package/dist/loaders/sass/index.d.ts +14 -4
  11. package/dist/loaders/sass/index.js +6 -6
  12. package/dist/loaders/sourcemap.d.ts +13 -24
  13. package/dist/loaders/sourcemap.js +1 -1
  14. package/dist/loaders/stylus/index.d.ts +14 -7
  15. package/dist/loaders/stylus/index.js +2 -2
  16. package/dist/loaders/tailwindcss-oxide.d.ts +13 -5
  17. package/dist/loaders/tailwindcss-oxide.js +1 -1
  18. package/dist/minifiers/cssnano.d.ts +13 -30
  19. package/dist/minifiers/cssnano.js +1 -1
  20. package/dist/minifiers/lightningcss.d.ts +13 -29
  21. package/dist/minifiers/lightningcss.js +2 -2
  22. package/dist/packem_shared/concat-CWFnPzjp.js +3 -0
  23. package/dist/packem_shared/{cssModulesTypesPlugin-CjGroK2y.js → cssModulesTypesPlugin-Bf3f6dn3.js} +2 -2
  24. package/dist/packem_shared/generate-js-exports-DKOz4w8t.js +23 -0
  25. package/dist/packem_shared/{getMap-TR-0DXUr.js → getMap-Dlan_u0E.js} +1 -1
  26. package/dist/packem_shared/hasModuleSpecifier-DKQ_-lwa.js +1 -0
  27. package/dist/packem_shared/inferModeOption-CJYqAvV-.js +1 -0
  28. package/dist/packem_shared/loadModule-B0QEI5Uu.js +1 -0
  29. package/dist/packem_shared/resolve-CEc8oUE8.js +1 -0
  30. package/dist/packem_shared/rollupCssPlugin-DFW2gy2m.js +3 -0
  31. package/dist/packem_shared/sourcemap-LKvHG-1m.js +3 -0
  32. package/dist/packem_shared/types.d-C-ij3n7X.d.ts +194 -0
  33. package/dist/utils/index.d.ts +63 -9
  34. package/dist/utils/index.js +1 -1
  35. package/package.json +21 -21
  36. package/dist/css-modules-types.d.ts +0 -38
  37. package/dist/css-plugin.d.ts +0 -44
  38. package/dist/loaders/less/importer.d.ts +0 -2
  39. package/dist/loaders/less/types.d.ts +0 -24
  40. package/dist/loaders/loader-manager.d.ts +0 -78
  41. package/dist/loaders/postcss/constants.d.ts +0 -20
  42. package/dist/loaders/postcss/icss/index.d.ts +0 -8
  43. package/dist/loaders/postcss/icss/load.d.ts +0 -5
  44. package/dist/loaders/postcss/icss/resolve.d.ts +0 -6
  45. package/dist/loaders/postcss/import/apply-conditions.d.ts +0 -10
  46. package/dist/loaders/postcss/import/apply-raws.d.ts +0 -3
  47. package/dist/loaders/postcss/import/apply-styles.d.ts +0 -10
  48. package/dist/loaders/postcss/import/constants.d.ts +0 -12
  49. package/dist/loaders/postcss/import/import-resolve.d.ts +0 -3
  50. package/dist/loaders/postcss/import/index.d.ts +0 -12
  51. package/dist/loaders/postcss/import/parser/parse-at-import.d.ts +0 -9
  52. package/dist/loaders/postcss/import/parser/parse-styles.d.ts +0 -6
  53. package/dist/loaders/postcss/import/parser/parse-stylesheet.d.ts +0 -10
  54. package/dist/loaders/postcss/import/types.d.ts +0 -95
  55. package/dist/loaders/postcss/import/utils/base64-encoded-import.d.ts +0 -3
  56. package/dist/loaders/postcss/import/utils/data-url.d.ts +0 -2
  57. package/dist/loaders/postcss/import/utils/format-import-prelude.d.ts +0 -2
  58. package/dist/loaders/postcss/import/utils/load-content.d.ts +0 -2
  59. package/dist/loaders/postcss/import/utils/process-content.d.ts +0 -4
  60. package/dist/loaders/postcss/import/utils/statement.d.ts +0 -6
  61. package/dist/loaders/postcss/load-config.d.ts +0 -6
  62. package/dist/loaders/postcss/modules/generate.d.ts +0 -11
  63. package/dist/loaders/postcss/modules/index.d.ts +0 -35
  64. package/dist/loaders/postcss/noop.d.ts +0 -22
  65. package/dist/loaders/postcss/url/generate.d.ts +0 -2
  66. package/dist/loaders/postcss/url/index.d.ts +0 -46
  67. package/dist/loaders/postcss/url/inline.d.ts +0 -20
  68. package/dist/loaders/postcss/url/url-resolve.d.ts +0 -12
  69. package/dist/loaders/postcss/url/utils.d.ts +0 -4
  70. package/dist/loaders/sass/modern/importer.d.ts +0 -3
  71. package/dist/loaders/sass/types.d.ts +0 -20
  72. package/dist/loaders/sass/utils/get-sass-compiler.d.ts +0 -8
  73. package/dist/loaders/sass/utils/get-sass-options.d.ts +0 -7
  74. package/dist/loaders/sass/utils/normalize-source-map.d.ts +0 -3
  75. package/dist/loaders/sass/utils/resolve-syntax.d.ts +0 -2
  76. package/dist/loaders/sass/utils/sass-error-factory.d.ts +0 -15
  77. package/dist/loaders/stylus/types.d.ts +0 -87
  78. package/dist/loaders/types.d.ts +0 -102
  79. package/dist/loaders/utils/ensure-auto-modules.d.ts +0 -39
  80. package/dist/loaders/utils/match-file.d.ts +0 -32
  81. package/dist/minifiers/types.d.ts +0 -64
  82. package/dist/packem_shared/concat-WcWAYbOc.js +0 -3
  83. package/dist/packem_shared/generate-js-exports-BhS4eLrN.js +0 -23
  84. package/dist/packem_shared/hasModuleSpecifier-DIZeev_W.js +0 -1
  85. package/dist/packem_shared/inferModeOption-9h3Eq6JH.js +0 -1
  86. package/dist/packem_shared/loadModule-D20jQQNu.js +0 -1
  87. package/dist/packem_shared/resolve-anj9ucIq.js +0 -1
  88. package/dist/packem_shared/rollupCssPlugin-BxRedPmA.js +0 -3
  89. package/dist/packem_shared/sourcemap-CB6ochh0.js +0 -3
  90. package/dist/types.d.ts +0 -224
  91. package/dist/utils/array-fmt.d.ts +0 -18
  92. package/dist/utils/concat.d.ts +0 -34
  93. package/dist/utils/generate-js-exports.d.ts +0 -78
  94. package/dist/utils/load-module.d.ts +0 -3
  95. package/dist/utils/options.d.ts +0 -155
  96. package/dist/utils/resolve.d.ts +0 -35
  97. package/dist/utils/safe-id.d.ts +0 -23
  98. package/dist/utils/sourcemap.d.ts +0 -42
  99. package/dist/utils/url.d.ts +0 -8
@@ -1 +1 @@
1
- import{default as o}from"../packem_shared/arrayFmt-Dek5cB7m.js";import{default as t}from"../packem_shared/concat-WcWAYbOc.js";import{default as p}from"../packem_shared/loadModule-D20jQQNu.js";import{ensurePCSSOption as n,ensurePCSSPlugins as s,inferHandlerOption as l,inferModeOption as m,inferOption as d,inferSourceMapOption as u}from"../packem_shared/inferModeOption-9h3Eq6JH.js";import{resolve as M}from"../packem_shared/resolve-anj9ucIq.js";import{default as S}from"../packem_shared/safeId-BN5akJYJ.js";import{g,m as P,s as C}from"../packem_shared/sourcemap-CB6ochh0.js";import{getUrlOfPartial as h,hasModuleSpecifier as v,normalizeUrl as y}from"../packem_shared/hasModuleSpecifier-DIZeev_W.js";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.js";import{default as t}from"../packem_shared/concat-CWFnPzjp.js";import{default as p}from"../packem_shared/loadModule-B0QEI5Uu.js";import{ensurePCSSOption as n,ensurePCSSPlugins as s,inferHandlerOption as l,inferModeOption as m,inferOption as d,inferSourceMapOption as u}from"../packem_shared/inferModeOption-CJYqAvV-.js";import{resolve as M}from"../packem_shared/resolve-CEc8oUE8.js";import{default as S}from"../packem_shared/safeId-BN5akJYJ.js";import{g,m as P,s as C}from"../packem_shared/sourcemap-LKvHG-1m.js";import{getUrlOfPartial as h,hasModuleSpecifier as v,normalizeUrl as y}from"../packem_shared/hasModuleSpecifier-DKQ_-lwa.js";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.45",
3
+ "version": "1.0.0-alpha.46",
4
4
  "description": "CSS processing plugin for packem",
5
5
  "keywords": [
6
6
  "visulima",
@@ -97,37 +97,37 @@
97
97
  ],
98
98
  "dependencies": {
99
99
  "@rollup/pluginutils": "5.3.0",
100
- "@visulima/fs": "5.0.0-alpha.12",
101
- "@visulima/package": "5.0.0-alpha.11",
102
- "@visulima/packem-share": "1.0.0-alpha.46",
100
+ "@visulima/fs": "5.0.0-alpha.24",
101
+ "@visulima/package": "5.0.0-alpha.23",
102
+ "@visulima/packem-share": "1.0.0-alpha.47",
103
103
  "@visulima/path": "3.0.0-alpha.10",
104
104
  "mlly": "1.8.2",
105
105
  "oxc-resolver": "11.19.1",
106
- "p-queue": "9.1.2",
106
+ "p-queue": "9.3.0",
107
107
  "source-map-js": "^1.2.1"
108
108
  },
109
109
  "peerDependencies": {
110
- "@csstools/css-parser-algorithms": ">=3.0.5",
111
- "@csstools/css-tokenizer": ">=3.0.4",
112
- "@csstools/postcss-slow-plugins": ">=2.0.0",
113
- "@tailwindcss/node": ">=4.1.12",
114
- "@tailwindcss/oxide": ">=4.1.12",
115
- "@visulima/css-style-inject": "1.0.0-alpha.15",
116
- "cssnano": ">=7.0.0",
110
+ "@csstools/css-parser-algorithms": ">=4.0.0",
111
+ "@csstools/css-tokenizer": ">=4.0.0",
112
+ "@csstools/postcss-slow-plugins": ">=3.0.0",
113
+ "@tailwindcss/node": ">=4.3.0",
114
+ "@tailwindcss/oxide": ">=4.3.0",
115
+ "@visulima/css-style-inject": "1.0.0-alpha.16",
116
+ "cssnano": ">=8.0.1",
117
117
  "icss-utils": ">=5.1.0",
118
- "less": ">=4.0.0",
119
- "lightningcss": ">=1.0.0",
120
- "postcss": ">=8.0.0",
118
+ "less": ">=4.6.4",
119
+ "lightningcss": ">=1.32.0",
120
+ "postcss": ">=8.5.15",
121
121
  "postcss-load-config": ">=6.0.1",
122
122
  "postcss-modules-extract-imports": ">=3.1.0",
123
- "postcss-modules-local-by-default": ">=4.0.5",
124
- "postcss-modules-scope": ">=3.2.0",
123
+ "postcss-modules-local-by-default": ">=4.2.0",
124
+ "postcss-modules-scope": ">=3.2.1",
125
125
  "postcss-modules-values": ">=4.0.0",
126
126
  "postcss-value-parser": ">=4.2.0",
127
- "rollup": ">=4.21.2",
128
- "sass": ">=1.0.0",
129
- "sass-embedded": ">=1.79.4",
130
- "stylus": ">=0.60.0"
127
+ "rollup": ">=4.60.4",
128
+ "sass": ">=1.100.0",
129
+ "sass-embedded": ">=1.100.0",
130
+ "stylus": ">=0.64.0"
131
131
  },
132
132
  "peerDependenciesMeta": {
133
133
  "@ckeditor/typedoc-plugins": {
@@ -1,38 +0,0 @@
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;
@@ -1,44 +0,0 @@
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;
@@ -1,2 +0,0 @@
1
- declare const importer: (alias: Record<string, string>) => Less.Plugin;
2
- export default importer;
@@ -1,24 +0,0 @@
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,78 +0,0 @@
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;
@@ -1,20 +0,0 @@
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;
@@ -1,8 +0,0 @@
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;
@@ -1,5 +0,0 @@
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;
@@ -1,6 +0,0 @@
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;
@@ -1,10 +0,0 @@
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;
@@ -1,3 +0,0 @@
1
- import type { Stylesheet } from "./types.d.ts";
2
- declare const applyRaws: (stylesheet: Stylesheet) => void;
3
- export default applyRaws;
@@ -1,10 +0,0 @@
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;
@@ -1,12 +0,0 @@
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;
@@ -1,3 +0,0 @@
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;
@@ -1,12 +0,0 @@
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;
@@ -1,9 +0,0 @@
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;
@@ -1,6 +0,0 @@
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;
@@ -1,10 +0,0 @@
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;
@@ -1,95 +0,0 @@
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
- };
@@ -1,3 +0,0 @@
1
- import type { Condition } from "../types.d.ts";
2
- declare const base64EncodedConditionalImport: (prelude: string, conditions: Condition[]) => string;
3
- export default base64EncodedConditionalImport;
@@ -1,2 +0,0 @@
1
- export declare const isValidDataURL: (url?: string) => boolean;
2
- export declare const dataURLContents: (url: string) => string;
@@ -1,2 +0,0 @@
1
- declare const formatImportPrelude: (layer: string | undefined, media: string | undefined, supports: string | undefined, scope: string | undefined) => string;
2
- export default formatImportPrelude;
@@ -1,2 +0,0 @@
1
- declare const loadContent: (filename: string) => string;
2
- export default loadContent;
@@ -1,4 +0,0 @@
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;
@@ -1,6 +0,0 @@
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,6 +0,0 @@
1
- import type { Environment } from "@visulima/packem-share/types";
2
- import type { RollupLogger } from "@visulima/packem-share/utils";
3
- import type { Result } from "postcss-load-config";
4
- import type { PostCSSConfigLoaderOptions } from "../../types.d.ts";
5
- declare const loadConfig: (id: string, cwd: string, environment: Environment, logger: RollupLogger, options?: PostCSSConfigLoaderOptions | false) => Promise<Result>;
6
- export default loadConfig;
@@ -1,11 +0,0 @@
1
- /**
2
- * For reference, postcss-modules's default:
3
- * https://github.com/madyankin/postcss-modules/blob/v6.0.0/src/scoping.js#L41
4
- *
5
- * FYI LightningCSS recommends hash first for grid compatibility,
6
- * https://github.com/parcel-bundler/lightningcss/blob/v1.23.0/website/pages/css-modules.md?plain=1#L237-L238
7
- *
8
- * but PostCSS CSS Modules doesn't seem to transform Grid names
9
- */
10
- declare const generate: (placeholder?: string) => (local: string, file: string, css: string) => string;
11
- export default generate;
@@ -1,35 +0,0 @@
1
- import type { Plugin } from "postcss";
2
- import type Processor from "postcss/lib/processor";
3
- import type { AutoModules } from "../../../types.d.ts";
4
- declare const modules: (options: ModulesOptions) => (Plugin | Processor)[];
5
- /** Options for [CSS Modules](https://github.com/css-modules/css-modules) */
6
- export interface ModulesOptions {
7
- /** Export global classes */
8
- exportGlobals?: boolean;
9
- /** Fail on wrong order of composition */
10
- failOnWrongOrder?: boolean;
11
- /**
12
- * Placeholder or function for scoped name generation.
13
- * Allowed blocks for placeholder:
14
- * - `[dir]`: The directory name of the asset.
15
- * - `[name]`: The file name of the asset excluding any extension.
16
- * - `[local]`: The original value of the selector.
17
- * - `[hash(:&lt;num>)]`: A hash based on the name and content of the asset (with optional length).
18
- * @default "[name]_[local]__[hash:8]"
19
- */
20
- generateScopedName?: string | ((name: string, file: string, css: string) => string);
21
- /**
22
- * Files to include for [CSS Modules](https://github.com/css-modules/css-modules)
23
- * for files named `[name].module.[ext]`
24
- * (e.g. `foo.module.css`, `bar.module.stylus`),
25
- * or pass your own function or regular expression
26
- * @default false
27
- */
28
- include?: AutoModules;
29
- /**
30
- * Default mode for classes
31
- * @default "local"
32
- */
33
- mode?: "global" | "local" | "pure";
34
- }
35
- export default modules;
@@ -1,22 +0,0 @@
1
- import type { PluginCreator } from "postcss";
2
- /**
3
- * No-operation PostCSS plugin used as a fallback when no other plugins are configured.
4
- *
5
- * This plugin prevents PostCSS from showing warnings about running without any plugins.
6
- * It performs no transformations on the CSS - it simply ensures PostCSS has at least
7
- * one plugin to execute, which is required for proper PostCSS operation.
8
- *
9
- * The plugin is automatically added when:
10
- * - No user plugins are configured
11
- * - No config file plugins are found
12
- * - No built-in plugins (import, url, modules) are enabled
13
- * @example
14
- * ```typescript
15
- * // Used internally when plugins array is empty
16
- * if (plugins.length === 0) {
17
- * plugins.push(postcssNoop);
18
- * }
19
- * ```
20
- */
21
- declare const postcssNoop: PluginCreator<unknown>;
22
- export default postcssNoop;
@@ -1,2 +0,0 @@
1
- declare const generate: (placeholder: string, file: string, source: Uint8Array) => string;
2
- export default generate;