formdata-polyfill
Advanced tools
Comparing version 4.0.4 to 4.0.5
@@ -0,1 +1,3 @@ | ||
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */ | ||
import C from 'fetch-blob' | ||
@@ -29,5 +31,5 @@ import F from 'fetch-blob/file.js' | ||
F.forEach((v,n)=>typeof v=='string' | ||
?c.push(p+e(n)+`"\r\n\r\n${v}\r\n`) | ||
?c.push(p+e(n)+`"\r\n\r\n${v.replace(/\r(?!\n)|(?<!\r)\n/g, '\r\n')}\r\n`) | ||
:c.push(p+e(n)+`"; filename="${e(v.name)}"\r\nContent-Type: ${v.type||"application/octet-stream"}\r\n\r\n`, v, '\r\n')) | ||
c.push(`--${b}--`) | ||
return new B(c,{type:"multipart/form-data; boundary="+b})} |
@@ -0,1 +1,3 @@ | ||
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */ | ||
const escape = str => str.replace(/\n/g, '%0A').replace(/\r/g, '%0D').replace(/"/g, '%22') | ||
@@ -5,3 +7,3 @@ | ||
* pure function to convert any formData instance to a Blob | ||
* instances syncronus without reading all of the files | ||
* instances synchronous without reading all of the files | ||
* | ||
@@ -18,3 +20,3 @@ * @param {FormData|*} formData an instance of a formData Class | ||
if (typeof value === 'string') { | ||
chunks.push(prefix + escape(name) + `"\r\n\r\n${value}\r\n`) | ||
chunks.push(prefix + escape(name) + `"\r\n\r\n${value.replace(/\r(?!\n)|(?<!\r)\n/g, '\r\n')}\r\n`) | ||
} else { | ||
@@ -21,0 +23,0 @@ chunks.push( |
@@ -0,1 +1,3 @@ | ||
/* formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */ | ||
/* global FormData self Blob File */ | ||
@@ -336,3 +338,3 @@ /* eslint-disable no-inner-declarations */ | ||
this.forEach((value, name) => typeof value == 'string' | ||
? chunks.push(p + escape(name) + `"\r\n\r\n${value}\r\n`) | ||
? chunks.push(p + escape(name) + `"\r\n\r\n${normalizeLinefeeds(value)}\r\n`) | ||
: chunks.push(p + escape(name) + `"; filename="${escape(value.name)}"\r\nContent-Type: ${value.type||"application/octet-stream"}\r\n\r\n`, value, `\r\n`)) | ||
@@ -343,3 +345,2 @@ chunks.push(`--${boundary}--`) | ||
}) | ||
} | ||
@@ -346,0 +347,0 @@ |
@@ -1,20 +0,58 @@ | ||
;(function(){var h;function l(a){var c=0;return function(){return c<a.length?{done:!1,value:a[c++]}:{done:!0}}}var m="function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){if(a==Array.prototype||a==Object.prototype)return a;a[c]=b.value;return a}; | ||
function n(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var c=0;c<a.length;++c){var b=a[c];if(b&&b.Math==Math)return b}throw Error("Cannot find global object");}var q=n(this);function r(a,c){if(c)a:{for(var b=q,d=a.split("."),e=0;e<d.length-1;e++){var f=d[e];if(!(f in b))break a;b=b[f]}d=d[d.length-1];e=b[d];f=c(e);f!=e&&null!=f&&m(b,d,{configurable:!0,writable:!0,value:f})}} | ||
r("Symbol",function(a){function c(f){if(this instanceof c)throw new TypeError("Symbol is not a constructor");return new b(d+(f||"")+"_"+e++,f)}function b(f,g){this.A=f;m(this,"description",{configurable:!0,writable:!0,value:g})}if(a)return a;b.prototype.toString=function(){return this.A};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",e=0;return c}); | ||
r("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var c="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),b=0;b<c.length;b++){var d=q[c[b]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&m(d.prototype,a,{configurable:!0,writable:!0,value:function(){return u(l(this))}})}return a});function u(a){a={next:a};a[Symbol.iterator]=function(){return this};return a} | ||
function v(a){var c="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return c?c.call(a):{next:l(a)}}var w;if("function"==typeof Object.setPrototypeOf)w=Object.setPrototypeOf;else{var y;a:{var z={a:!0},A={};try{A.__proto__=z;y=A.a;break a}catch(a){}y=!1}w=y?function(a,c){a.__proto__=c;if(a.__proto__!==c)throw new TypeError(a+" is not extensible");return a}:null}var B=w;function C(){this.m=!1;this.j=null;this.v=void 0;this.h=1;this.u=this.C=0;this.l=null} | ||
function D(a){if(a.m)throw new TypeError("Generator is already running");a.m=!0}C.prototype.o=function(a){this.v=a};C.prototype.s=function(a){this.l={D:a,F:!0};this.h=this.C||this.u};C.prototype["return"]=function(a){this.l={"return":a};this.h=this.u};function E(a,c){a.h=3;return{value:c}}function F(a){this.g=new C;this.G=a}F.prototype.o=function(a){D(this.g);if(this.g.j)return G(this,this.g.j.next,a,this.g.o);this.g.o(a);return H(this)}; | ||
function I(a,c){D(a.g);var b=a.g.j;if(b)return G(a,"return"in b?b["return"]:function(d){return{value:d,done:!0}},c,a.g["return"]);a.g["return"](c);return H(a)}F.prototype.s=function(a){D(this.g);if(this.g.j)return G(this,this.g.j["throw"],a,this.g.o);this.g.s(a);return H(this)}; | ||
function G(a,c,b,d){try{var e=c.call(a.g.j,b);if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object");if(!e.done)return a.g.m=!1,e;var f=e.value}catch(g){return a.g.j=null,a.g.s(g),H(a)}a.g.j=null;d.call(a.g,f);return H(a)}function H(a){for(;a.g.h;)try{var c=a.G(a.g);if(c)return a.g.m=!1,{value:c.value,done:!1}}catch(b){a.g.v=void 0,a.g.s(b)}a.g.m=!1;if(a.g.l){c=a.g.l;a.g.l=null;if(c.F)throw c.D;return{value:c["return"],done:!0}}return{value:void 0,done:!0}} | ||
function J(a){this.next=function(c){return a.o(c)};this["throw"]=function(c){return a.s(c)};this["return"]=function(c){return I(a,c)};this[Symbol.iterator]=function(){return this}}function K(a,c){var b=new J(new F(c));B&&a.prototype&&B(b,a.prototype);return b} | ||
if("undefined"!==typeof Blob&&("undefined"===typeof FormData||!FormData.prototype.keys)){var L=function(a,c){for(var b=0;b<a.length;b++)c(a[b])},M=function(a,c,b){if(c instanceof Blob){b=void 0!==b?String(b+""):"string"===typeof c.name?c.name:"blob";if(c.name!==b||"[object Blob]"===Object.prototype.toString.call(c))c=new File([c],b);return[String(a),c]}return[String(a),String(c)]},N=function(a,c){if(a.length<c)throw new TypeError(c+" argument required, but only "+a.length+" present.");},O="object"=== | ||
typeof globalThis?globalThis:"object"===typeof window?window:"object"===typeof self?self:this,P=O.FormData,Q=O.XMLHttpRequest&&O.XMLHttpRequest.prototype.send,R=O.Request&&O.fetch,S=O.navigator&&O.navigator.sendBeacon,T=O.Element&&O.Element.prototype,U=O.Symbol&&Symbol.toStringTag;U&&(Blob.prototype[U]||(Blob.prototype[U]="Blob"),"File"in O&&!File.prototype[U]&&(File.prototype[U]="File"));try{new File([],"")}catch(a){O.File=function(c,b,d){c=new Blob(c,d||{});Object.defineProperties(c,{name:{value:b}, | ||
lastModified:{value:+(d&&void 0!==d.lastModified?new Date(d.lastModified):new Date)},toString:{value:function(){return"[object File]"}}});U&&Object.defineProperty(c,U,{value:"File"});return c}}var escape=function(a){return a.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")},V=function(a){this.i=[];var c=this;a&&L(a.elements,function(b){if(b.name&&!b.disabled&&"submit"!==b.type&&"button"!==b.type&&!b.matches("form fieldset[disabled] *"))if("file"===b.type){var d=b.files&&b.files.length? | ||
b.files:[new File([],"",{type:"application/octet-stream"})];L(d,function(e){c.append(b.name,e)})}else"select-multiple"===b.type||"select-one"===b.type?L(b.options,function(e){!e.disabled&&e.selected&&c.append(b.name,e.value)}):"checkbox"===b.type||"radio"===b.type?b.checked&&c.append(b.name,b.value):(d="textarea"===b.type?b.value.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"):b.value,c.append(b.name,d))})};h=V.prototype;h.append=function(a,c,b){N(arguments,2);this.i.push(M(a,c,b))};h["delete"]=function(a){N(arguments, | ||
1);var c=[];a=String(a);L(this.i,function(b){b[0]!==a&&c.push(b)});this.i=c};h.entries=function c(){var b,d=this;return K(c,function(e){1==e.h&&(b=0);if(3!=e.h)return b<d.i.length?e=E(e,d.i[b]):(e.h=0,e=void 0),e;b++;e.h=2})};h.forEach=function(c,b){N(arguments,1);for(var d=v(this),e=d.next();!e.done;e=d.next()){var f=v(e.value);e=f.next().value;f=f.next().value;c.call(b,f,e,this)}};h.get=function(c){N(arguments,1);var b=this.i;c=String(c);for(var d=0;d<b.length;d++)if(b[d][0]===c)return b[d][1]; | ||
return null};h.getAll=function(c){N(arguments,1);var b=[];c=String(c);L(this.i,function(d){d[0]===c&&b.push(d[1])});return b};h.has=function(c){N(arguments,1);c=String(c);for(var b=0;b<this.i.length;b++)if(this.i[b][0]===c)return!0;return!1};h.keys=function b(){var d=this,e,f,g,k,p;return K(b,function(t){1==t.h&&(e=v(d),f=e.next());if(3!=t.h){if(f.done){t.h=0;return}g=f.value;k=v(g);p=k.next().value;return E(t,p)}f=e.next();t.h=2})};h.set=function(b,d,e){N(arguments,2);b=String(b);var f=[],g=M(b, | ||
d,e),k=!0;L(this.i,function(p){p[0]===b?k&&(k=!f.push(g)):f.push(p)});k&&f.push(g);this.i=f};h.values=function d(){var e=this,f,g,k,p,t;return K(d,function(x){1==x.h&&(f=v(e),g=f.next());if(3!=x.h){if(g.done){x.h=0;return}k=g.value;p=v(k);p.next();t=p.next().value;return E(x,t)}g=f.next();x.h=2})};V.prototype._asNative=function(){for(var d=new P,e=v(this),f=e.next();!f.done;f=e.next()){var g=v(f.value);f=g.next().value;g=g.next().value;d.append(f,g)}return d};V.prototype._blob=function(){var d="----formdata-polyfill-"+ | ||
Math.random(),e=[],f="--"+d+'\r\nContent-Disposition: form-data; name="';this.forEach(function(g,k){return"string"==typeof g?e.push(f+escape(k)+('"\r\n\r\n'+g+"\r\n")):e.push(f+escape(k)+('"; filename="'+escape(g.name)+'"\r\nContent-Type: '+(g.type||"application/octet-stream")+"\r\n\r\n"),g,"\r\n")});e.push("--"+d+"--");return new Blob(e,{type:"multipart/form-data; boundary="+d})};V.prototype[Symbol.iterator]=function(){return this.entries()};V.prototype.toString=function(){return"[object FormData]"}; | ||
T&&!T.matches&&(T.matches=T.matchesSelector||T.mozMatchesSelector||T.msMatchesSelector||T.oMatchesSelector||T.webkitMatchesSelector||function(d){d=(this.document||this.ownerDocument).querySelectorAll(d);for(var e=d.length;0<=--e&&d.item(e)!==this;);return-1<e});U&&(V.prototype[U]="FormData");if(Q){var W=O.XMLHttpRequest.prototype.setRequestHeader;O.XMLHttpRequest.prototype.setRequestHeader=function(d,e){W.call(this,d,e);"content-type"===d.toLowerCase()&&(this.B=!0)};O.XMLHttpRequest.prototype.send= | ||
function(d){d instanceof V?(d=d._blob(),this.B||this.setRequestHeader("Content-Type",d.type),Q.call(this,d)):Q.call(this,d)}}R&&(O.fetch=function(d,e){e&&e.body&&e.body instanceof V&&(e.body=e.body._blob());return R.call(this,d,e)});S&&(O.navigator.sendBeacon=function(d,e){e instanceof V&&(e=e._asNative());return S.call(this,d,e)});O.FormData=V}; | ||
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */ | ||
;(function(){Error(23): java.lang.RuntimeException: java.lang.InterruptedException | ||
at com.google.javascript.jscomp.NodeTraversal.initTraversal(NodeTraversal.java:1305) | ||
at com.google.javascript.jscomp.NodeTraversal.traverseRoots(NodeTraversal.java:476) | ||
at com.google.javascript.jscomp.NodeTraversal.access$400(NodeTraversal.java:38) | ||
at com.google.javascript.jscomp.NodeTraversal$Builder.traverseRoots(NodeTraversal.java:406) | ||
at com.google.javascript.jscomp.NodeTraversal.traverseRoots(NodeTraversal.java:492) | ||
at com.google.javascript.jscomp.MethodCompilerPass.process(MethodCompilerPass.java:75) | ||
at com.google.javascript.jscomp.InlineSimpleMethods.process(InlineSimpleMethods.java:71) | ||
at com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process(PhaseOptimizer.java:317) | ||
at com.google.javascript.jscomp.PhaseOptimizer$Loop.process(PhaseOptimizer.java:462) | ||
at com.google.javascript.jscomp.PhaseOptimizer.process(PhaseOptimizer.java:232) | ||
at com.google.javascript.jscomp.Compiler.performOptimizations(Compiler.java:2494) | ||
at com.google.javascript.jscomp.Compiler.lambda$stage2Passes$5(Compiler.java:824) | ||
at com.google.javascript.jscomp.CompilerExecutor.runInCompilerThread(CompilerExecutor.java:127) | ||
at com.google.javascript.jscomp.Compiler.runInCompilerThread(Compiler.java:849) | ||
at com.google.javascript.jscomp.Compiler.stage2Passes(Compiler.java:821) | ||
at com.google.javascript.jscomp.Compiler.compile(Compiler.java:710) | ||
at com.google.javascript.jscomp.webservice.backend.CompilerInvokerImpl.compile(CompilerInvokerImpl.java:44) | ||
at com.google.javascript.jscomp.webservice.backend.ServerController.executeRequest(ServerController.java:178) | ||
at com.google.javascript.jscomp.webservice.backend.CompilationRequestHandler.serviceParsedRequest(CompilationRequestHandler.java:178) | ||
at com.google.javascript.jscomp.webservice.backend.CompilationRequestHandler.service(CompilationRequestHandler.java:160) | ||
at com.google.javascript.jscomp.webservice.frontend.CompilationServlet.doPost(CompilationServlet.java:82) | ||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) | ||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) | ||
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) | ||
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1780) | ||
at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:62) | ||
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1767) | ||
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583) | ||
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) | ||
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524) | ||
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) | ||
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) | ||
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) | ||
at com.google.apphosting.runtime.jetty9.ParseBlobUploadHandler.handle(ParseBlobUploadHandler.java:111) | ||
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1182) | ||
at com.google.apphosting.runtime.jetty9.AppEngineWebAppContext.doHandle(AppEngineWebAppContext.java:187) | ||
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:513) | ||
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) | ||
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) | ||
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) | ||
at com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:293) | ||
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) | ||
at org.eclipse.jetty.server.Server.handle(Server.java:539) | ||
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) | ||
at com.google.apphosting.runtime.jetty9.RpcConnection.handle(RpcConnection.java:216) | ||
at com.google.apphosting.runtime.jetty9.RpcConnector.serviceRequest(RpcConnector.java:81) | ||
at com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:134) | ||
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:794) | ||
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:757) | ||
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:727) | ||
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:261) | ||
at java.lang.Thread.run(Thread.java:748) | ||
Caused by: java.lang.InterruptedException | ||
... 52 more | ||
})(); |
{ | ||
"name": "formdata-polyfill", | ||
"version": "4.0.4", | ||
"version": "4.0.5", | ||
"description": "HTML5 `FormData` for Browsers and Node.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
494
26328