Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@php-wasm/util

Package Overview
Dependencies
Maintainers
4
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@php-wasm/util - npm Package Compare versions

Comparing version 0.6.16 to 0.7.0

2

index.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class d{constructor({concurrency:e}){this._running=0,this.concurrency=e,this.queue=[]}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency)await new Promise(e=>this.queue.push(e));else{this._running++;let e=!1;return()=>{e||(e=!0,this._running--,this.queue.length>0&&this.queue.shift()())}}}async run(e){const s=await this.acquire();try{return await e()}finally{s()}}}class g extends Error{constructor(e,s){super(e),this.userFriendlyMessage=s,this.userFriendlyMessage||(this.userFriendlyMessage=e)}}function E(...t){let e=t.join("/");const s=e[0]==="/",i=e.substring(e.length-1)==="/";return e=h(e),!e&&!s&&(e="."),e&&i&&(e+="/"),e}function p(t){if(t==="/")return"/";t=h(t);const e=t.lastIndexOf("/");return e===-1?"":e===0?"/":t.substr(0,e)}function m(t){if(t==="/")return"/";t=h(t);const e=t.lastIndexOf("/");return e===-1?t:t.substr(e+1)}function h(t){const e=t[0]==="/";return t=y(t.split("/").filter(s=>!!s),!e).join("/"),(e?"/":"")+t.replace(/\/$/,"")}function y(t,e){let s=0;for(let i=t.length-1;i>=0;i--){const r=t[i];r==="."?t.splice(i,1):r===".."?(t.splice(i,1),s++):s&&(t.splice(i,1),s--)}if(e)for(;s;s--)t.unshift("..");return t}function P(t){let i=0,r="";const l=[];let n="";for(let u=0;u<t.length;u++){const o=t[u];o==="\\"?((t[u+1]==='"'||t[u+1]==="'")&&u++,n+=t[u]):i===0?o==='"'||o==="'"?(i=1,r=o):o.match(/\s/)?(n.trim().length&&l.push(n.trim()),n=o):l.length&&!n?n=l.pop()+o:n+=o:i===1&&(o===r?(i=0,r=""):n+=o)}return n&&l.push(n.trim()),l}function w(t){return function(e,s=[],i={}){const r=new _,l=new D(r);return setTimeout(async()=>{let n=[];if(s.length)n=[e,...s];else if(typeof e=="string")n=P(e);else if(Array.isArray(e))n=e;else throw new Error("Invalid command ",e);await t(n,l,i),r.emit("spawn",!0)}),r}}class c{constructor(){this.listeners={}}emit(e,s){this.listeners[e]&&this.listeners[e].forEach(function(i){i(s)})}on(e,s){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(s)}}class D extends c{constructor(e){super(),this.childProcess=e,this.exited=!1,this.stdinData=[],e.on("stdin",s=>{this.stdinData?this.stdinData.push(s.slice()):this.emit("stdin",s)})}stdout(e){typeof e=="string"&&(e=new TextEncoder().encode(e)),this.childProcess.stdout.emit("data",e)}stdoutEnd(){this.childProcess.stdout.emit("end",{})}stderr(e){typeof e=="string"&&(e=new TextEncoder().encode(e)),this.childProcess.stderr.emit("data",e)}stderrEnd(){this.childProcess.stderr.emit("end",{})}exit(e){this.exited||(this.exited=!0,this.childProcess.emit("exit",e))}flushStdin(){if(this.stdinData)for(let e=0;e<this.stdinData.length;e++)this.emit("stdin",this.stdinData[e]);this.stdinData=null}}let O=9743;class _ extends c{constructor(e=O++){super(),this.pid=e,this.stdout=new c,this.stderr=new c;const s=this;this.stdin={write:i=>{s.emit("stdin",i)}}}}function f(t=36,e="!@#$%^&*()_+=-[]/.,<>?"){const s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"+e;let i="";for(let r=t;r>0;--r)i+=s[Math.floor(Math.random()*s.length)];return i}function S(){return f(36,"-_")}function a(t){return`json_decode(base64_decode('${b(JSON.stringify(t))}'), true)`}function T(t){const e={};for(const s in t)e[s]=a(t[s]);return e}function b(t){return x(new TextEncoder().encode(t))}function x(t){const e=String.fromCodePoint(...t);return btoa(e)}exports.PhpWasmError=g;exports.Semaphore=d;exports.basename=m;exports.createSpawnHandler=w;exports.dirname=p;exports.joinPaths=E;exports.normalizePath=h;exports.phpVar=a;exports.phpVars=T;exports.randomFilename=S;exports.randomString=f;
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=Symbol("SleepFinished");function g(t){return new Promise(e=>{setTimeout(()=>e(f),t)})}class m extends Error{constructor(){super("Acquiring lock timed out")}}class p{constructor({concurrency:e,timeout:i}){this._running=0,this.concurrency=e,this.timeout=i,this.queue=[]}get remaining(){return this.concurrency-this.running}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency){const e=new Promise(i=>{this.queue.push(i)});this.timeout!==void 0?await Promise.race([e,g(this.timeout)]).then(i=>{if(i===f)throw new m}):await e}else{this._running++;let e=!1;return()=>{e||(e=!0,this._running--,this.queue.length>0&&this.queue.shift()())}}}async run(e){const i=await this.acquire();try{return await e()}finally{i()}}}class E extends Error{constructor(e,i){super(e),this.userFriendlyMessage=i,this.userFriendlyMessage||(this.userFriendlyMessage=e)}}function w(...t){let e=t.join("/");const i=e[0]==="/",s=e.substring(e.length-1)==="/";return e=h(e),!e&&!i&&(e="."),e&&s&&(e+="/"),e}function y(t){if(t==="/")return"/";t=h(t);const e=t.lastIndexOf("/");return e===-1?"":e===0?"/":t.substr(0,e)}function P(t){if(t==="/")return"/";t=h(t);const e=t.lastIndexOf("/");return e===-1?t:t.substr(e+1)}function h(t){const e=t[0]==="/";return t=S(t.split("/").filter(i=>!!i),!e).join("/"),(e?"/":"")+t.replace(/\/$/,"")}function S(t,e){let i=0;for(let s=t.length-1;s>=0;s--){const r=t[s];r==="."?t.splice(s,1):r===".."?(t.splice(s,1),i++):i&&(t.splice(s,1),i--)}if(e)for(;i;i--)t.unshift("..");return t}function D(t){let s=0,r="";const u=[];let n="";for(let l=0;l<t.length;l++){const o=t[l];o==="\\"?((t[l+1]==='"'||t[l+1]==="'")&&l++,n+=t[l]):s===0?o==='"'||o==="'"?(s=1,r=o):o.match(/\s/)?(n.trim().length&&u.push(n.trim()),n=o):u.length&&!n?n=u.pop()+o:n+=o:s===1&&(o===r?(s=0,r=""):n+=o)}return n&&u.push(n.trim()),u}function O(t){return function(e,i=[],s={}){const r=new b,u=new _(r);return setTimeout(async()=>{let n=[];if(i.length)n=[e,...i];else if(typeof e=="string")n=D(e);else if(Array.isArray(e))n=e;else throw new Error("Invalid command ",e);await t(n,u,s),r.emit("spawn",!0)}),r}}class c{constructor(){this.listeners={}}emit(e,i){this.listeners[e]&&this.listeners[e].forEach(function(s){s(i)})}on(e,i){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(i)}}class _ extends c{constructor(e){super(),this.childProcess=e,this.exited=!1,this.stdinData=[],e.on("stdin",i=>{this.stdinData?this.stdinData.push(i.slice()):this.emit("stdin",i)})}stdout(e){typeof e=="string"&&(e=new TextEncoder().encode(e)),this.childProcess.stdout.emit("data",e)}stdoutEnd(){this.childProcess.stdout.emit("end",{})}stderr(e){typeof e=="string"&&(e=new TextEncoder().encode(e)),this.childProcess.stderr.emit("data",e)}stderrEnd(){this.childProcess.stderr.emit("end",{})}exit(e){this.exited||(this.exited=!0,this.childProcess.emit("exit",e))}flushStdin(){if(this.stdinData)for(let e=0;e<this.stdinData.length;e++)this.emit("stdin",this.stdinData[e]);this.stdinData=null}}let T=9743;class b extends c{constructor(e=T++){super(),this.pid=e,this.stdout=new c,this.stderr=new c;const i=this;this.stdin={write:s=>{i.emit("stdin",s)}}}}function a(t=36,e="!@#$%^&*()_+=-[]/.,<>?"){const i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"+e;let s="";for(let r=t;r>0;--r)s+=i[Math.floor(Math.random()*i.length)];return s}function x(){return a(36,"-_")}function d(t){return`json_decode(base64_decode('${U(JSON.stringify(t))}'), true)`}function M(t){const e={};for(const i in t)e[i]=d(t[i]);return e}function U(t){return q(new TextEncoder().encode(t))}function q(t){const e=String.fromCodePoint(...t);return btoa(e)}exports.PhpWasmError=E;exports.Semaphore=p;exports.basename=P;exports.createSpawnHandler=O;exports.dirname=y;exports.joinPaths=w;exports.normalizePath=h;exports.phpVar=d;exports.phpVars=M;exports.randomFilename=x;exports.randomString=a;
{
"name": "@php-wasm/util",
"version": "0.6.16",
"version": "0.7.0",
"type": "commonjs",

@@ -15,3 +15,3 @@ "typedoc": {

},
"gitHead": "1981567e7eacecbc4a18c870267c20bf489afd8f",
"gitHead": "c5eba3d709f2821c4303521e8c81b962e3bcca23",
"engines": {

@@ -18,0 +18,0 @@ "node": ">=18.18.0",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc