-
-
Notifications
You must be signed in to change notification settings - Fork 89
fix(index): escape invalid characters #43
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Tobias Koppers @sokra | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Tobias Koppers @sokra | ||
*/ | ||
module.exports = function(content) { | ||
this.cacheable && this.cacheable(); | ||
this.value = content; | ||
return "module.exports = " + JSON.stringify(content); | ||
this.cacheable && this.cacheable(); | ||
this.value = content; | ||
|
||
var stringified = JSON.stringify(content) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the content is the raw text of the file. It's not json There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, agreed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
.replace(/\u2028/g, '\\u2028') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indent chained methods with 2 spaces please json = ...
.method() |
||
.replace(/\u2029/g, '\\u2029'); | ||
|
||
return "module.exports = " + stringified; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't support webpack 1.x. Cachable can be removed at this point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok