Skip to content

Commit 264e54f

Browse files
committed
feat: update interface and support feature opts 🍡
1 parent ec88df8 commit 264e54f

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

src/interface.ts

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,41 @@ type Filter = string | RegExp
88
type Implementation = typeof import('lightningcss')
99
type TransformOptions = InternalTransformOptions<CustomAtRules>
1010

11+
// feature options
12+
type TransformFeature = Pick<TransformOptions, 'include' | 'exclude'>
13+
interface IFeatureOptions {
14+
features?: TransformFeature
15+
}
16+
1117
// minify plugin
12-
type AllowTransformOpts = Omit<
18+
type AllowMinifyOpts = Omit<
1319
TransformOptions,
14-
'filename' | 'code' | 'minify' | 'cssModules' | 'targets'
20+
| 'filename'
21+
| 'code'
22+
| 'minify'
23+
| 'cssModules'
24+
| 'targets'
25+
| 'inputSourceMap'
26+
| 'include'
27+
| 'exclude'
28+
1529
/**
16-
* allow
30+
* support
1731
*
1832
* @sourceMap
19-
* @targets
33+
* @projectRoot
2034
* @drafts
35+
* @nonStandard
2136
* @analyzeDependencies
2237
* @pseudoClasses
2338
* @unusedSymbols
2439
* @errorRecovery
40+
* @visitor
41+
* @customAtRules
2542
*/
2643
>
2744

28-
export interface IMinifyPluginOpts extends AllowTransformOpts {
45+
export interface IMinifyPluginOpts extends AllowMinifyOpts, IFeatureOptions {
2946
include?: Filter | Filter[]
3047
exclude?: Filter | Filter[]
3148
targets?: string | string[]
@@ -37,17 +54,22 @@ export interface IMinifyPluginOpts extends AllowTransformOpts {
3754
type AllowLoaderTransformOpts = Omit<
3855
TransformOptions,
3956
'filename' | 'code' | 'targets' | 'inputSourceMap'
57+
4058
/**
41-
* allow
59+
* support
4260
*
4361
* @cssModules
4462
* @minify
4563
* @sourceMap
64+
* @projectRoot
4665
* @drafts
66+
* @nonStandard
4767
* @analyzeDependencies
4868
* @pseudoClasses
4969
* @unusedSymbols
5070
* @errorRecovery
71+
* @visitor
72+
* @customAtRules
5173
*/
5274
>
5375

src/minify.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export class LightningCssMinifyPlugin {
9090
exclude,
9191
test: testRegExp,
9292
targets: userTargets,
93+
features: transformFeatureOptions,
9394
...transformOptions
9495
} = this.options
9596

@@ -118,6 +119,7 @@ export class LightningCssMinifyPlugin {
118119
minify: true,
119120
sourceMap: sourcemap,
120121
targets,
122+
...transformFeatureOptions,
121123
...transformOptions,
122124
})
123125
const codeString = result.code.toString()

0 commit comments

Comments
 (0)