Skip to content

[wasm] force versioned dotnet.d.ts to always have unix style end of line #62418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ src/tests/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/revcomp-
src/tests/JIT/Performance/CodeQuality/BenchmarksGame/reverse-complement/revcomp-input25000.txt text eol=lf
src/tests/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/knucleotide-input.txt text eol=lf
src/tests/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/knucleotide-input-big.txt text eol=lf
src/mono/wasm/runtime/dotnet.d.ts text eol=lf
15 changes: 14 additions & 1 deletion src/mono/wasm/runtime/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ if (isDebug) {
format: "es",
file: "./dotnet.d.ts",
banner: banner_generated,
plugins: [writeOnChangePlugin()],
plugins: [alwaysLF(), writeOnChangePlugin()],
});
}

Expand All @@ -103,6 +103,19 @@ function writeOnChangePlugin() {
};
}

// force always unix line ending
function alwaysLF() {
return {
name: "writeOnChange",
generateBundle: (options, bundle) => {
const name = Object.keys(bundle)[0];
const asset = bundle[name];
const code = asset.code;
asset.code = code.replace(/\r/g, "");
}
};
}

async function writeWhenChanged(options, bundle) {
try {
const name = Object.keys(bundle)[0];
Expand Down