@php-wasm/universal 3.1.4 → 3.1.8

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/lib/api.d.ts CHANGED
@@ -19,3 +19,20 @@ export declare function consumeAPI<APIType>(remote: Worker | Window | NodeWorker
19
19
  export type PublicAPI<Methods, PipedAPI = unknown> = RemoteAPI<Methods & PipedAPI>;
20
20
  export declare function exposeAPI<Methods, PipedAPI>(apiMethods?: Methods, pipedApi?: PipedAPI, targetWorker?: MessagePort | NodeWorker | NodeProcess): [() => void, (e: Error) => void, PublicAPI<Methods, PipedAPI>];
21
21
  export declare function exposeSyncAPI<Methods>(apiMethods: Methods, port: IsomorphicMessagePort): Promise<[() => void, (e: Error) => void, Methods]>;
22
+ /**
23
+ * Bridges a ReadableStream to a MessagePort by reading chunks and posting
24
+ * messages to the port. Used as a fallback when transferable streams are not
25
+ * supported (e.g., Safari).
26
+ *
27
+ * Protocol of the returned MessagePort:
28
+ *
29
+ * { t: 'chunk', b: ArrayBuffer } – next binary chunk
30
+ * { t: 'close' } – end of stream
31
+ * { t: 'error', m: string } – terminal error
32
+ */
33
+ export declare function streamToPort(stream: ReadableStream<Uint8Array>): MessagePort;
34
+ /**
35
+ * Reconstructs a ReadableStream from a MessagePort using the inverse of the
36
+ * streamToPort protocol. Each message enqueues data, closes, or errors.
37
+ */
38
+ export declare function portToStream(port: MessagePort): ReadableStream<Uint8Array>;
@@ -38,7 +38,7 @@ export declare class StreamedPHPResponse {
38
38
  * else is an error.
39
39
  */
40
40
  readonly exitCode: Promise<number>;
41
- private parsedHeaders;
41
+ private cachedParsedHeaders;
42
42
  private cachedStdoutBytes;
43
43
  private cachedStderrText;
44
44
  constructor(headers: ReadableStream<Uint8Array>, stdout: ReadableStream<Uint8Array>, stderr: ReadableStream<Uint8Array>, exitCode: Promise<number>);
@@ -9,11 +9,15 @@ import type { PHP } from './php';
9
9
  * The function automatically patches PROXYFS with mmap support before mounting, ensuring
10
10
  * libraries like ICU can memory-map data files through the proxied filesystem.
11
11
  *
12
+ * Mounts are registered via php.mount() so they survive runtime rotation.
13
+ * When the replica's WASM module is hot-swapped, hotSwapPHPRuntime()
14
+ * re-applies these mount handlers on the fresh module.
15
+ *
12
16
  * @param sourceOfTruth - The PHP instance containing the original files
13
17
  * @param replica - The PHP instance that will access files through PROXYFS
14
18
  * @param paths - Absolute paths to mount (e.g., ['/wordpress', '/internal/shared'])
15
19
  */
16
- export declare function proxyFileSystem(sourceOfTruth: PHP, replica: PHP, paths: string[]): void;
20
+ export declare function proxyFileSystem(sourceOfTruth: PHP, replica: PHP, paths: string[]): Promise<void>;
17
21
  /**
18
22
  * Answers whether the given path is to a shared filesystem.
19
23
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/universal",
3
- "version": "3.1.4",
3
+ "version": "3.1.8",
4
4
  "description": "PHP.wasm – emscripten bindings for PHP",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,18 +37,18 @@
37
37
  "module": "./index.js",
38
38
  "types": "index.d.ts",
39
39
  "license": "GPL-2.0-or-later",
40
- "gitHead": "a7cde6f2a2d3cef27f51f24e9ddadbe5ca05344b",
40
+ "gitHead": "ba6a9509c9db4e0b7af6f155cf31162a6b659b5f",
41
41
  "engines": {
42
42
  "node": ">=20.10.0",
43
43
  "npm": ">=10.2.3"
44
44
  },
45
45
  "dependencies": {
46
46
  "ini": "4.1.2",
47
- "@php-wasm/node-polyfills": "3.1.4",
48
- "@php-wasm/logger": "3.1.4",
49
- "@php-wasm/util": "3.1.4",
50
- "@php-wasm/stream-compression": "3.1.4",
51
- "@php-wasm/progress": "3.1.4"
47
+ "@php-wasm/node-polyfills": "3.1.8",
48
+ "@php-wasm/logger": "3.1.8",
49
+ "@php-wasm/util": "3.1.8",
50
+ "@php-wasm/stream-compression": "3.1.8",
51
+ "@php-wasm/progress": "3.1.8"
52
52
  },
53
53
  "packageManager": "npm@10.9.2",
54
54
  "overrides": {
@@ -57,7 +57,6 @@
57
57
  "react-dom": "18.3.1",
58
58
  "typescript": "5.4.5",
59
59
  "@playwright/test": "1.55.1",
60
- "ws": "8.18.3",
61
60
  "tmp": "0.2.5",
62
61
  "form-data": "^4.0.4",
63
62
  "lodash": "^4.17.23",