@visulima/rollup-plugin-css 1.0.0-alpha.30 → 1.0.0-alpha.31
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.
- package/CHANGELOG.md +11 -0
- package/dist/css-modules-types.d.ts +38 -0
- package/dist/css-plugin.d.ts +44 -0
- package/dist/index.d.ts +40 -19
- package/dist/loaders/less/importer.d.ts +2 -0
- package/dist/loaders/less/index.d.ts +36 -15
- package/dist/loaders/less/types.d.ts +24 -0
- package/dist/loaders/lightningcss.d.ts +13 -15
- package/dist/loaders/loader-manager.d.ts +78 -0
- package/dist/loaders/postcss/constants.d.ts +20 -0
- package/dist/loaders/postcss/icss/index.d.ts +8 -0
- package/dist/loaders/postcss/icss/load.d.ts +5 -0
- package/dist/loaders/postcss/icss/resolve.d.ts +6 -0
- package/dist/loaders/postcss/import/apply-conditions.d.ts +10 -0
- package/dist/loaders/postcss/import/apply-raws.d.ts +3 -0
- package/dist/loaders/postcss/import/apply-styles.d.ts +10 -0
- package/dist/loaders/postcss/import/constants.d.ts +12 -0
- package/dist/loaders/postcss/import/import-resolve.d.ts +3 -0
- package/dist/loaders/postcss/import/index.d.ts +12 -0
- package/dist/loaders/postcss/import/parser/parse-at-import.d.ts +9 -0
- package/dist/loaders/postcss/import/parser/parse-styles.d.ts +6 -0
- package/dist/loaders/postcss/import/parser/parse-stylesheet.d.ts +10 -0
- package/dist/loaders/postcss/import/types.d.ts +95 -0
- package/dist/loaders/postcss/import/utils/base64-encoded-import.d.ts +3 -0
- package/dist/loaders/postcss/import/utils/data-url.d.ts +2 -0
- package/dist/loaders/postcss/import/utils/format-import-prelude.d.ts +2 -0
- package/dist/loaders/postcss/import/utils/load-content.d.ts +2 -0
- package/dist/loaders/postcss/import/utils/process-content.d.ts +4 -0
- package/dist/loaders/postcss/import/utils/statement.d.ts +6 -0
- package/dist/loaders/postcss/index.d.ts +27 -15
- package/dist/loaders/postcss/load-config.d.ts +6 -0
- package/dist/loaders/postcss/modules/generate.d.ts +11 -0
- package/dist/loaders/postcss/modules/index.d.ts +35 -0
- package/dist/loaders/postcss/noop.d.ts +22 -0
- package/dist/loaders/postcss/url/generate.d.ts +2 -0
- package/dist/loaders/postcss/url/index.d.ts +46 -0
- package/dist/loaders/postcss/url/inline.d.ts +20 -0
- package/dist/loaders/postcss/url/url-resolve.d.ts +12 -0
- package/dist/loaders/postcss/url/utils.d.ts +4 -0
- package/dist/loaders/sass/index.d.ts +4 -16
- package/dist/loaders/sass/modern/importer.d.ts +3 -0
- package/dist/loaders/sass/types.d.ts +20 -0
- package/dist/loaders/sass/utils/get-sass-compiler.d.ts +8 -0
- package/dist/loaders/sass/utils/get-sass-options.d.ts +7 -0
- package/dist/loaders/sass/utils/normalize-source-map.d.ts +3 -0
- package/dist/loaders/sass/utils/resolve-syntax.d.ts +2 -0
- package/dist/loaders/sass/utils/sass-error-factory.d.ts +15 -0
- package/dist/loaders/sourcemap.d.ts +24 -15
- package/dist/loaders/stylus/index.d.ts +7 -16
- package/dist/loaders/stylus/types.d.ts +87 -0
- package/dist/loaders/tailwindcss-oxide.d.ts +5 -15
- package/dist/loaders/types.d.ts +102 -0
- package/dist/loaders/utils/ensure-auto-modules.d.ts +39 -0
- package/dist/loaders/utils/match-file.d.ts +32 -0
- package/dist/minifiers/cssnano.d.ts +30 -15
- package/dist/minifiers/lightningcss.d.ts +29 -15
- package/dist/minifiers/types.d.ts +64 -0
- package/dist/types.d.ts +224 -0
- package/dist/utils/array-fmt.d.ts +18 -0
- package/dist/utils/concat.d.ts +34 -0
- package/dist/utils/generate-js-exports.d.ts +78 -0
- package/dist/utils/index.d.ts +9 -72
- package/dist/utils/load-module.d.ts +3 -0
- package/dist/utils/options.d.ts +155 -0
- package/dist/utils/resolve.d.ts +35 -0
- package/dist/utils/safe-id.d.ts +23 -0
- package/dist/utils/sourcemap.d.ts +42 -0
- package/dist/utils/url.d.ts +8 -0
- package/package.json +5 -5
- package/dist/packem_shared/types-B7InbTq8.d.ts +0 -206
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { RollupLogger } from "@visulima/packem-share/utils";
|
|
2
|
+
import type { Result } from "postcss-load-config";
|
|
3
|
+
import type { LoaderContext } from "../loaders/types.d.ts";
|
|
4
|
+
import type { InternalStyleOptions, PostCSSOptions, StyleOptions } from "../types.d.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Internal mode configuration for style processing.
|
|
7
|
+
*
|
|
8
|
+
* Represents the resolved mode options that determine how CSS is handled:
|
|
9
|
+
* - emit: Output raw CSS for further processing
|
|
10
|
+
* - extract: Extract CSS to separate files
|
|
11
|
+
* - inject: Inject CSS into JavaScript at runtime
|
|
12
|
+
*/
|
|
13
|
+
interface Mode {
|
|
14
|
+
/** Whether to emit raw CSS for further processing */
|
|
15
|
+
emit: InternalStyleOptions["emit"];
|
|
16
|
+
/** Whether to extract CSS to separate files (boolean or filename) */
|
|
17
|
+
extract: InternalStyleOptions["extract"];
|
|
18
|
+
/** Whether to inject CSS at runtime (boolean or injection options) */
|
|
19
|
+
inject: InternalStyleOptions["inject"];
|
|
20
|
+
/** Whether to inline CSS as strings in JavaScript */
|
|
21
|
+
inline: InternalStyleOptions["inline"];
|
|
22
|
+
}
|
|
23
|
+
/** PostCSS option types for error messages */
|
|
24
|
+
type PCSSOption = "parser" | "plugin" | "stringifier" | "syntax";
|
|
25
|
+
/**
|
|
26
|
+
* Infers and validates the CSS processing mode from user options.
|
|
27
|
+
*
|
|
28
|
+
* Converts the user-provided mode configuration into internal mode settings.
|
|
29
|
+
* Supports both simple string modes and tuple modes with additional options.
|
|
30
|
+
* @param mode User-provided mode configuration
|
|
31
|
+
* @returns Resolved mode configuration object
|
|
32
|
+
* @throws Error if an invalid mode is provided
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* // Simple mode
|
|
36
|
+
* inferModeOption('extract') // { emit: false, extract: true, inject: false }
|
|
37
|
+
*
|
|
38
|
+
* // Mode with options
|
|
39
|
+
* inferModeOption(['inject', { singleTag: true }])
|
|
40
|
+
* // { emit: false, extract: false, inject: { singleTag: true } }
|
|
41
|
+
*
|
|
42
|
+
* // Default mode (inject)
|
|
43
|
+
* inferModeOption(undefined) // { emit: false, extract: false, inject: true }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare const inferModeOption: (mode: StyleOptions["mode"]) => Mode;
|
|
47
|
+
/**
|
|
48
|
+
* Infers option values from boolean or object configurations.
|
|
49
|
+
*
|
|
50
|
+
* This utility handles the common pattern where options can be:
|
|
51
|
+
* - `true`: Enable with default settings (returns empty object)
|
|
52
|
+
* - `false`: Disable the option (returns false)
|
|
53
|
+
* - `object`: Use the provided configuration
|
|
54
|
+
* - `undefined`: Use the provided default value
|
|
55
|
+
* @param option The option value to process
|
|
56
|
+
* @param defaultValue Default value when option is undefined
|
|
57
|
+
* @returns Processed option value
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* inferOption(true, {}) // {}
|
|
61
|
+
* inferOption(false, {}) // false
|
|
62
|
+
* inferOption({ custom: 'value' }, {}) // { custom: 'value' }
|
|
63
|
+
* inferOption(undefined, { default: true }) // { default: true }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare const inferOption: <T, TDefine extends T | boolean | undefined>(option: T | boolean | undefined, defaultValue: TDefine) => OptionType<T, TDefine>;
|
|
67
|
+
/**
|
|
68
|
+
* Infers source map configuration from user options.
|
|
69
|
+
*
|
|
70
|
+
* Processes source map options which can be specified as:
|
|
71
|
+
* - `boolean`: Enable/disable with default settings
|
|
72
|
+
* - `"inline"`: Enable with inline source maps
|
|
73
|
+
* - `[boolean | "inline", SourceMapOptions]`: Enable with custom options
|
|
74
|
+
* @param sourceMap User-provided source map configuration
|
|
75
|
+
* @returns Processed source map configuration for loaders
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* inferSourceMapOption(true) // { content: true, inline: false }
|
|
79
|
+
* inferSourceMapOption('inline') // { content: true, inline: true }
|
|
80
|
+
* inferSourceMapOption([true, { transform: fn }]) // { content: true, inline: false, transform: fn }
|
|
81
|
+
* inferSourceMapOption(false) // false
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare const inferSourceMapOption: (sourceMap: StyleOptions["sourceMap"]) => LoaderContext["sourceMap"];
|
|
85
|
+
/**
|
|
86
|
+
* Infers handler options that support alias configuration.
|
|
87
|
+
*
|
|
88
|
+
* Processes options for handlers (like import/url resolvers) that can use aliases.
|
|
89
|
+
* If aliases are provided and the option doesn't already have aliases, they are merged.
|
|
90
|
+
* @param option Handler option configuration
|
|
91
|
+
* @param alias Path aliases to merge if not already present
|
|
92
|
+
* @returns Processed handler option with aliases
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const aliases = { '@': '/src' };
|
|
96
|
+
*
|
|
97
|
+
* inferHandlerOption(true, aliases) // { alias: { '@': '/src' } }
|
|
98
|
+
* inferHandlerOption({ custom: true }, aliases) // { custom: true, alias: { '@': '/src' } }
|
|
99
|
+
* inferHandlerOption({ alias: { '~': '/lib' } }, aliases) // { alias: { '~': '/lib' } }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare const inferHandlerOption: <T extends {
|
|
103
|
+
alias?: Record<string, string>;
|
|
104
|
+
}>(option: T | boolean | undefined, alias: T["alias"]) => T | false;
|
|
105
|
+
/**
|
|
106
|
+
* Ensures a PostCSS option is properly loaded and resolved.
|
|
107
|
+
*
|
|
108
|
+
* PostCSS options can be specified as strings (module names) or objects.
|
|
109
|
+
* This function loads string-based options as modules and validates they exist.
|
|
110
|
+
* @param option PostCSS option (string module name or object)
|
|
111
|
+
* @param type Type of PostCSS option for error messages
|
|
112
|
+
* @param cwd Current working directory for module resolution
|
|
113
|
+
* @param logger Optional logger for warnings
|
|
114
|
+
* @returns Promise resolving to the loaded PostCSS option
|
|
115
|
+
* @throws Error if string module cannot be loaded
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* // Load parser module
|
|
119
|
+
* await ensurePCSSOption('sugarss', 'parser', process.cwd()) // Loaded sugarss module
|
|
120
|
+
*
|
|
121
|
+
* // Pass through object
|
|
122
|
+
* await ensurePCSSOption(parserObject, 'parser', process.cwd()) // parserObject
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export declare const ensurePCSSOption: <T>(option: T | string, type: PCSSOption, cwd: string, logger: RollupLogger) => Promise<T>;
|
|
126
|
+
/**
|
|
127
|
+
* Ensures PostCSS plugins are properly loaded and configured.
|
|
128
|
+
*
|
|
129
|
+
* PostCSS plugins can be specified in various formats:
|
|
130
|
+
* - String module names
|
|
131
|
+
* - Plugin objects
|
|
132
|
+
* - Arrays of [plugin, options]
|
|
133
|
+
* - Mixed arrays of the above
|
|
134
|
+
*
|
|
135
|
+
* This function normalizes all formats and loads string-based plugins as modules.
|
|
136
|
+
* @param plugins PostCSS plugins configuration
|
|
137
|
+
* @param cwd Current working directory for module resolution
|
|
138
|
+
* @param logger Optional logger for warnings
|
|
139
|
+
* @returns Promise resolving to array of loaded PostCSS plugins
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* // Load plugins from various formats
|
|
143
|
+
* await ensurePCSSPlugins([
|
|
144
|
+
* 'autoprefixer', // String module name
|
|
145
|
+
* ['cssnano', { preset: 'default' }], // Plugin with options
|
|
146
|
+
* pluginObject // Direct plugin object
|
|
147
|
+
* ], process.cwd())
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
export declare const ensurePCSSPlugins: (plugins: PostCSSOptions["plugins"], cwd: string, logger: RollupLogger) => Promise<Result["plugins"]>;
|
|
151
|
+
/**
|
|
152
|
+
* Type alias for option function return types
|
|
153
|
+
*/
|
|
154
|
+
export type OptionType<T, TDefine extends T | boolean | undefined> = T | TDefine | false;
|
|
155
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { NapiResolveOptions } from "oxc-resolver";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves module identifiers using advanced resolution strategies.
|
|
4
|
+
*
|
|
5
|
+
* This function implements sophisticated module resolution logic using the OXC resolver,
|
|
6
|
+
* supporting various resolution strategies and providing detailed error reporting.
|
|
7
|
+
* It's primarily used for resolving CSS imports, PostCSS plugins, and other dependencies.
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Multiple base directory support
|
|
11
|
+
* - Configurable file extensions
|
|
12
|
+
* - Symlink resolution
|
|
13
|
+
* - Detailed error reporting and debugging
|
|
14
|
+
* - Fallback resolution strategies
|
|
15
|
+
* @param ids Array of module identifiers to resolve
|
|
16
|
+
* @param userOptions Resolution configuration options
|
|
17
|
+
* @returns Absolute path to the resolved module
|
|
18
|
+
* @throws Error if no module can be resolved
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Resolving a PostCSS plugin
|
|
22
|
+
* const pluginPath = resolve(['autoprefixer'], {
|
|
23
|
+
* caller: 'PostCSS',
|
|
24
|
+
* baseDirs: ['/project/node_modules'],
|
|
25
|
+
* extensions: ['.js', '.mjs']
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const resolve: (ids: string[], userOptions: ResolveOptions) => string;
|
|
30
|
+
export interface ResolveOptions extends NapiResolveOptions {
|
|
31
|
+
/** directories to begin resolving from (defaults to `[__dirname]`) */
|
|
32
|
+
baseDirs?: string[];
|
|
33
|
+
/** name of the caller for error message (default to `Resolver`) */
|
|
34
|
+
caller?: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a safe, unique JavaScript identifier from an input string.
|
|
3
|
+
*
|
|
4
|
+
* Creates a legal JavaScript identifier by:
|
|
5
|
+
* 1. Combining the input ID with a salt and additional salt parameters
|
|
6
|
+
* 2. Generating a hash of the combined string
|
|
7
|
+
* 3. Appending the hash to the ID to ensure uniqueness
|
|
8
|
+
* 4. Making the result a legal JavaScript identifier
|
|
9
|
+
*
|
|
10
|
+
* This is useful for generating variable names that won't conflict with
|
|
11
|
+
* reserved words or other identifiers in the generated code.
|
|
12
|
+
* @param id Base identifier string
|
|
13
|
+
* @param salt Additional salt values for uniqueness
|
|
14
|
+
* @returns Legal JavaScript identifier with hash suffix
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* safeId('myVar') // "myVar_a1b2c3d4"
|
|
18
|
+
* safeId('class', 'module') // "class_e5f6g7h8"
|
|
19
|
+
* safeId('my-component', 'css') // "my_component_i9j0k1l2"
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare const safeId: (id: string, ...salt: string[]) => string;
|
|
23
|
+
export default safeId;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { RawSourceMap } from "source-map-js";
|
|
2
|
+
import { SourceMapConsumer } from "source-map-js";
|
|
3
|
+
declare class MapModifier {
|
|
4
|
+
private readonly map?;
|
|
5
|
+
constructor(map?: RawSourceMap | string);
|
|
6
|
+
modify(f: (m: RawSourceMap) => void): this;
|
|
7
|
+
modifySources(op: (source: string) => string): this;
|
|
8
|
+
resolve(directory?: string): this;
|
|
9
|
+
relative(directory?: string): this;
|
|
10
|
+
toObject(): RawSourceMap | undefined;
|
|
11
|
+
toString(): string | undefined;
|
|
12
|
+
toConsumer(): SourceMapConsumer | undefined;
|
|
13
|
+
toCommentData(): string;
|
|
14
|
+
toCommentFile(fileName: string): string;
|
|
15
|
+
}
|
|
16
|
+
export declare const getMap: (code: string, id?: string) => Promise<string | undefined>;
|
|
17
|
+
export declare const stripMap: (code: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a MapModifier instance for source map manipulation.
|
|
20
|
+
*
|
|
21
|
+
* This utility function provides a convenient way to create MapModifier instances
|
|
22
|
+
* for working with source maps in CSS processing pipelines. The MapModifier class
|
|
23
|
+
* offers comprehensive source map manipulation capabilities including:
|
|
24
|
+
* - Path resolution and relativization
|
|
25
|
+
* - Source map merging and modification
|
|
26
|
+
* - Format conversion (object, string, consumer)
|
|
27
|
+
* - Comment generation for inline or external maps
|
|
28
|
+
* @param map Source map input (raw object or JSON string)
|
|
29
|
+
* @returns MapModifier instance for source map operations
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* // Working with source map objects
|
|
33
|
+
* const modifier = mm(rawSourceMap);
|
|
34
|
+
* modifier.resolve('/project/src').relative('/project');
|
|
35
|
+
*
|
|
36
|
+
* // Converting to different formats
|
|
37
|
+
* const mapString = modifier.toString();
|
|
38
|
+
* const consumer = modifier.toConsumer();
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare const mm: (map?: RawSourceMap | string) => MapModifier;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the URL starts with a tilde followed by a digit, '@', or a letter (case-insensitive)
|
|
3
|
+
* @param url
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export declare const hasModuleSpecifier: (url: string) => boolean;
|
|
7
|
+
export declare const getUrlOfPartial: (url: string) => string;
|
|
8
|
+
export declare const normalizeUrl: (url: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/rollup-plugin-css",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.31",
|
|
4
4
|
"description": "CSS processing plugin for packem",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visulima",
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
],
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@rollup/pluginutils": "5.3.0",
|
|
100
|
-
"@visulima/fs": "
|
|
101
|
-
"@visulima/package": "
|
|
102
|
-
"@visulima/packem-share": "1.0.0-alpha.
|
|
103
|
-
"@visulima/path": "
|
|
100
|
+
"@visulima/fs": "5.0.0-alpha.12",
|
|
101
|
+
"@visulima/package": "5.0.0-alpha.11",
|
|
102
|
+
"@visulima/packem-share": "1.0.0-alpha.32",
|
|
103
|
+
"@visulima/path": "3.0.0-alpha.10",
|
|
104
104
|
"mlly": "1.8.2",
|
|
105
105
|
"oxc-resolver": "11.19.1",
|
|
106
106
|
"p-queue": "9.1.2",
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { Options } from 'cssnano';
|
|
2
|
-
import { TransformOptions, CustomAtRules } from 'lightningcss';
|
|
3
|
-
import { Node, AcceptedPlugin, PluginCreator } from 'postcss';
|
|
4
|
-
import { Config } from 'postcss-load-config';
|
|
5
|
-
import { Environment } from '@visulima/packem-share/types';
|
|
6
|
-
import { StringOptions as StringOptions$1 } from 'sass';
|
|
7
|
-
import { StringOptions } from 'sass-embedded';
|
|
8
|
-
import { RenderOptions } from 'stylus';
|
|
9
|
-
import { RollupLogger } from '@visulima/packem-share/utils';
|
|
10
|
-
import { PluginContext, CustomPluginOptions } from 'rollup';
|
|
11
|
-
import { RawSourceMap } from 'source-map-js';
|
|
12
|
-
|
|
13
|
-
type LESSLoaderOptions = Less.Options;
|
|
14
|
-
|
|
15
|
-
type ImportResolve = (url: string, basedir: string, extensions: string[], atRule: Node) => Promise<string> | string;
|
|
16
|
-
|
|
17
|
-
interface ImportOptions {
|
|
18
|
-
alias: Record<string, string>;
|
|
19
|
-
debug?: boolean;
|
|
20
|
-
extensions: string[];
|
|
21
|
-
filter?: (id: string) => boolean;
|
|
22
|
-
load: (filename: string, importOptions: ImportOptions) => Promise<string> | string;
|
|
23
|
-
plugins: AcceptedPlugin[];
|
|
24
|
-
resolve: ImportResolve;
|
|
25
|
-
skipDuplicates?: boolean | undefined;
|
|
26
|
-
warnOnEmpty?: boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface ModulesOptions {
|
|
30
|
-
exportGlobals?: boolean;
|
|
31
|
-
failOnWrongOrder?: boolean;
|
|
32
|
-
generateScopedName?: string | ((name: string, file: string, css: string) => string);
|
|
33
|
-
include?: AutoModules;
|
|
34
|
-
mode?: "global" | "local" | "pure";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface UrlFile {
|
|
38
|
-
from: string;
|
|
39
|
-
source: Uint8Array;
|
|
40
|
-
urlQuery?: string;
|
|
41
|
-
}
|
|
42
|
-
type UrlResolve = (inputUrl: string, baseDirectories: string[]) => Promise<UrlFile>;
|
|
43
|
-
|
|
44
|
-
interface UrlOptions {
|
|
45
|
-
alias?: Record<string, string>;
|
|
46
|
-
assetDir?: string | ((original: string, resolved: string, file: string) => string);
|
|
47
|
-
hash?: boolean | string;
|
|
48
|
-
inline?: boolean;
|
|
49
|
-
publicPath?: string | ((original: string, resolved: string, file: string) => string);
|
|
50
|
-
resolve?: UrlResolve;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
type SassLoaderContext = {
|
|
54
|
-
environment: Environment;
|
|
55
|
-
resourcePath: string;
|
|
56
|
-
rootContext: string;
|
|
57
|
-
};
|
|
58
|
-
type SassLoaderOptions = {
|
|
59
|
-
additionalData: string | ((content: string | Buffer, loaderContext: SassLoaderContext) => Promise<string>) | ((content: string | Buffer, loaderContext: SassLoaderContext) => string);
|
|
60
|
-
implementation?: "sass-embedded" | "sass";
|
|
61
|
-
warnRuleAsWarning?: boolean;
|
|
62
|
-
} & (Omit<StringOptions<"sync">, "charset" | "indentedSyntax"> | Omit<StringOptions$1<"sync">, "charset" | "indentedSyntax">);
|
|
63
|
-
|
|
64
|
-
type StylusLoaderContext = {
|
|
65
|
-
environment: Environment;
|
|
66
|
-
resourcePath: string;
|
|
67
|
-
rootContext: string;
|
|
68
|
-
};
|
|
69
|
-
type StylusPlugin = string | ((renderer: unknown) => void);
|
|
70
|
-
type StylusDefinition = [string, unknown] | [string, unknown, boolean];
|
|
71
|
-
type StylusLoaderOptions = {
|
|
72
|
-
additionalData?: string | ((content: string, loaderContext: StylusLoaderContext) => Promise<string> | string);
|
|
73
|
-
disableCache?: boolean;
|
|
74
|
-
hoistAtrules?: boolean;
|
|
75
|
-
implementation?: string | ((code: string, options?: unknown) => unknown);
|
|
76
|
-
import?: string[];
|
|
77
|
-
include?: string[];
|
|
78
|
-
includeCSS?: boolean;
|
|
79
|
-
lineNumbers?: boolean;
|
|
80
|
-
define?: Record<string, unknown> | StylusDefinition[];
|
|
81
|
-
use?: StylusPlugin[];
|
|
82
|
-
} & RenderOptions;
|
|
83
|
-
|
|
84
|
-
interface Extracted {
|
|
85
|
-
css: string;
|
|
86
|
-
id: string;
|
|
87
|
-
map?: string;
|
|
88
|
-
}
|
|
89
|
-
interface Loader<T = Record<string, unknown>> {
|
|
90
|
-
alwaysProcess?: boolean;
|
|
91
|
-
name: string;
|
|
92
|
-
process: (this: LoaderContext<T>, payload: Payload) => Payload | Promise<Payload>;
|
|
93
|
-
test?: RegExp | ((file: string) => boolean);
|
|
94
|
-
}
|
|
95
|
-
interface LoaderContext<T = Record<string, unknown>> {
|
|
96
|
-
readonly alias?: Record<string, string>;
|
|
97
|
-
readonly assets: Map<string, Uint8Array>;
|
|
98
|
-
readonly autoModules: InternalStyleOptions["autoModules"];
|
|
99
|
-
readonly browserTargets: string[];
|
|
100
|
-
readonly cwd?: string;
|
|
101
|
-
readonly debug?: boolean;
|
|
102
|
-
readonly deps: Set<string>;
|
|
103
|
-
readonly dts: InternalStyleOptions["dts"];
|
|
104
|
-
readonly emit: InternalStyleOptions["emit"];
|
|
105
|
-
readonly environment: Environment;
|
|
106
|
-
readonly extensions: InternalStyleOptions["extensions"];
|
|
107
|
-
readonly extract: InternalStyleOptions["extract"];
|
|
108
|
-
readonly id: string;
|
|
109
|
-
readonly inject: InternalStyleOptions["inject"];
|
|
110
|
-
readonly inline: InternalStyleOptions["inline"];
|
|
111
|
-
readonly logger: RollupLogger;
|
|
112
|
-
readonly namedExports: InternalStyleOptions["namedExports"];
|
|
113
|
-
readonly options: T;
|
|
114
|
-
readonly plugin: PluginContext;
|
|
115
|
-
readonly sourceDir?: string;
|
|
116
|
-
readonly sourceMap: false | (SourceMapOptions & {
|
|
117
|
-
inline: boolean;
|
|
118
|
-
});
|
|
119
|
-
readonly useSourcemap: boolean;
|
|
120
|
-
}
|
|
121
|
-
interface Payload {
|
|
122
|
-
code: string;
|
|
123
|
-
dts?: string;
|
|
124
|
-
extracted?: Extracted;
|
|
125
|
-
map?: string;
|
|
126
|
-
meta?: CustomPluginOptions;
|
|
127
|
-
}
|
|
128
|
-
interface SourceMapOptions {
|
|
129
|
-
content?: boolean;
|
|
130
|
-
transform?: (map: RawSourceMap, name?: string) => void;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
type MinifierContext = {
|
|
134
|
-
readonly browserTargets: string[];
|
|
135
|
-
readonly logger: RollupLogger;
|
|
136
|
-
};
|
|
137
|
-
interface Minifier<Options = Record<string, any>> {
|
|
138
|
-
handler: (this: MinifierContext, data: ExtractedData, sourceMap: LoaderContext["sourceMap"], options: Options) => Promise<ExtractedData>;
|
|
139
|
-
name: string;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
type AutoModules = RegExp | boolean | ((id: string) => boolean);
|
|
143
|
-
interface ExtractedData {
|
|
144
|
-
css: string;
|
|
145
|
-
map?: string;
|
|
146
|
-
name: string;
|
|
147
|
-
}
|
|
148
|
-
interface InjectOptions {
|
|
149
|
-
attributes?: Record<string, string>;
|
|
150
|
-
container?: string;
|
|
151
|
-
method?: string;
|
|
152
|
-
package?: string;
|
|
153
|
-
prepend?: boolean;
|
|
154
|
-
singleTag?: boolean;
|
|
155
|
-
treeshakeable?: boolean;
|
|
156
|
-
}
|
|
157
|
-
interface InternalStyleOptions extends StyleOptions {
|
|
158
|
-
emit: boolean;
|
|
159
|
-
extensions: NonNullable<StyleOptions["extensions"]>;
|
|
160
|
-
extract: boolean | string;
|
|
161
|
-
inject: InjectOptions | boolean | ((varname: string, id: string, output: string[]) => string);
|
|
162
|
-
inline: boolean;
|
|
163
|
-
}
|
|
164
|
-
type LightningCSSOptions = Omit<TransformOptions<CustomAtRules>, "code" | "cssModules" | "filename" | "minify" | "targets"> & {
|
|
165
|
-
modules?: TransformOptions<CustomAtRules>["cssModules"] & {
|
|
166
|
-
include?: AutoModules;
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
interface PostCSSConfigLoaderOptions {
|
|
170
|
-
ctx?: Record<string, unknown>;
|
|
171
|
-
path?: string;
|
|
172
|
-
}
|
|
173
|
-
interface PostCSSOptions {
|
|
174
|
-
config?: PostCSSConfigLoaderOptions | false;
|
|
175
|
-
import?: Partial<ImportOptions> | false;
|
|
176
|
-
modules?: ModulesOptions | boolean;
|
|
177
|
-
parser?: Config["parser"] | string;
|
|
178
|
-
plugins?: (AcceptedPlugin | string | [PluginCreator<unknown> | string, Record<string, unknown>] | [PluginCreator<unknown> | string] | null | undefined)[] | Record<string, unknown>;
|
|
179
|
-
stringifier?: Config["stringifier"] | string;
|
|
180
|
-
syntax?: Config["syntax"] | string;
|
|
181
|
-
to?: Config["to"];
|
|
182
|
-
url?: Partial<UrlOptions> | false;
|
|
183
|
-
}
|
|
184
|
-
interface StyleOptions {
|
|
185
|
-
alias?: Record<string, string>;
|
|
186
|
-
autoModules?: AutoModules;
|
|
187
|
-
cssnano?: Options;
|
|
188
|
-
dts?: boolean;
|
|
189
|
-
exclude?: ReadonlyArray<RegExp | string> | RegExp | string | undefined;
|
|
190
|
-
extensions?: string[];
|
|
191
|
-
include?: ReadonlyArray<RegExp | string> | RegExp | string | undefined;
|
|
192
|
-
less?: LESSLoaderOptions;
|
|
193
|
-
lightningcss?: LightningCSSOptions;
|
|
194
|
-
loaders?: Loader[];
|
|
195
|
-
minifier?: Minifier;
|
|
196
|
-
mode?: "emit" | "extract" | "inject" | "inline" | ["extract", string] | ["inject", InjectOptions | ((varname: string, id: string) => string)];
|
|
197
|
-
namedExports?: boolean | ((name: string) => string);
|
|
198
|
-
onExtract?: (data: ExtractedData) => boolean;
|
|
199
|
-
onImport?: (code: string, id: string) => void;
|
|
200
|
-
postcss?: PostCSSOptions;
|
|
201
|
-
sass?: SassLoaderOptions;
|
|
202
|
-
sourceMap?: boolean | "inline" | [boolean | "inline", SourceMapOptions] | [boolean | "inline"];
|
|
203
|
-
stylus?: StylusLoaderOptions;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export type { AutoModules as A, ExtractedData as E, InjectOptions as I, LightningCSSOptions as L, Minifier as M, PostCSSConfigLoaderOptions as P, StyleOptions as S, InternalStyleOptions as a, PostCSSOptions as b, Loader as c, LESSLoaderOptions as d, SassLoaderOptions as e, SassLoaderContext as f, StylusLoaderOptions as g, StylusDefinition as h, StylusLoaderContext as i, StylusPlugin as j, Extracted as k, LoaderContext as l };
|