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
4
Versions
102
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.6 to 0.6.7

194

index.js

@@ -9,54 +9,64 @@ var Y = (e, t, r) => {

t instanceof WeakSet ? t.add(e) : t.set(e, r);
}, h = (e, t, r, s) => (Y(e, t, "write to private field"), s ? s.call(e, r) : t.set(e, r), r);
}, p = (e, t, r, s) => (Y(e, t, "write to private field"), s ? s.call(e, r) : t.set(e, r), r);
var f = (e, t, r) => (Y(e, t, "access private method"), r);
if (typeof File > "u") {
class e extends Blob {
constructor(r, s, n) {
super(r);
let i;
n != null && n.lastModified && (i = /* @__PURE__ */ new Date()), (!i || isNaN(i.getFullYear())) && (i = /* @__PURE__ */ new Date()), this.lastModifiedDate = i, this.lastModified = i.getMilliseconds(), this.name = s || "";
const currentJsRuntime = function() {
var e;
return typeof process < "u" && ((e = process.release) == null ? void 0 : e.name) === "node" ? "NODE" : typeof window < "u" ? "WEB" : (
// @ts-ignore
typeof WorkerGlobalScope < "u" && // @ts-ignore
self instanceof WorkerGlobalScope ? "WORKER" : "NODE"
);
}();
if (currentJsRuntime === "NODE") {
let e = function(r) {
return new Promise(function(s, n) {
r.onload = r.onerror = function(i) {
r.onload = r.onerror = null, i.type === "load" ? s(r.result) : n(new Error("Failed to read the blob/file"));
};
});
}, t = function() {
const r = new Uint8Array([1, 2, 3, 4]), n = new File([r], "test").stream();
try {
return n.getReader({ mode: "byob" }), !0;
} catch {
return !1;
}
};
if (typeof File > "u") {
class r extends Blob {
constructor(n, i, o) {
super(n);
let l;
o != null && o.lastModified && (l = /* @__PURE__ */ new Date()), (!l || isNaN(l.getFullYear())) && (l = /* @__PURE__ */ new Date()), this.lastModifiedDate = l, this.lastModified = l.getMilliseconds(), this.name = i || "";
}
}
global.File = r;
}
global.File = e;
}
function asPromise(e) {
return new Promise(function(t, r) {
e.onload = e.onerror = function(s) {
e.onload = e.onerror = null, s.type === "load" ? t(e.result) : r(new Error("Failed to read the blob/file"));
};
typeof Blob.prototype.arrayBuffer > "u" && (Blob.prototype.arrayBuffer = function() {
const s = new FileReader();
return s.readAsArrayBuffer(this), e(s);
}), typeof Blob.prototype.text > "u" && (Blob.prototype.text = function() {
const s = new FileReader();
return s.readAsText(this), e(s);
}), (typeof Blob.prototype.stream > "u" || !t()) && (Blob.prototype.stream = function() {
let r = 0;
const s = this;
return new ReadableStream({
type: "bytes",
// 0.5 MB seems like a reasonable chunk size, let's adjust
// this if needed.
autoAllocateChunkSize: 512 * 1024,
async pull(n) {
const i = n.byobRequest.view, l = await s.slice(
r,
r + i.byteLength
).arrayBuffer(), c = new Uint8Array(l);
new Uint8Array(i.buffer).set(c);
const h = c.byteLength;
n.byobRequest.respond(h), r += h, r >= s.size && n.close();
}
});
});
}
typeof Blob.prototype.arrayBuffer > "u" && (Blob.prototype.arrayBuffer = function() {
const t = new FileReader();
return t.readAsArrayBuffer(this), asPromise(t);
});
typeof Blob.prototype.text > "u" && (Blob.prototype.text = function() {
const t = new FileReader();
return t.readAsText(this), asPromise(t);
});
function isByobSupported() {
const e = new Uint8Array([1, 2, 3, 4]), r = new File([e], "test").stream();
try {
return r.getReader({ mode: "byob" }), !0;
} catch {
return !1;
}
}
(typeof Blob.prototype.stream > "u" || !isByobSupported()) && (Blob.prototype.stream = function() {
let e = 0;
const t = this;
return new ReadableStream({
type: "bytes",
// 0.5 MB seems like a reasonable chunk size, let's adjust
// this if needed.
autoAllocateChunkSize: 512 * 1024,
async pull(r) {
const s = r.byobRequest.view, i = await t.slice(e, e + s.byteLength).arrayBuffer(), o = new Uint8Array(i);
new Uint8Array(s.buffer).set(o);
const l = o.byteLength;
r.byobRequest.respond(l), e += l, e >= t.size && r.close();
}
});
});
if (typeof CustomEvent > "u") {
if (currentJsRuntime === "NODE" && typeof CustomEvent > "u") {
class e extends Event {

@@ -416,3 +426,3 @@ constructor(r, s = {}) {

u(this, T, void 0);
this.requestHandler = t, h(this, v, {}), h(this, T, {
this.requestHandler = t, p(this, v, {}), p(this, T, {
handleRedirects: !1,

@@ -508,12 +518,12 @@ maxRedirects: 4,

const t = `----${Math.random().toString(36).slice(2)}`, r = `multipart/form-data; boundary=${t}`, s = new TextEncoder(), n = [];
for (const [c, p] of Object.entries(e))
for (const [c, h] of Object.entries(e))
n.push(`--${t}\r
`), n.push(`Content-Disposition: form-data; name="${c}"`), p instanceof File && n.push(`; filename="${p.name}"`), n.push(`\r
`), p instanceof File && (n.push("Content-Type: application/octet-stream"), n.push(`\r
`), n.push(`Content-Disposition: form-data; name="${c}"`), h instanceof File && n.push(`; filename="${h.name}"`), n.push(`\r
`), h instanceof File && (n.push("Content-Type: application/octet-stream"), n.push(`\r
`)), n.push(`\r
`), p instanceof File ? n.push(await fileToUint8Array(p)) : n.push(p), n.push(`\r
`), h instanceof File ? n.push(await fileToUint8Array(h)) : n.push(h), n.push(`\r
`);
n.push(`--${t}--\r
`);
const i = n.reduce((c, p) => c + p.length, 0), o = new Uint8Array(i);
const i = n.reduce((c, h) => c + h.length, 0), o = new Uint8Array(i);
let l = 0;

@@ -535,3 +545,3 @@ for (const c of n)

}
var y, F, I, b, x, m, C, R, N, K, O, Z, U, X;
var y, F, N, b, x, m, C, R, I, K, O, Z, U, X;
class PHPRequestHandler {

@@ -549,3 +559,3 @@ /**

*/
u(this, N);
u(this, I);
/**

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

u(this, F, void 0);
u(this, I, void 0);
u(this, N, void 0);
u(this, b, void 0);

@@ -578,3 +588,3 @@ u(this, x, void 0);

u(this, R, void 0);
h(this, R, new Semaphore({ concurrency: 1 }));
p(this, R, new Semaphore({ concurrency: 1 }));
const {

@@ -584,10 +594,10 @@ documentRoot: s = "/www/",

} = r;
this.php = t, h(this, y, s);
this.php = t, p(this, y, s);
const i = new URL(n);
h(this, I, i.hostname), h(this, b, i.port ? Number(i.port) : i.protocol === "https:" ? 443 : 80), h(this, F, (i.protocol || "").replace(":", ""));
p(this, N, i.hostname), p(this, b, i.port ? Number(i.port) : i.protocol === "https:" ? 443 : 80), p(this, F, (i.protocol || "").replace(":", ""));
const o = a(this, b) !== 443 && a(this, b) !== 80;
h(this, x, [
a(this, I),
p(this, x, [
a(this, N),
o ? `:${a(this, b)}` : ""
].join("")), h(this, m, i.pathname.replace(/\/+$/, "")), h(this, C, [
].join("")), p(this, m, i.pathname.replace(/\/+$/, "")), p(this, C, [
`${a(this, F)}://`,

@@ -627,6 +637,6 @@ a(this, x),

), i = `${a(this, y)}${n}`;
return seemsLikeAPHPRequestHandlerPath(i) ? await f(this, O, Z).call(this, t, s) : f(this, N, K).call(this, i);
return seemsLikeAPHPRequestHandlerPath(i) ? await f(this, O, Z).call(this, t, s) : f(this, I, K).call(this, i);
}
}
y = new WeakMap(), F = new WeakMap(), I = new WeakMap(), b = new WeakMap(), x = new WeakMap(), m = new WeakMap(), C = new WeakMap(), R = new WeakMap(), N = new WeakSet(), K = function(t) {
y = new WeakMap(), F = new WeakMap(), N = new WeakMap(), b = new WeakMap(), x = new WeakMap(), m = new WeakMap(), C = new WeakMap(), R = new WeakMap(), I = new WeakSet(), K = function(t) {
if (!this.php.fileExists(t))

@@ -683,3 +693,3 @@ return new PHPResponse(

}
let p;
let h;
try {

@@ -694,3 +704,3 @@ let d = r.pathname;

}
p = f(this, U, X).call(this, d);
h = f(this, U, X).call(this, d);
} catch {

@@ -711,3 +721,3 @@ return new PHPResponse(

body: c,
scriptPath: p,
scriptPath: h,
headers: l

@@ -868,4 +878,4 @@ });

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

@@ -893,3 +903,3 @@ });

const STRING = "string", NUMBER = "number", __private__dont__use = Symbol("__private__dont__use");
var S, A, k, E, g, P, w, H, M, ee, B, te, L, re, $, se, D, ne, q, ie, W, oe, j, ae, z, le, G, ce, J, ue, Q, de;
var S, k, A, E, g, P, w, H, M, ee, B, te, L, re, D, se, $, ne, q, ie, W, oe, j, ae, z, le, G, ce, J, ue, Q, de;
class BasePHP {

@@ -907,4 +917,4 @@ /**

u(this, L);
u(this, D);
u(this, $);
u(this, D);
u(this, q);

@@ -918,4 +928,4 @@ u(this, W);

u(this, S, void 0);
u(this, k, void 0);
u(this, A, void 0);
u(this, k, void 0);
u(this, E, void 0);

@@ -926,3 +936,3 @@ u(this, g, void 0);

u(this, H, void 0);
h(this, S, []), h(this, E, !1), h(this, g, null), h(this, P, {}), h(this, w, /* @__PURE__ */ new Map()), h(this, H, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPBrowser(
p(this, S, []), p(this, E, !1), p(this, g, null), p(this, P, {}), p(this, w, /* @__PURE__ */ new Map()), p(this, H, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e), t && (this.requestHandler = new PHPBrowser(
new PHPRequestHandler(this, t)

@@ -983,3 +993,3 @@ ));

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

@@ -999,3 +1009,3 @@ });

);
h(this, k, e);
p(this, A, e);
}

@@ -1006,3 +1016,3 @@ /** @inheritDoc */

throw new Error("Cannot set PHP ini path after calling run().");
h(this, A, e), this[__private__dont__use].ccall(
p(this, k, e), this[__private__dont__use].ccall(
"wasm_set_phpini_path",

@@ -1035,9 +1045,9 @@ null,

try {
if (a(this, E) || (f(this, M, ee).call(this), h(this, E, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
if (a(this, E) || (f(this, M, ee).call(this), p(this, E, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
throw new Error(
`The script path "${e.scriptPath}" does not exist.`
);
f(this, j, ae).call(this, e.scriptPath || ""), f(this, L, re).call(this, e.relativeUri || ""), f(this, D, ne).call(this, e.method || "GET");
f(this, j, ae).call(this, e.scriptPath || ""), f(this, L, re).call(this, e.relativeUri || ""), f(this, $, ne).call(this, e.method || "GET");
const s = normalizeHeaders(e.headers || {}), n = s.host || "example.com:443";
f(this, $, se).call(this, n, e.protocol || "http"), f(this, q, ie).call(this, s), e.body && (r = f(this, W, oe).call(this, e.body)), typeof e.code == "string" && f(this, J, ue).call(this, " ?>" + e.code), f(this, z, le).call(this);
f(this, D, se).call(this, n, e.protocol || "http"), f(this, q, ie).call(this, s), e.body && (r = f(this, W, oe).call(this, e.body)), typeof e.code == "string" && f(this, J, ue).call(this, " ?>" + e.code), f(this, z, le).call(this);
const i = e.env || {};

@@ -1166,3 +1176,3 @@ for (const l in i)

}
if (this.initializeRuntime(e), a(this, A) && this.setPhpIniPath(a(this, A)), a(this, k) && this.setSapiName(a(this, k)), this.requestHandler) {
if (this.initializeRuntime(e), a(this, k) && this.setPhpIniPath(a(this, k)), a(this, A) && this.setSapiName(a(this, A)), this.requestHandler) {
const r = this.documentRoot;

@@ -1180,6 +1190,6 @@ copyFS(t, this[__private__dont__use].FS, r);

}
h(this, E, !1), h(this, g, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
p(this, E, !1), p(this, g, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
}
}
S = new WeakMap(), A = new WeakMap(), k = new WeakMap(), E = new WeakMap(), g = new WeakMap(), P = new WeakMap(), w = new WeakMap(), H = new WeakMap(), M = new WeakSet(), ee = function() {
S = new WeakMap(), k = new WeakMap(), A = new WeakMap(), E = new WeakMap(), g = new WeakMap(), P = new WeakMap(), w = new WeakMap(), H = new WeakMap(), M = new WeakSet(), ee = function() {
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(

@@ -1241,3 +1251,3 @@ "/internal/consts.php",

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

@@ -1260,3 +1270,3 @@ "wasm_set_request_host",

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

@@ -1350,6 +1360,6 @@ "wasm_set_request_method",

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

@@ -1369,4 +1379,4 @@ "error",

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

@@ -1380,3 +1390,3 @@ "PHP runtime has crashed – see the earlier error for details."

} finally {
(n = a(this, g)) == null || n.removeEventListener("error", t), h(this, P, {});
(n = a(this, g)) == null || n.removeEventListener("error", t), p(this, P, {});
}

@@ -1469,3 +1479,3 @@ const { headers: r, httpStatusCode: s } = f(this, B, te).call(this);

}
function p() {
function h() {
for (const [d, _] of Object.entries(l))

@@ -1476,3 +1486,3 @@ e[__private__dont__use].FS[d] = _;

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

@@ -1479,0 +1489,0 @@ }

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

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

"license": "GPL-2.0-or-later",
"gitHead": "90f82ca946f8573b358c1320be0b6b8674f67cfc",
"gitHead": "c4c52563eee8997b94cd4a0875e10fb5d8ccda42",
"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