Skip to content

Commit d301f7d

Browse files
committed
fix: disallow undefined value for optional properties by route option
1 parent 36bbd03 commit d301f7d

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 4.20.1 (2025-04-17)
4+
5+
- fix: disallow `undefined` value for optional properties by `route` option
6+
37
## 4.20.0
48

59
- feat: add support for ESM data files

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "html-bundler-webpack-plugin",
3-
"version": "4.20.0",
3+
"version": "4.20.1",
44
"description": "Generates complete single-page or multi-page website from source assets. Built-in support for Markdown, Eta, EJS, Handlebars, Nunjucks, Pug. Alternative to html-webpack-plugin.",
55
"keywords": [
66
"html",

types.d.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,17 +391,17 @@ type Sources =
391391
type Router =
392392
| boolean
393393
| {
394-
enabled?: boolean;
394+
enabled: boolean;
395395
// replaces matched source route with its output URL, defaults is <PluginOption>.test depends on used preprocessor
396-
test?: RegExp | Array<RegExp>;
396+
test: RegExp | Array<RegExp>;
397397
// Note: if a route contains a query or a segment (e.g. index.html#contact), the rewriteIndex is ignored!
398398
// if rewriteIndex is `false` (defaults), do nothing
399399
// if rewriteIndex is a string:
400400
// - if publicPath is `auto` replaces "index.html" with the specified string, should be on of: ".", ""
401401
// - if publicPath is not empty, replaces "index.html" with "" (empty string) regardless of specified value
402-
rewriteIndex?: false | string;
402+
rewriteIndex: false | string;
403403
// called after the resolving of output filenames
404-
resolve?: (props: {
404+
resolve: (props: {
405405
sourceRoute: string; // resolved href value (absolute path)
406406
outputRoute: string; // output URL regards publicPath, e.g. by auto publicPath is relative to outputFile
407407
sourceFile: string; // absolute path to the template file
@@ -410,6 +410,13 @@ type Router =
410410
// - void - do nothing
411411
// - any string - the returned string replaces the value
412412
}) => void | string;
413+
}
414+
// disallow `undefined` value for optional properties
415+
| {
416+
enabled?: never;
417+
test?: never;
418+
rewriteIndex?: never;
419+
resolve?: never;
413420
};
414421

415422
type WatchFiles = {

0 commit comments

Comments
 (0)