fix(formdata-polyfill): retry with babel as transpiler
This commit is contained in:
parent
99350e45dd
commit
1d33fd9db3
1 changed files with 61 additions and 0 deletions
61
patches/formdata-polyfill+4.0.10.patch
Normal file
61
patches/formdata-polyfill+4.0.10.patch
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
diff --git a/node_modules/formdata-polyfill/FormData.js b/node_modules/formdata-polyfill/FormData.js
|
||||||
|
index 8e73660..133dcd0 100644
|
||||||
|
--- a/node_modules/formdata-polyfill/FormData.js
|
||||||
|
+++ b/node_modules/formdata-polyfill/FormData.js
|
||||||
|
@@ -71,7 +71,7 @@ if (typeof Blob !== 'undefined' && (typeof FormData === 'undefined' || !FormData
|
||||||
|
|
||||||
|
function ensureArgs (args, expected) {
|
||||||
|
if (args.length < expected) {
|
||||||
|
- throw new TypeError(`${expected} argument required, but only ${args.length} present.`)
|
||||||
|
+ throw new TypeError("".concat(expected, " argument required, but only ").concat(args.length, " present."))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -342,11 +342,11 @@ if (typeof Blob !== 'undefined' && (typeof FormData === 'undefined' || !FormData
|
||||||
|
['_blob'] () {
|
||||||
|
const boundary = '----formdata-polyfill-' + Math.random(),
|
||||||
|
chunks = [],
|
||||||
|
- p = `--${boundary}\r\nContent-Disposition: form-data; name="`
|
||||||
|
- this.forEach((value, name) => typeof value == 'string'
|
||||||
|
- ? chunks.push(p + escape(normalizeLinefeeds(name)) + `"\r\n\r\n${normalizeLinefeeds(value)}\r\n`)
|
||||||
|
- : chunks.push(p + escape(normalizeLinefeeds(name)) + `"; filename="${escape(value.name)}"\r\nContent-Type: ${value.type||"application/octet-stream"}\r\n\r\n`, value, `\r\n`))
|
||||||
|
- chunks.push(`--${boundary}--`)
|
||||||
|
+ p = "--".concat(boundary, "\r\nContent-Disposition: form-data; name=\"");
|
||||||
|
+ this.forEach((value, name) => typeof value == 'string'
|
||||||
|
+ ? chunks.push(p + escape(normalizeLinefeeds(name)) + "\"\r\n\r\n".concat(normalizeLinefeeds(value), "\r\n"))
|
||||||
|
+ : chunks.push(p + escape(normalizeLinefeeds(name)) + "\"; filename=\"".concat(escape(value.name), "\"\r\nContent-Type: ").concat(value.type || "application/octet-stream", "\r\n\r\n"), value, "\r\n"))
|
||||||
|
+ chunks.push("--".concat(boundary, "--"));
|
||||||
|
return new Blob(chunks, {
|
||||||
|
type: "multipart/form-data; boundary=" + boundary
|
||||||
|
})
|
||||||
|
diff --git a/node_modules/formdata-polyfill/formdata-to-blob.js b/node_modules/formdata-polyfill/formdata-to-blob.js
|
||||||
|
index 5a0a517..05d1aca 100644
|
||||||
|
--- a/node_modules/formdata-polyfill/formdata-to-blob.js
|
||||||
|
+++ b/node_modules/formdata-polyfill/formdata-to-blob.js
|
||||||
|
@@ -16,22 +16,17 @@ const escape = (str, filename) =>
|
||||||
|
export function formDataToBlob (formData, BlobClass = Blob) {
|
||||||
|
const boundary = ('----formdata-polyfill-' + Math.random())
|
||||||
|
const chunks = []
|
||||||
|
- const prefix = `--${boundary}\r\nContent-Disposition: form-data; name="`
|
||||||
|
+ var prefix = "--".concat(boundary, "\r\nContent-Disposition: form-data; name=\"");
|
||||||
|
|
||||||
|
for (let [name, value] of formData) {
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
- chunks.push(prefix + escape(name) + `"\r\n\r\n${value.replace(/\r(?!\n)|(?<!\r)\n/g, '\r\n')}\r\n`)
|
||||||
|
+ chunks.push(prefix + escape(name) + "\"\r\n\r\n".concat(value.replace(/\r(?!\n)|(?<!\r)\n/g, '\r\n'), "\r\n"));
|
||||||
|
} else {
|
||||||
|
- chunks.push(
|
||||||
|
- prefix + escape(name) + `"; filename="${escape(value.name, 1)}"\r\n` +
|
||||||
|
- `Content-Type: ${value.type || 'application/octet-stream'}\r\n\r\n`,
|
||||||
|
- value,
|
||||||
|
- '\r\n'
|
||||||
|
- )
|
||||||
|
+ chunks.push(prefix + escape(name) + "\"; filename=\"".concat(escape(value.name, 1), "\"\r\n") + "Content-Type: ".concat(value.type || 'application/octet-stream', "\r\n\r\n"), value, '\r\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- chunks.push(`--${boundary}--`)
|
||||||
|
+ chunks.push("--".concat(boundary, "--"));
|
||||||
|
|
||||||
|
return new BlobClass(chunks, {
|
||||||
|
type: 'multipart/form-data; boundary=' + boundary
|
Loading…
Reference in a new issue