Skip to content

Commit

Permalink
Merge pull request #167 from hed-standard/fix-xml-transformer
Browse files Browse the repository at this point in the history
Fix XML file transformation
  • Loading branch information
happy5214 authored Aug 8, 2024
2 parents 26c35d1 + 12b6204 commit 0237562
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fileTransformer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const normalizeEOL = (str) => str.replace(/\r\n/g, '\n').replace(/\r/g, '\n')

export default {
process(sourceText, sourcePath, options) {
sourceText = sourceText.replace(/"/g, '\\"').replace(/\n/g, '\\n')
sourceText = normalizeEOL(sourceText)
return {
code: `module.exports = "${sourceText}";`,
code: `module.exports = ${JSON.stringify(sourceText)};`,
}
},
}

0 comments on commit 0237562

Please sign in to comment.