Skip to content

Commit dfd3c27

Browse files
committed
Handle Windows line endings in region include
Resolves #2902
1 parent 182ef52 commit dfd3c27

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ title: Changelog
66

77
### Bug Fixes
88

9-
- `--watch` can now infer entry points from `package.json` as supported in non-watch mode, #2899/
9+
- `--watch` can now infer entry points from `package.json` as supported in non-watch mode, #2899.
10+
- `@include` with regions now works on files with CRLF line endings, #2902.
1011

1112
## v0.28.0 (2025-03-15)
1213

src/lib/converter/plugins/IncludePlugin.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import path from "path";
2-
import fs from "fs";
32

43
import { ConverterComponent } from "../components.js";
54
import { ConverterEvents } from "../converter-events.js";
65
import type { CommentDisplayPart, Reflection } from "../../models/index.js";
76
import { MinimalSourceFile } from "#utils";
87
import type { Converter } from "../converter.js";
9-
import { isFile } from "../../utils/fs.js";
8+
import { isFile, readFile } from "../../utils/fs.js";
109
import { dedent, escapeRegExp, i18n } from "#utils";
1110
import { normalizePath } from "#node-utils";
1211

@@ -78,7 +77,7 @@ export class IncludePlugin extends ConverterComponent {
7877
),
7978
);
8079
} else if (isFile(file)) {
81-
const text = fs.readFileSync(file, "utf-8");
80+
const text = readFile(file).replaceAll("\r\n", "\n");
8281
const ext = path.extname(file).substring(1);
8382

8483
const includedText = regionTarget

0 commit comments

Comments
 (0)