This repository has been archived by the owner on Mar 17, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 158
feat: add encoding & generator options #210
Merged
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8a4832d
feat: add encoding option
EslamHiko b577422
feat: specify the allowed encodings
EslamHiko c94d8e8
docs: fix url
EslamHiko 6b827fa
feat: add source option
EslamHiko 18e6e9d
fix: remove dependancies
EslamHiko 9ccc3a0
fix: allow user to manipulate Buffer instance
EslamHiko 2bb2de6
docs: fix an option mistake
EslamHiko a735888
feat: change source to generator & update tests
EslamHiko 79a88fe
docs: update option name in examples
EslamHiko f1649c0
test: writing better descriptions
EslamHiko 218b623
feat: allow boolean type for encoding option
EslamHiko 1522c1c
test: improve tests
EslamHiko 21f8bf1
docs: specify file in the second example
EslamHiko f287bfd
fix: use typeof for comparing with undefined
EslamHiko 44374dc
fix: define the types of the option using oneOf
EslamHiko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,26 @@ | |
"description": "Enables/Disables transformation target file into base64 URIs (https://github.com/webpack-contrib/url-loader#limit).", | ||
"type": ["boolean", "number", "string"] | ||
}, | ||
"encoding": { | ||
"description": "Specify the encoding which the file will be in-lined with.", | ||
"type": ["boolean", "string"], | ||
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.
|
||
"enum": [ | ||
"utf8", | ||
"utf16le", | ||
"latin1", | ||
"base64", | ||
"hex", | ||
"ascii", | ||
"binary", | ||
"ucs2", | ||
true, | ||
false | ||
] | ||
}, | ||
"generator": { | ||
"description": "Adding custom implementation for encoding files.", | ||
"instanceof": "Function" | ||
}, | ||
"mimetype": { | ||
"description": "The MIME type for the file to be transformed (https://github.com/webpack-contrib/url-loader#mimetype).", | ||
"type": "string" | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can be simplified to
src.toString(encoding)
, whenencoding
is undefined it will be assrc.toString()
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.
encoding
here is neverundefined
it'sbase64
if it was already undefined or true or astring
value orfalse
andsrc.toString(false)
will cause a bug.