You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8178b00
Browse filesBrowse the repository at this point in the historyBrowse files
feat: a generator names its file with a function too, and minify is typed as written
The public type said one function where the schema has taken a list or a descriptor since 5.10, and a filename function is what webpack's own getPath takes.
Copy file name to clipboardExpand all lines: .changeset/generator-compression-options.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,4 +2,4 @@
2
2
"minimizer-webpack-plugin": minor
3
3
---
4
4
5
-
Add `threshold`, `minRatio` and `relatedName` to an `asset` generator, let `deleteOriginalAssets` be a function and take the original file alone, and read `minify: []` as nothing to minify rather than `false`.
5
+
Add `threshold`, `minRatio` and `relatedName` to an `asset` generator, let `deleteOriginalAssets` be a function and take the original file alone, take a `filename` function, read `minify: []` as nothing to minify rather than `false`, and type what `minify` has long accepted.
Copy file name to clipboardExpand all lines: src/index.js
+22-4Lines changed: 22 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -211,7 +211,7 @@ const {
211
211
* @property {MinimizerImplementation<EXPECTED_ANY>} implementation the generator itself
212
212
* @property {MinimizerOptions<EXPECTED_ANY>=} options options for this generator, preferred over the deprecated `generatorOptions`
213
213
* @property {("import" | "asset")=} type `import` re-encodes a module as it is built, so the import that asked for it is renamed with it; `asset` writes a new file beside one already emitted
214
-
* @property {string=} filename name for the generated asset, as a webpack filename template. `asset` generators only
214
+
* @property {(string | ((pathData: EXPECTED_ANY) => string))=} filename name for the generated asset, as a webpack filename template or a function answering with one. `asset` generators only
215
215
* @property {((name: string) => boolean)=} filter decides per asset whether to generate from it, on top of `test`/`include`/`exclude`
216
216
* @property {(boolean | ((name: string) => boolean))=} deleteOriginalAssets removes the asset generated from, its own file alone — whatever its `related` names stays. Written as a function it is asked per asset. `asset` generators only
217
217
* @property {number=} threshold generate only from assets larger than this, in bytes. `asset` generators only
@@ -237,8 +237,24 @@ const {
237
237
*/
238
238
239
239
/**
240
+
* One minimizer, written as an object stating how to run it.
* @property {MinimizerImplementation<T>} implementation the minimizer itself
244
+
* @property {MinimizerOptions<T>=} options options for this minimizer, preferred over the deprecated `minimizerOptions`
245
+
* @property {((name: string, info: AssetInfo) => boolean | undefined)=} filter which assets this minimizer is offered, overriding a `filter` on the function itself
246
+
*/
247
+
248
+
/**
249
+
* What `minify` may be written as: one minimizer, a list of them — empty for
Copy file name to clipboardExpand all lines: src/options.json
+10-6Lines changed: 10 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -276,9 +276,11 @@
276
276
"enum": ["import", "asset"]
277
277
},
278
278
"filename": {
279
-
"description": "Name for the generated asset, as a webpack filename template. `asset` generators only; by default the generator's own name for it is used.",
280
-
"type": "string",
281
-
"minLength": 1
279
+
"description": "Name for the generated asset, as a webpack filename template, or a function answering with one. `asset` generators only; by default the generator's own name for it is used.",
280
+
"anyOf": [
281
+
{ "type": "string", "minLength": 1 },
282
+
{ "instanceof": "Function" }
283
+
]
282
284
},
283
285
"filter": {
284
286
"description": "Decides per asset whether to generate from it, on top of `test`/`include`/`exclude`.",
@@ -346,9 +348,11 @@
346
348
"enum": ["import", "asset"]
347
349
},
348
350
"filename": {
349
-
"description": "Name for the generated asset, as a webpack filename template. `asset` generators only; by default the generator's own name for it is used.",
350
-
"type": "string",
351
-
"minLength": 1
351
+
"description": "Name for the generated asset, as a webpack filename template, or a function answering with one. `asset` generators only; by default the generator's own name for it is used.",
352
+
"anyOf": [
353
+
{ "type": "string", "minLength": 1 },
354
+
{ "instanceof": "Function" }
355
+
]
352
356
},
353
357
"filter": {
354
358
"description": "Decides per asset whether to generate from it, on top of `test`/`include`/`exclude`.",
0 commit comments