@php-wasm/universal 0.9.28 → 0.9.29

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 CHANGED
@@ -1528,8 +1528,9 @@ class PHPProcessManager {
1528
1528
  /**
1529
1529
  * Get a PHP instance.
1530
1530
  *
1531
- * It could be either the primary PHP instance, an idle disposable PHP instance,
1532
- * or a newly spawned PHP instance – depending on the resource availability.
1531
+ * It could be either the primary PHP instance, an idle disposable PHP
1532
+ * instance, or a newly spawned PHP instance – depending on the resource
1533
+ * availability.
1533
1534
  *
1534
1535
  * @throws {MaxPhpInstancesError} when the maximum number of PHP instances is reached
1535
1536
  * and the waiting timeout is exceeded.
@@ -1863,8 +1864,8 @@ class PHPRequestHandler {
1863
1864
  * dispatching it to the PHP runtime.
1864
1865
  *
1865
1866
  * The request() method mode behaves like a web server and only works if
1866
- * the PHP was initialized with a `requestHandler` option (which the online version
1867
- * of WordPress Playground does by default).
1867
+ * the PHP was initialized with a `requestHandler` option (which the online
1868
+ * version of WordPress Playground does by default).
1868
1869
  *
1869
1870
  * In the request mode, you pass an object containing the request information
1870
1871
  * (method, headers, body, etc.) and the path to the PHP file to run:
@@ -1972,9 +1973,9 @@ P = new WeakMap(), R = new WeakMap(), T = new WeakMap(), v = new WeakMap(), F =
1972
1973
  200,
1973
1974
  {
1974
1975
  "content-length": [`${s.byteLength}`],
1975
- // @TODO: Infer the content-type from the arrayBuffer instead of the file path.
1976
- // The code below won't return the correct mime-type if the extension
1977
- // was tampered with.
1976
+ // @TODO: Infer the content-type from the arrayBuffer instead of the
1977
+ // file path. The code below won't return the correct mime-type if the
1978
+ // extension was tampered with.
1978
1979
  "content-type": [inferMimeType(r)],
1979
1980
  "accept-ranges": ["bytes"],
1980
1981
  "cache-control": ["public, max-age=0"]
@@ -1,4 +1,7 @@
1
- /** Other WebAssembly declarations, for compatibility with older versions of Typescript */
1
+ /**
2
+ * Other WebAssembly declarations, for compatibility with older versions of
3
+ * Typescript
4
+ */
2
5
  export declare namespace Emscripten {
3
6
  export interface RootFS extends Emscripten.FileSystemInstance {
4
7
  filesystems: Record<string, Emscripten.FileSystemType>;
@@ -86,12 +89,12 @@ export declare namespace Emscripten {
86
89
  * to `1` in your Emscripten build. It return a Promise that resolves to an
87
90
  * initialized, ready-to-call `EmscriptenModule` instance.
88
91
  *
89
- * By default, the factory function will be named `Module`. It's recommended to
90
- * use the `EXPORT_ES6` option, in which the factory function will be the
91
- * default export. If used without `EXPORT_ES6`, the factory function will be a
92
- * global variable. You can rename the variable using the `EXPORT_NAME` build
93
- * option. It's left to you to export any global variables as needed in your
94
- * application's types.
92
+ * By default, the factory function will be named `Module`. It's recommended
93
+ * to use the `EXPORT_ES6` option, in which the factory function will be the
94
+ * default export. If used without `EXPORT_ES6`, the factory function will be
95
+ * a global variable. You can rename the variable using the `EXPORT_NAME`
96
+ * build option. It's left to you to export any global variables as needed in
97
+ * your application's types.
95
98
  * @param moduleOverrides Default properties for the initialized module.
96
99
  */
97
100
  export type EmscriptenModuleFactory<T extends EmscriptenModule = EmscriptenModule> = (moduleOverrides?: Partial<T>) => Promise<T>;
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Loads the PHP runtime with the given arguments and data dependencies.
3
3
  *
4
- * This function handles the entire PHP initialization pipeline. In particular, it:
4
+ * This function handles the entire PHP initialization pipeline. In particular,
5
+ * it:
5
6
  *
6
7
  * * Instantiates the Emscripten PHP module
7
8
  * * Wires it together with the data dependencies and loads them
@@ -19,10 +20,10 @@
19
20
  *
20
21
  * **The PHP loader module:**
21
22
  *
22
- * In the basic usage example, `phpLoaderModule` is **not** a vanilla Emscripten module. Instead,
23
- * it's an ESM module that wraps the regular Emscripten output and adds some
24
- * extra functionality. It's generated by the Dockerfile shipped with this repo.
25
- * Here's the API it provides:
23
+ * In the basic usage example, `phpLoaderModule` is **not** a vanilla
24
+ * Emscripten module. Instead, it's an ESM module that wraps the regular
25
+ * Emscripten output and adds some extra functionality. It's generated by the
26
+ * Dockerfile shipped with this repo. Here's the API it provides:
26
27
  *
27
28
  * ```js
28
29
  * // php.wasm size in bytes:
@@ -72,17 +73,19 @@
72
73
  * be quite inconvenient. Fortunately, Emscripten provides a "data dependencies"
73
74
  * feature.
74
75
  *
75
- * Data dependencies consist of a `dependency.data` file and a `dependency.js` loader and
76
- * can be packaged with the [file_packager.py tool]( https://emscripten.org/docs/porting/files/packaging_files.html#packaging-using-the-file-packager-tool).
77
- * This project requires wrapping the Emscripten-generated `dependency.js` file in an ES
78
- * module as follows:
76
+ * Data dependencies consist of a `dependency.data` file and a `dependency.js`
77
+ * loader and can be packaged with the [file_packager.py tool](
78
+ * https://emscripten.org/docs/porting/files/packaging_files.html#packaging-using-the-file-packager-tool).
79
+ * This project requires wrapping the Emscripten-generated `dependency.js` file
80
+ * in an ES module as follows:
79
81
  *
80
82
  * 1. Prepend `export default function(emscriptenPHPModule) {'; `
81
83
  * 2. Prepend `export const dependencyFilename = '<DATA FILE NAME>'; `
82
84
  * 3. Prepend `export const dependenciesTotalSize = <DATA FILE SIZE>;`
83
85
  * 4. Append `}`
84
86
  *
85
- * Be sure to use the `--export-name="emscriptenPHPModule"` file_packager.py option.
87
+ * Be sure to use the `--export-name="emscriptenPHPModule"` file_packager.py
88
+ * option.
86
89
  *
87
90
  * You want the final output to look as follows:
88
91
  *
@@ -96,8 +99,8 @@
96
99
  * }
97
100
  * ```
98
101
  *
99
- * Such a constructions enables loading the `dependency.js` as an ES Module using
100
- * `import("/dependency.js")`.
102
+ * Such a constructions enables loading the `dependency.js` as an ES Module
103
+ * using `import("/dependency.js")`.
101
104
  *
102
105
  * Once it's ready, you can load PHP and your data dependencies as follows:
103
106
  *
@@ -44,18 +44,20 @@ export declare class MaxPhpInstancesError extends Error {
44
44
  * * A pool of disposable PHP instances that are spawned to handle a single
45
45
  * request and reaped immediately after.
46
46
  *
47
- * When a new request comes in, PHPProcessManager yields the idle instance to handle it,
48
- * and immediately starts initializing a new idle instance. In other words, for n concurrent
49
- * requests, there are at most n+1 PHP instances running at the same time.
47
+ * When a new request comes in, PHPProcessManager yields the idle instance to
48
+ * handle it, and immediately starts initializing a new idle instance. In other
49
+ * words, for n concurrent requests, there are at most n+1 PHP instances
50
+ * running at the same time.
50
51
  *
51
- * A slight nuance is that the first idle instance is not initialized until the first
52
- * concurrent request comes in. This is because many use-cases won't involve parallel
53
- * requests and, for those, we can avoid eagerly spinning up a second PHP instance.
52
+ * A slight nuance is that the first idle instance is not initialized until the
53
+ * first concurrent request comes in. This is because many use-cases won't
54
+ * involve parallel requests and, for those, we can avoid eagerly spinning up a
55
+ * second PHP instance.
54
56
  *
55
- * This strategy is inspired by Cowboy, an Erlang HTTP server. Handling a single extra
56
- * request can happen immediately, while handling multiple extra requests requires
57
- * extra time to spin up a few PHP instances. This is a more resource-friendly tradeoff
58
- * than keeping 5 idle instances at all times.
57
+ * This strategy is inspired by Cowboy, an Erlang HTTP server. Handling a
58
+ * single extra request can happen immediately, while handling multiple extra
59
+ * requests requires extra time to spin up a few PHP instances. This is a more
60
+ * resource-friendly tradeoff than keeping 5 idle instances at all times.
59
61
  */
60
62
  export declare class PHPProcessManager implements AsyncDisposable {
61
63
  private primaryPhp?;
@@ -82,8 +84,9 @@ export declare class PHPProcessManager implements AsyncDisposable {
82
84
  /**
83
85
  * Get a PHP instance.
84
86
  *
85
- * It could be either the primary PHP instance, an idle disposable PHP instance,
86
- * or a newly spawned PHP instance – depending on the resource availability.
87
+ * It could be either the primary PHP instance, an idle disposable PHP
88
+ * instance, or a newly spawned PHP instance – depending on the resource
89
+ * availability.
87
90
  *
88
91
  * @throws {MaxPhpInstancesError} when the maximum number of PHP instances is reached
89
92
  * and the waiting timeout is exceeded.
@@ -165,8 +165,8 @@ export declare class PHPRequestHandler {
165
165
  * dispatching it to the PHP runtime.
166
166
  *
167
167
  * The request() method mode behaves like a web server and only works if
168
- * the PHP was initialized with a `requestHandler` option (which the online version
169
- * of WordPress Playground does by default).
168
+ * the PHP was initialized with a `requestHandler` option (which the online
169
+ * version of WordPress Playground does by default).
170
170
  *
171
171
  * In the request mode, you pass an object containing the request information
172
172
  * (method, headers, body, etc.) and the path to the PHP file to run:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/universal",
3
- "version": "0.9.28",
3
+ "version": "0.9.29",
4
4
  "description": "PHP.wasm – emscripten bindings for PHP",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "module": "./index.js",
38
38
  "types": "index.d.ts",
39
39
  "license": "GPL-2.0-or-later",
40
- "gitHead": "15d87898b0a7f8a0cf322425923336df1d84843b",
40
+ "gitHead": "79ef61d98407b1a90f622f6bef8f91001c568d00",
41
41
  "engines": {
42
42
  "node": ">=18.18.0",
43
43
  "npm": ">=8.11.0"
@@ -45,10 +45,10 @@
45
45
  "dependencies": {
46
46
  "comlink": "^4.4.1",
47
47
  "ini": "4.1.2",
48
- "@php-wasm/node-polyfills": "0.9.28",
49
- "@php-wasm/logger": "0.9.28",
50
- "@php-wasm/util": "0.9.28",
51
- "@php-wasm/stream-compression": "0.9.28",
52
- "@php-wasm/progress": "0.9.28"
48
+ "@php-wasm/node-polyfills": "0.9.29",
49
+ "@php-wasm/logger": "0.9.29",
50
+ "@php-wasm/util": "0.9.29",
51
+ "@php-wasm/stream-compression": "0.9.29",
52
+ "@php-wasm/progress": "0.9.29"
53
53
  }
54
54
  }