@php-wasm/universal 1.1.3 → 1.1.4
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 +17 -13
- package/index.cjs.map +1 -1
- package/index.js +598 -465
- package/index.js.map +1 -1
- package/lib/api.d.ts +18 -0
- package/lib/index.d.ts +2 -0
- package/lib/php-request-handler.d.ts +2 -1
- package/lib/php-worker.d.ts +2 -1
- package/package.json +8 -8
package/lib/api.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as Comlink from 'comlink';
|
|
2
|
+
import type { NodeEndpoint } from 'comlink/dist/esm/node-adapter';
|
|
3
|
+
export type WithAPIState = {
|
|
4
|
+
/**
|
|
5
|
+
* Resolves to true when the remote API is ready for
|
|
6
|
+
* Comlink communication, but not necessarily fully initialized yet.
|
|
7
|
+
*/
|
|
8
|
+
isConnected: () => Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves to true when the remote API is declares it's
|
|
11
|
+
* fully loaded and ready to be used.
|
|
12
|
+
*/
|
|
13
|
+
isReady: () => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export type RemoteAPI<T> = Comlink.Remote<T> & WithAPIState;
|
|
16
|
+
export declare function consumeAPI<APIType>(remote: Worker | Window | NodeEndpoint, context?: undefined | EventTarget): RemoteAPI<APIType>;
|
|
17
|
+
export type PublicAPI<Methods, PipedAPI = unknown> = RemoteAPI<Methods & PipedAPI>;
|
|
18
|
+
export declare function exposeAPI<Methods, PipedAPI>(apiMethods?: Methods, pipedApi?: PipedAPI, targetWorker?: NodeEndpoint): [() => void, (e: Error) => void, PublicAPI<Methods, PipedAPI>];
|
package/lib/index.d.ts
CHANGED
|
@@ -29,3 +29,5 @@ export type { FileTree } from './write-files';
|
|
|
29
29
|
export { DEFAULT_BASE_URL, ensurePathPrefix, removePathPrefix, toRelativeUrl, } from './urls';
|
|
30
30
|
export { isExitCode } from './is-exit-code';
|
|
31
31
|
export { proxyFileSystem } from './proxy-file-system';
|
|
32
|
+
export * from './api';
|
|
33
|
+
export type { WithAPIState as WithIsReady } from './api';
|
|
@@ -136,7 +136,7 @@ export type PHPRequestHandlerConfiguration = BaseConfiguration & ({
|
|
|
136
136
|
* // "Hi from PHP!"
|
|
137
137
|
* ```
|
|
138
138
|
*/
|
|
139
|
-
export declare class PHPRequestHandler {
|
|
139
|
+
export declare class PHPRequestHandler implements AsyncDisposable {
|
|
140
140
|
#private;
|
|
141
141
|
rewriteRules: RewriteRule[];
|
|
142
142
|
processManager: PHPProcessManager;
|
|
@@ -228,6 +228,7 @@ export declare class PHPRequestHandler {
|
|
|
228
228
|
* @param request - PHP Request data.
|
|
229
229
|
*/
|
|
230
230
|
request(request: PHPRequest): Promise<PHPResponse>;
|
|
231
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
231
232
|
}
|
|
232
233
|
/**
|
|
233
234
|
* Applies the given rewrite rules to the given path.
|
package/lib/php-worker.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type LimitedPHPApi = Pick<PHP, 'request' | 'defineConstant' | 'addEventLi
|
|
|
11
11
|
/**
|
|
12
12
|
* A PHP client that can be used to run PHP code in the browser.
|
|
13
13
|
*/
|
|
14
|
-
export declare class PHPWorker implements LimitedPHPApi {
|
|
14
|
+
export declare class PHPWorker implements LimitedPHPApi, AsyncDisposable {
|
|
15
15
|
/** @inheritDoc @php-wasm/universal!RequestHandler.absoluteUrl */
|
|
16
16
|
absoluteUrl: string;
|
|
17
17
|
/** @inheritDoc @php-wasm/universal!RequestHandler.documentRoot */
|
|
@@ -76,4 +76,5 @@ export declare class PHPWorker implements LimitedPHPApi {
|
|
|
76
76
|
addEventListener(eventType: PHPEvent['type'], listener: PHPEventListener): void;
|
|
77
77
|
/** @inheritDoc @php-wasm/universal!/PHP.removeEventListener */
|
|
78
78
|
removeEventListener(eventType: PHPEvent['type'], listener: PHPEventListener): void;
|
|
79
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
79
80
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/universal",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "PHP.wasm – emscripten bindings for PHP",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"module": "./index.js",
|
|
38
38
|
"types": "index.d.ts",
|
|
39
39
|
"license": "GPL-2.0-or-later",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "ed646326d99ba84bad911d65b6634265f508f073",
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=20.18.3",
|
|
43
43
|
"npm": ">=10.1.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"comlink": "^4.4.
|
|
46
|
+
"comlink": "^4.4.2",
|
|
47
47
|
"ini": "4.1.2",
|
|
48
|
-
"@php-wasm/node-polyfills": "1.1.
|
|
49
|
-
"@php-wasm/logger": "1.1.
|
|
50
|
-
"@php-wasm/util": "1.1.
|
|
51
|
-
"@php-wasm/stream-compression": "1.1.
|
|
52
|
-
"@php-wasm/progress": "1.1.
|
|
48
|
+
"@php-wasm/node-polyfills": "1.1.4",
|
|
49
|
+
"@php-wasm/logger": "1.1.4",
|
|
50
|
+
"@php-wasm/util": "1.1.4",
|
|
51
|
+
"@php-wasm/stream-compression": "1.1.4",
|
|
52
|
+
"@php-wasm/progress": "1.1.4"
|
|
53
53
|
},
|
|
54
54
|
"overrides": {
|
|
55
55
|
"rollup": "^4.34.6",
|