New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@php-wasm/fs-journal

Package Overview
Dependencies
Maintainers
3
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@php-wasm/fs-journal - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

__vite-browser-external-2447137e.js

239

index.js

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

var K = (e, t, r) => {
var Z = (e, t, r) => {
if (!t.has(e))
throw TypeError("Cannot " + r);
};
var a = (e, t, r) => (K(e, t, "read from private field"), r ? r.call(e) : t.get(e)), l = (e, t, r) => {
var a = (e, t, r) => (Z(e, t, "read from private field"), r ? r.call(e) : t.get(e)), l = (e, t, r) => {
if (t.has(e))
throw TypeError("Cannot add the same private member more than once");
t instanceof WeakSet ? t.add(e) : t.set(e, r);
}, d = (e, t, r, s) => (K(e, t, "write to private field"), s ? s.call(e, r) : t.set(e, r), r);
var f = (e, t, r) => (K(e, t, "access private method"), r);
}, d = (e, t, r, s) => (Z(e, t, "write to private field"), s ? s.call(e, r) : t.set(e, r), r);
var p = (e, t, r) => (Z(e, t, "access private method"), r);
if (typeof File > "u") {

@@ -70,2 +70,5 @@ class e extends Blob {

}
typeof crypto > "u" && import("./__vite-browser-external-2447137e.js").then((e) => {
global.crypto = e;
});
const kError = Symbol("error"), kMessage = Symbol("message");

@@ -382,3 +385,3 @@ class ErrorEvent2 extends Event {

}
var b, T;
var b, F;
class PHPBrowser {

@@ -391,4 +394,4 @@ /**

l(this, b, void 0);
l(this, T, void 0);
this.requestHandler = t, d(this, b, {}), d(this, T, {
l(this, F, void 0);
this.requestHandler = t, d(this, b, {}), d(this, F, {
handleRedirects: !1,

@@ -421,3 +424,3 @@ maxRedirects: 4,

});
if (s.headers["set-cookie"] && this.setCookies(s.headers["set-cookie"]), a(this, T).handleRedirects && s.headers.location && r < a(this, T).maxRedirects) {
if (s.headers["set-cookie"] && this.setCookies(s.headers["set-cookie"]), a(this, F).handleRedirects && s.headers.location && r < a(this, F).maxRedirects) {
const i = new URL(

@@ -472,3 +475,3 @@ s.headers.location[0],

}
b = new WeakMap(), T = new WeakMap();
b = new WeakMap(), F = new WeakMap();
const DEFAULT_BASE_URL = "http://example.com";

@@ -484,3 +487,3 @@ function toRelativeUrl(e) {

}
var E, F, N, R, x, m, k, C, M, Z, B, Q, L, X;
var E, x, N, R, k, m, C, S, B, Q, L, X, O, ee;
class PHPRequestHandler {

@@ -498,3 +501,3 @@ /**

*/
l(this, M);
l(this, B);
/**

@@ -507,3 +510,3 @@ * Runs the requested PHP file with all the request and $_SERVER

*/
l(this, B);
l(this, L);
/**

@@ -518,12 +521,12 @@ * Resolve the requested path to the filesystem path of the requested PHP file.

*/
l(this, L);
l(this, O);
l(this, E, void 0);
l(this, F, void 0);
l(this, x, void 0);
l(this, N, void 0);
l(this, R, void 0);
l(this, x, void 0);
l(this, k, void 0);
l(this, m, void 0);
l(this, k, void 0);
l(this, C, void 0);
d(this, C, new Semaphore({ concurrency: 1 }));
l(this, S, void 0);
d(this, S, new Semaphore({ concurrency: 1 }));
const {

@@ -535,10 +538,10 @@ documentRoot: s = "/www/",

const n = new URL(i);
d(this, N, n.hostname), d(this, R, n.port ? Number(n.port) : n.protocol === "https:" ? 443 : 80), d(this, F, (n.protocol || "").replace(":", ""));
d(this, N, n.hostname), d(this, R, n.port ? Number(n.port) : n.protocol === "https:" ? 443 : 80), d(this, x, (n.protocol || "").replace(":", ""));
const o = a(this, R) !== 443 && a(this, R) !== 80;
d(this, x, [
d(this, k, [
a(this, N),
o ? `:${a(this, R)}` : ""
].join("")), d(this, m, n.pathname.replace(/\/+$/, "")), d(this, k, [
`${a(this, F)}://`,
a(this, x),
].join("")), d(this, m, n.pathname.replace(/\/+$/, "")), d(this, C, [
`${a(this, x)}://`,
a(this, k),
a(this, m)

@@ -557,7 +560,7 @@ ].join(""));

get isRequestRunning() {
return a(this, C).running > 0;
return a(this, S).running > 0;
}
/** @inheritDoc */
get absoluteUrl() {
return a(this, k);
return a(this, C);
}

@@ -577,6 +580,6 @@ /** @inheritDoc */

), n = `${a(this, E)}${i}`;
return seemsLikeAPHPRequestHandlerPath(n) ? await f(this, B, Q).call(this, t, s) : f(this, M, Z).call(this, n);
return seemsLikeAPHPRequestHandlerPath(n) ? await p(this, L, X).call(this, t, s) : p(this, B, Q).call(this, n);
}
}
E = new WeakMap(), F = new WeakMap(), N = new WeakMap(), R = new WeakMap(), x = new WeakMap(), m = new WeakMap(), k = new WeakMap(), C = new WeakMap(), M = new WeakSet(), Z = function(t) {
E = new WeakMap(), x = new WeakMap(), N = new WeakMap(), R = new WeakMap(), k = new WeakMap(), m = new WeakMap(), C = new WeakMap(), S = new WeakMap(), B = new WeakSet(), Q = function(t) {
if (!this.php.fileExists(t))

@@ -606,40 +609,48 @@ return new PHPResponse(

);
}, B = new WeakSet(), Q = async function(t, r) {
var i, n;
const s = await a(this, C).acquire();
}, L = new WeakSet(), X = async function(t, r) {
var i, n, o;
if (a(this, S).running > 0 && ((i = t.headers) == null ? void 0 : i["x-request-issuer"]) === "php")
return console.warn(
"Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead."
), new PHPResponse(
502,
{},
new TextEncoder().encode("502 Bad Gateway")
);
const s = await a(this, S).acquire();
try {
this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1"), this.php.addServerGlobalEntry("DOCUMENT_ROOT", a(this, E)), this.php.addServerGlobalEntry(
"HTTPS",
a(this, k).startsWith("https://") ? "on" : ""
a(this, C).startsWith("https://") ? "on" : ""
);
let o = "GET";
const c = {
host: a(this, x),
let c = "GET";
const h = {
host: a(this, k),
...normalizeHeaders(t.headers || {})
}, h = [];
}, f = [];
if (t.files && Object.keys(t.files).length) {
o = "POST";
for (const _ in t.files) {
const v = t.files[_];
h.push({
key: _,
name: v.name,
type: v.type,
data: new Uint8Array(await v.arrayBuffer())
c = "POST";
for (const y in t.files) {
const M = t.files[y];
f.push({
key: y,
name: M.name,
type: M.type,
data: new Uint8Array(await M.arrayBuffer())
});
}
(i = c["content-type"]) != null && i.startsWith("multipart/form-data") && (t.formData = parseMultipartFormDataString(
(n = h["content-type"]) != null && n.startsWith("multipart/form-data") && (t.formData = parseMultipartFormDataString(
t.body || ""
), c["content-type"] = "application/x-www-form-urlencoded", delete t.body);
), h["content-type"] = "application/x-www-form-urlencoded", delete t.body);
}
let p;
t.formData !== void 0 ? (o = "POST", c["content-type"] = c["content-type"] || "application/x-www-form-urlencoded", p = new URLSearchParams(
let u;
t.formData !== void 0 ? (c = "POST", h["content-type"] = h["content-type"] || "application/x-www-form-urlencoded", u = new URLSearchParams(
t.formData
).toString()) : p = t.body;
let u;
).toString()) : u = t.body;
let _;
try {
let _ = r.pathname;
if ((n = t.headers) != null && n["x-rewrite-url"])
let y = r.pathname;
if ((o = t.headers) != null && o["x-rewrite-url"])
try {
_ = new URL(
y = new URL(
t.headers["x-rewrite-url"]

@@ -649,3 +660,3 @@ ).pathname;

}
u = f(this, L, X).call(this, _);
_ = p(this, O, ee).call(this, y);
} catch {

@@ -663,8 +674,8 @@ return new PHPResponse(

),
protocol: a(this, F),
method: t.method || o,
body: p,
fileInfos: h,
scriptPath: u,
headers: c
protocol: a(this, x),
method: t.method || c,
body: u,
fileInfos: f,
scriptPath: _,
headers: h
});

@@ -674,3 +685,3 @@ } finally {

}
}, L = new WeakSet(), X = function(t) {
}, O = new WeakSet(), ee = function(t) {
let r = removePathPrefix(t, a(this, m));

@@ -691,5 +702,5 @@ r.includes(".php") ? r = r.split(".php")[0] + ".php" : (r.endsWith("/") || (r += "/"), r.endsWith("index.php") || (r += "index.php"));

\r
`), c = n.substring(0, o).trim(), h = n.substring(o + 4).trim(), p = c.match(/name="([^"]+)"/);
if (p) {
const u = p[1];
`), c = n.substring(0, o).trim(), h = n.substring(o + 4).trim(), f = c.match(/name="([^"]+)"/);
if (f) {
const u = f[1];
t[u] = h;

@@ -841,4 +852,4 @@ }

if (h in FileErrorCodes) {
const p = FileErrorCodes[h], u = typeof o[0] == "string" ? o[0] : null, _ = u !== null ? e.replaceAll("{path}", u) : e;
throw new Error(`${_}: ${p}`, {
const f = FileErrorCodes[h], u = typeof o[0] == "string" ? o[0] : null, _ = u !== null ? e.replaceAll("{path}", u) : e;
throw new Error(`${_}: ${f}`, {
cause: c

@@ -866,3 +877,3 @@ });

const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
var S, H, A, y, g, P, w, I, O, ee, U, te, D, re, $, se, W, ne, q, ie, j, oe, z, ae, G, le, J, ce, Y, ue, V, de;
var T, H, A, w, P, v, g, I, U, te, D, re, $, se, q, ne, W, ie, j, oe, z, ae, G, le, J, ce, Y, ue, V, de, K, he;
class BasePHP {

@@ -877,11 +888,11 @@ /**

constructor(e, t) {
l(this, O);
l(this, U);
l(this, D);
l(this, $);
l(this, q);
l(this, W);
l(this, q);
l(this, j);
l(this, z);
l(this, G);
l(this, J);
/**

@@ -896,14 +907,14 @@ * Adds file information to $_FILES superglobal in PHP.

*/
l(this, J);
l(this, Y);
l(this, V);
l(this, S, void 0);
l(this, K);
l(this, T, void 0);
l(this, H, void 0);
l(this, A, void 0);
l(this, y, void 0);
l(this, w, void 0);
l(this, P, void 0);
l(this, v, void 0);
l(this, g, void 0);
l(this, P, void 0);
l(this, w, void 0);
l(this, I, void 0);
d(this, S, []), d(this, y, !1), d(this, g, null), d(this, P, {}), d(this, w, /* @__PURE__ */ new Map()), d(this, I, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPBrowser(
d(this, T, []), d(this, w, !1), d(this, P, null), d(this, v, {}), d(this, g, /* @__PURE__ */ new Map()), d(this, I, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPBrowser(
new PHPRequestHandler(this, t)

@@ -913,10 +924,10 @@ ));

addEventListener(e, t) {
a(this, w).has(e) || a(this, w).set(e, /* @__PURE__ */ new Set()), a(this, w).get(e).add(t);
a(this, g).has(e) || a(this, g).set(e, /* @__PURE__ */ new Set()), a(this, g).get(e).add(t);
}
removeEventListener(e, t) {
var r;
(r = a(this, w).get(e)) == null || r.delete(t);
(r = a(this, g).get(e)) == null || r.delete(t);
}
dispatchEvent(e) {
const t = a(this, w).get(e.type);
const t = a(this, g).get(e.type);
if (t)

@@ -965,3 +976,3 @@ for (const r of t)

return "";
}, d(this, g, improveWASMErrorReporting(t)), this.dispatchEvent({
}, d(this, P, improveWASMErrorReporting(t)), this.dispatchEvent({
type: "runtime.initialized"

@@ -985,3 +996,3 @@ });

setPhpIniPath(e) {
if (a(this, y))
if (a(this, w))
throw new Error("Cannot set PHP ini path after calling run().");

@@ -997,5 +1008,5 @@ d(this, H, e), this[__private__dont__use].ccall(

setPhpIniEntry(e, t) {
if (a(this, y))
if (a(this, w))
throw new Error("Cannot set PHP ini entries after calling run().");
a(this, S).push([e, t]);
a(this, T).push([e, t]);
}

@@ -1017,9 +1028,9 @@ /** @inheritDoc */

try {
a(this, y) || (f(this, O, ee).call(this), d(this, y, !0)), f(this, z, ae).call(this, e.scriptPath || ""), f(this, D, re).call(this, e.relativeUri || ""), f(this, W, ne).call(this, e.method || "GET");
a(this, w) || (p(this, U, te).call(this), d(this, w, !0)), p(this, G, le).call(this, e.scriptPath || ""), p(this, $, se).call(this, e.relativeUri || ""), p(this, W, ie).call(this, e.method || "GET");
const s = normalizeHeaders(e.headers || {}), i = s.host || "example.com:443";
if (f(this, $, se).call(this, i, e.protocol || "http"), f(this, q, ie).call(this, s), e.body && (r = f(this, j, oe).call(this, e.body)), e.fileInfos)
if (p(this, q, ne).call(this, i, e.protocol || "http"), p(this, j, oe).call(this, s), e.body && (r = p(this, z, ae).call(this, e.body)), e.fileInfos)
for (const o of e.fileInfos)
f(this, J, ce).call(this, o);
typeof e.code == "string" && f(this, Y, ue).call(this, " ?>" + e.code), f(this, G, le).call(this);
const n = await f(this, V, de).call(this);
p(this, Y, ue).call(this, o);
typeof e.code == "string" && p(this, V, de).call(this, " ?>" + e.code), p(this, J, ce).call(this);
const n = await p(this, K, he).call(this);
if (e.throwOnError && n.exitCode !== 0) {

@@ -1048,3 +1059,3 @@ const o = {

addServerGlobalEntry(e, t) {
a(this, P)[e] = t;
a(this, v)[e] = t;
}

@@ -1158,6 +1169,6 @@ defineConstant(e, t) {

}
d(this, y, !1), d(this, g, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
d(this, w, !1), d(this, P, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
}
}
S = new WeakMap(), H = new WeakMap(), A = new WeakMap(), y = new WeakMap(), g = new WeakMap(), P = new WeakMap(), w = new WeakMap(), I = new WeakMap(), O = new WeakSet(), ee = function() {
T = new WeakMap(), H = new WeakMap(), A = new WeakMap(), w = new WeakMap(), P = new WeakMap(), v = new WeakMap(), g = new WeakMap(), I = new WeakMap(), U = new WeakSet(), te = function() {
if (this.setPhpIniEntry("auto_prepend_file", "/tmp/consts.php"), this.fileExists("/tmp/consts.php") || this.writeFile(

@@ -1174,4 +1185,4 @@ "/tmp/consts.php",

}`
), a(this, S).length > 0) {
const e = a(this, S).map(([t, r]) => `${t}=${r}`).join(`
), a(this, T).length > 0) {
const e = a(this, T).map(([t, r]) => `${t}=${r}`).join(`
`) + `

@@ -1188,3 +1199,3 @@

this[__private__dont__use].ccall("php_wasm_init", null, [], []);
}, U = new WeakSet(), te = function() {
}, D = new WeakSet(), re = function() {
const e = "/tmp/headers.json";

@@ -1206,3 +1217,3 @@ if (!this.fileExists(e))

};
}, D = new WeakSet(), re = function(e) {
}, $ = new WeakSet(), se = function(e) {
if (this[__private__dont__use].ccall(

@@ -1222,3 +1233,3 @@ "wasm_set_request_uri",

}
}, $ = new WeakSet(), se = function(e, t) {
}, q = new WeakSet(), ne = function(e, t) {
this[__private__dont__use].ccall(

@@ -1241,3 +1252,3 @@ "wasm_set_request_host",

), (t === "https" || !t && r === 443) && this.addServerGlobalEntry("HTTPS", "on");
}, W = new WeakSet(), ne = function(e) {
}, W = new WeakSet(), ie = function(e) {
this[__private__dont__use].ccall(

@@ -1249,3 +1260,3 @@ "wasm_set_request_method",

);
}, q = new WeakSet(), ie = function(e) {
}, j = new WeakSet(), oe = function(e) {
e.cookie && this[__private__dont__use].ccall(

@@ -1274,3 +1285,3 @@ "wasm_set_cookies",

}
}, j = new WeakSet(), oe = function(e) {
}, z = new WeakSet(), ae = function(e) {
const t = this[__private__dont__use].lengthBytesUTF8(e), r = this[__private__dont__use].malloc(t + 1);

@@ -1294,3 +1305,3 @@ if (!r)

), r;
}, z = new WeakSet(), ae = function(e) {
}, G = new WeakSet(), le = function(e) {
this[__private__dont__use].ccall(

@@ -1302,4 +1313,4 @@ "wasm_set_path_translated",

);
}, G = new WeakSet(), le = function() {
for (const e in a(this, P))
}, J = new WeakSet(), ce = function() {
for (const e in a(this, v))
this[__private__dont__use].ccall(

@@ -1309,5 +1320,5 @@ "wasm_add_SERVER_entry",

[STRING, STRING],
[e, a(this, P)[e]]
[e, a(this, v)[e]]
);
}, J = new WeakSet(), ce = function(e) {
}, Y = new WeakSet(), ue = function(e) {
const { key: t, name: r, type: s, data: i } = e, n = `/tmp/${Math.random().toFixed(20)}`;

@@ -1322,3 +1333,3 @@ this.writeFile(n, i);

);
}, Y = new WeakSet(), ue = function(e) {
}, V = new WeakSet(), de = function(e) {
this[__private__dont__use].ccall(

@@ -1330,3 +1341,3 @@ "wasm_set_php_code",

);
}, V = new WeakSet(), de = async function() {
}, K = new WeakSet(), he = async function() {
var i;

@@ -1337,6 +1348,6 @@ let e, t;

var h;
t = (p) => {
t = (f) => {
const u = new Error("Rethrown");
u.cause = p.error, u.betterMessage = p.message, o(u);
}, (h = a(this, g)) == null || h.addEventListener(
u.cause = f.error, u.betterMessage = f.message, o(u);
}, (h = a(this, P)) == null || h.addEventListener(
"error",

@@ -1355,4 +1366,4 @@ t

} catch (n) {
for (const p in this)
typeof this[p] == "function" && (this[p] = () => {
for (const f in this)
typeof this[f] == "function" && (this[f] = () => {
throw new Error(

@@ -1366,5 +1377,5 @@ "PHP runtime has crashed – see the earlier error for details."

} finally {
(i = a(this, g)) == null || i.removeEventListener("error", t), d(this, P, {});
(i = a(this, P)) == null || i.removeEventListener("error", t), d(this, v, {});
}
const { headers: r, httpStatusCode: s } = f(this, U, te).call(this);
const { headers: r, httpStatusCode: s } = p(this, D, re).call(this);
return new PHPResponse(

@@ -1456,7 +1467,7 @@ s,

for (const [u, _] of Object.entries(o))
n[u] = function(...v) {
return _(...v), c[u].apply(this, v);
n[u] = function(...y) {
return _(...y), c[u].apply(this, y);
};
}
function p() {
function f() {
for (const [u, _] of Object.entries(c))

@@ -1467,3 +1478,3 @@ e[__private__dont__use].FS[u] = _;

bind: h,
unbind: p
unbind: f
}, h();

@@ -1470,0 +1481,0 @@ }

{
"name": "@php-wasm/fs-journal",
"version": "0.6.0",
"version": "0.6.1",
"description": "Bindings to journal the PHP filesystem",

@@ -39,3 +39,3 @@ "repository": {

"license": "GPL-2.0-or-later",
"gitHead": "3f137306ec8e3b10ec0674a1fe69ee43349edb4a",
"gitHead": "171b22b853786b8912d9624ea064eaa1e985e96b",
"engines": {

@@ -42,0 +42,0 @@ "node": ">=18.18.2",

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