@php-wasm/web 0.9.25 → 0.9.27
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.js +19 -13
- package/package.json +8 -8
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PHPResponse as C, LatestSupportedPHPVersion as R, loadPHPRuntime as L, FSHelpers as w, __private__dont__use as g } from "@php-wasm/universal";
|
|
2
2
|
import * as d from "comlink";
|
|
3
|
-
import { PhpWasmError as
|
|
3
|
+
import { PhpWasmError as h, Semaphore as M, joinPaths as T } from "@php-wasm/util";
|
|
4
4
|
import { responseTo as O } from "@php-wasm/web-service-worker";
|
|
5
|
-
import { logger as
|
|
5
|
+
import { logger as p } from "@php-wasm/logger";
|
|
6
6
|
import { journalFSEvents as z } from "@php-wasm/fs-journal";
|
|
7
7
|
function B(t, r = void 0) {
|
|
8
8
|
W();
|
|
@@ -166,22 +166,28 @@ const I = new Promise((t) => {
|
|
|
166
166
|
});
|
|
167
167
|
function X(t) {
|
|
168
168
|
if (!t)
|
|
169
|
-
throw new
|
|
169
|
+
throw new h("PHP API client must be a valid client object.");
|
|
170
170
|
b(t);
|
|
171
171
|
}
|
|
172
172
|
async function Y(t, r) {
|
|
173
173
|
const e = navigator.serviceWorker;
|
|
174
174
|
if (!e)
|
|
175
|
-
throw window.isSecureContext ? new
|
|
175
|
+
throw window.isSecureContext ? new h(
|
|
176
176
|
"Service workers are not supported in your browser."
|
|
177
|
-
) : new
|
|
177
|
+
) : new h(
|
|
178
178
|
"WordPress Playground uses service workers and may only work on HTTPS and http://localhost/ sites, but the current site is neither."
|
|
179
179
|
);
|
|
180
|
-
|
|
180
|
+
const a = await e.register(r, {
|
|
181
181
|
type: "module",
|
|
182
182
|
// Always bypass HTTP cache when fetching the new Service Worker script:
|
|
183
183
|
updateViaCache: "none"
|
|
184
|
-
})
|
|
184
|
+
});
|
|
185
|
+
try {
|
|
186
|
+
await a.update();
|
|
187
|
+
} catch (n) {
|
|
188
|
+
p.error("Failed to update service worker.", n);
|
|
189
|
+
}
|
|
190
|
+
navigator.serviceWorker.addEventListener(
|
|
185
191
|
"message",
|
|
186
192
|
async function(i) {
|
|
187
193
|
if (t && i.data.scope !== t)
|
|
@@ -253,15 +259,15 @@ async function _(t, r, e) {
|
|
|
253
259
|
t.mkdir(l);
|
|
254
260
|
} catch (f) {
|
|
255
261
|
if ((f == null ? void 0 : f.errno) !== 20)
|
|
256
|
-
throw
|
|
262
|
+
throw p.error(f), f;
|
|
257
263
|
}
|
|
258
264
|
i.push([o, l]);
|
|
259
265
|
} else if (o.kind === "file") {
|
|
260
|
-
const f = await o.getFile(),
|
|
266
|
+
const f = await o.getFile(), m = new Uint8Array(await f.arrayBuffer());
|
|
261
267
|
t.createDataFile(
|
|
262
268
|
c,
|
|
263
269
|
o.name,
|
|
264
|
-
|
|
270
|
+
m,
|
|
265
271
|
!0,
|
|
266
272
|
!0,
|
|
267
273
|
!0
|
|
@@ -288,10 +294,10 @@ async function v(t, r, e, a) {
|
|
|
288
294
|
n.push([u, f, l]);
|
|
289
295
|
return;
|
|
290
296
|
}
|
|
291
|
-
const
|
|
297
|
+
const m = await u.getDirectoryHandle(l, {
|
|
292
298
|
create: !0
|
|
293
299
|
});
|
|
294
|
-
return await i(f,
|
|
300
|
+
return await i(f, m);
|
|
295
301
|
})
|
|
296
302
|
);
|
|
297
303
|
}
|
|
@@ -402,7 +408,7 @@ class J {
|
|
|
402
408
|
(await a.getFileHandle(n)).move(s, c);
|
|
403
409
|
}
|
|
404
410
|
} catch (i) {
|
|
405
|
-
throw
|
|
411
|
+
throw p.log({ entry: r, name: n }), p.error(i), i;
|
|
406
412
|
}
|
|
407
413
|
}
|
|
408
414
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/web",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.27",
|
|
4
4
|
"description": "PHP.wasm for the web",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"type": "module",
|
|
30
30
|
"main": "index.js",
|
|
31
31
|
"types": "index.d.ts",
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "a0856a3e94aec6e95add6e828d66cc90ff47ff95",
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=16.15.1",
|
|
35
35
|
"npm": ">=8.11.0"
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"comlink": "^4.4.1",
|
|
39
39
|
"express": "4.19.2",
|
|
40
40
|
"ini": "4.1.2",
|
|
41
|
-
"ws": "8.
|
|
41
|
+
"ws": "8.18.0",
|
|
42
42
|
"yargs": "17.7.2",
|
|
43
|
-
"@php-wasm/universal": "0.9.
|
|
44
|
-
"@php-wasm/util": "0.9.
|
|
45
|
-
"@php-wasm/logger": "0.9.
|
|
46
|
-
"@php-wasm/fs-journal": "0.9.
|
|
47
|
-
"@php-wasm/web-service-worker": "0.9.
|
|
43
|
+
"@php-wasm/universal": "0.9.27",
|
|
44
|
+
"@php-wasm/util": "0.9.27",
|
|
45
|
+
"@php-wasm/logger": "0.9.27",
|
|
46
|
+
"@php-wasm/fs-journal": "0.9.27",
|
|
47
|
+
"@php-wasm/web-service-worker": "0.9.27"
|
|
48
48
|
}
|
|
49
49
|
}
|