Skip to content

Commit

Permalink
chore(build): Replaces webpack + babel with vite
Browse files Browse the repository at this point in the history
  • Loading branch information
lupomontero committed Nov 26, 2024
1 parent 57b4ef9 commit c773072
Show file tree
Hide file tree
Showing 9 changed files with 5,838 additions and 8,162 deletions.
1 change: 0 additions & 1 deletion dist/porch-browser.min.js

This file was deleted.

1 change: 1 addition & 0 deletions dist/porch-browser.min.js
1 change: 1 addition & 0 deletions dist/porch.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=(o,e)=>o.reduce((t,r)=>t.length&&t[t.length-1].length<e?(t[t.length-1].push(r),t):[...t,[r]],[]);class m{constructor(){this.readable=!0,this.listeners={}}getListeners(e){return this.listeners[e]||[]}on(e,t){return Object.assign(this.listeners,{[e]:this.getListeners(e).concat(t)}),this}off(e,t){return Object.assign(this.listeners,{[e]:this.getListeners(e).filter(r=>r!==t)}),this}emit(e,t){setTimeout(()=>{this.getListeners(e).forEach(r=>r(t))})}push(e){return e===null?this.emit("end"):this.emit("data",e)}}const L=(o,e=1,t=0,r=!0)=>{const i=new m({objectMode:!0,read(){}});let l=!1;const a=s=>{l=!0,i.emit("error",s)},n=s=>!l&&i.readable&&i.push(s),u=(s,c=0)=>{if(!s.length)return n(null);const p=(P,j)=>{const g=c*e+j;return P().then(h=>n({idx:g,result:h})).catch(h=>r?a(Object.assign(h,{idx:g})):n({idx:g,result:h}))};return Promise.all(s[0].map(p)).then(()=>s.length<=1?n(null):setTimeout(()=>!l&&i.readable&&u(s.slice(1),c+1),t))};return u(d(o,e)),i},f=(o,e,t=0,r=!0)=>{const i=(l,a=[])=>l.length?Promise.all(l[0].map(n=>r?n():n().catch(u=>u))).then(n=>{const u=[...a,...n];return l.length<=1?u:new Promise((s,c)=>setTimeout(()=>i(l.slice(1),u).then(s,c),t))}):Promise.resolve(a);return i(d(o,e))};exports.createPromise=f;exports.createStream=L;exports.default=f;
66 changes: 66 additions & 0 deletions dist/porch.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const d = (o, t) => o.reduce((e, r) => e.length && e[e.length - 1].length < t ? (e[e.length - 1].push(r), e) : [...e, [r]], []);
class j {
constructor() {
this.readable = !0, this.listeners = {};
}
getListeners(t) {
return this.listeners[t] || [];
}
on(t, e) {
return Object.assign(this.listeners, {
[t]: this.getListeners(t).concat(e)
}), this;
}
off(t, e) {
return Object.assign(this.listeners, {
[t]: this.getListeners(t).filter((r) => r !== e)
}), this;
}
emit(t, e) {
setTimeout(() => {
this.getListeners(t).forEach((r) => r(e));
});
}
push(t) {
return t === null ? this.emit("end") : this.emit("data", t);
}
}
const L = (o, t = 1, e = 0, r = !0) => {
const i = new j({
objectMode: !0,
read() {
}
});
let l = !1;
const a = (s) => {
l = !0, i.emit("error", s);
}, n = (s) => !l && i.readable && i.push(s), u = (s, h = 0) => {
if (!s.length)
return n(null);
const f = (p, P) => {
const g = h * t + P;
return p().then((c) => n({ idx: g, result: c })).catch((c) => r ? a(Object.assign(c, { idx: g })) : n({ idx: g, result: c }));
};
return Promise.all(s[0].map(f)).then(() => s.length <= 1 ? n(null) : setTimeout(
() => !l && i.readable && u(s.slice(1), h + 1),
e
));
};
return u(d(o, t)), i;
}, w = (o, t, e = 0, r = !0) => {
const i = (l, a = []) => l.length ? Promise.all(
l[0].map((n) => r ? n() : n().catch((u) => u))
).then((n) => {
const u = [...a, ...n];
return l.length <= 1 ? u : new Promise((s, h) => setTimeout(
() => i(l.slice(1), u).then(s, h),
e
));
}) : Promise.resolve(a);
return i(d(o, t));
};
export {
w as createPromise,
L as createStream,
w as default
};
1 change: 1 addition & 0 deletions dist/porch.umd.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(function(i,a){typeof exports=="object"&&typeof module!="undefined"?a(exports):typeof define=="function"&&define.amd?define(["exports"],a):(i=typeof globalThis!="undefined"?globalThis:i||self,a(i.porch={}))})(this,function(i){"use strict";const a=(c,e)=>c.reduce((t,r)=>t.length&&t[t.length-1].length<e?(t[t.length-1].push(r),t):[...t,[r]],[]);class P{constructor(){this.readable=!0,this.listeners={}}getListeners(e){return this.listeners[e]||[]}on(e,t){return Object.assign(this.listeners,{[e]:this.getListeners(e).concat(t)}),this}off(e,t){return Object.assign(this.listeners,{[e]:this.getListeners(e).filter(r=>r!==t)}),this}emit(e,t){setTimeout(()=>{this.getListeners(e).forEach(r=>r(t))})}push(e){return e===null?this.emit("end"):this.emit("data",e)}}const j=(c,e=1,t=0,r=!0)=>{const u=new P({objectMode:!0,read(){}});let l=!1;const h=s=>{l=!0,u.emit("error",s)},n=s=>!l&&u.readable&&u.push(s),o=(s,d=0)=>{if(!s.length)return n(null);const m=(T,b)=>{const g=d*e+b;return T().then(f=>n({idx:g,result:f})).catch(f=>r?h(Object.assign(f,{idx:g})):n({idx:g,result:f}))};return Promise.all(s[0].map(m)).then(()=>s.length<=1?n(null):setTimeout(()=>!l&&u.readable&&o(s.slice(1),d+1),t))};return o(a(c,e)),u},p=(c,e,t=0,r=!0)=>{const u=(l,h=[])=>l.length?Promise.all(l[0].map(n=>r?n():n().catch(o=>o))).then(n=>{const o=[...h,...n];return l.length<=1?o:new Promise((s,d)=>setTimeout(()=>u(l.slice(1),o).then(s,d),t))}):Promise.resolve(h);return u(a(c,e))};i.createPromise=p,i.createStream=j,i.default=p,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
2 changes: 1 addition & 1 deletion lib/createStream.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Readable } from 'stream';
import { Readable } from 'node:stream';
import splitArrayIntoBatches from './splitArrayIntoBatches.js';

export default (tasks, concurrency = 1, interval = 0, failFast = true) => {
Expand Down
Loading

0 comments on commit c773072

Please sign in to comment.