@wp-playground/client 3.1.2 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +21 -21
- package/index.js +23 -10
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -702,23 +702,36 @@ const oi = class oi {
|
|
|
702
702
|
*/
|
|
703
703
|
static fromPHPResponse(t) {
|
|
704
704
|
const r = new ReadableStream({
|
|
705
|
-
start(
|
|
706
|
-
|
|
705
|
+
start(l) {
|
|
706
|
+
l.enqueue(t.bytes), l.close();
|
|
707
707
|
}
|
|
708
|
-
}), i =
|
|
709
|
-
|
|
710
|
-
|
|
708
|
+
}), i = [];
|
|
709
|
+
for (const [l, p] of Object.entries(t.headers))
|
|
710
|
+
for (const c of p)
|
|
711
|
+
i.push(`${l}: ${c}`);
|
|
712
|
+
const a = JSON.stringify({
|
|
713
|
+
status: t.httpStatusCode,
|
|
714
|
+
headers: i
|
|
715
|
+
}), s = new ReadableStream({
|
|
716
|
+
start(l) {
|
|
717
|
+
l.enqueue(new TextEncoder().encode(a)), l.close();
|
|
718
|
+
}
|
|
719
|
+
}), n = new ReadableStream({
|
|
720
|
+
start(l) {
|
|
721
|
+
t.errors.length > 0 && l.enqueue(
|
|
722
|
+
new TextEncoder().encode(t.errors)
|
|
723
|
+
), l.close();
|
|
711
724
|
}
|
|
712
|
-
}),
|
|
713
|
-
|
|
725
|
+
}), o = new oi(
|
|
726
|
+
s,
|
|
714
727
|
r,
|
|
715
|
-
|
|
728
|
+
n,
|
|
716
729
|
Promise.resolve(t.exitCode)
|
|
717
730
|
);
|
|
718
|
-
return
|
|
731
|
+
return o.parsedHeaders = Promise.resolve({
|
|
719
732
|
headers: t.headers,
|
|
720
733
|
httpStatusCode: t.httpStatusCode
|
|
721
|
-
}),
|
|
734
|
+
}), o;
|
|
722
735
|
}
|
|
723
736
|
/**
|
|
724
737
|
* Creates a StreamedPHPResponse for a given HTTP status code.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/client",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "WordPress Playground client",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"main": "./index.cjs",
|
|
38
38
|
"module": "./index.js",
|
|
39
39
|
"types": "index.d.ts",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "54bb87ba4c9624ec02f60194a2f1938b3f42477b",
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=20.10.0",
|
|
43
43
|
"npm": ">=10.2.3"
|