@php-wasm/node 0.9.33 → 0.9.34

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.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import '@php-wasm/node-polyfills';
2
+ export * from './lib';
@@ -0,0 +1,2 @@
1
+ import type { PHPLoaderModule, SupportedPHPVersion } from '@php-wasm/universal';
2
+ export declare function getPHPLoaderModule(version?: SupportedPHPVersion): Promise<PHPLoaderModule>;
package/lib/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from './get-php-loader-module';
2
+ export * from './networking/with-networking';
3
+ export * from './load-runtime';
4
+ export * from './use-host-filesystem';
5
+ export * from './node-fs-mount';
@@ -0,0 +1,12 @@
1
+ import { SupportedPHPVersion, EmscriptenOptions } from '@php-wasm/universal';
2
+ export interface PHPLoaderOptions {
3
+ emscriptenOptions?: EmscriptenOptions;
4
+ }
5
+ /**
6
+ * Does what load() does, but synchronously returns
7
+ * an object with the PHP instance and a promise that
8
+ * resolves when the PHP instance is ready.
9
+ *
10
+ * @see load
11
+ */
12
+ export declare function loadNodeRuntime(phpVersion: SupportedPHPVersion, options?: PHPLoaderOptions): Promise<number>;
@@ -0,0 +1,8 @@
1
+ import { WebSocketServer } from 'ws';
2
+ export declare function addTCPServerToWebSocketServerClass(wsListenPort: number, WSServer: typeof WebSocketServer): any;
3
+ export interface InboundTcpToWsProxyOptions {
4
+ tcpListenPort: number;
5
+ wsConnectHost?: string;
6
+ wsConnectPort: number;
7
+ }
8
+ export declare function listenTCPToWSProxy(options: InboundTcpToWsProxyOptions): void;
@@ -0,0 +1,58 @@
1
+ import * as http from 'http';
2
+ /**
3
+ * Send a chunk of data to the remote server.
4
+ */
5
+ export declare const COMMAND_CHUNK = 1;
6
+ /**
7
+ * Set a TCP socket option.
8
+ */
9
+ export declare const COMMAND_SET_SOCKETOPT = 2;
10
+ /**
11
+ * Adds support for TCP socket options to WebSocket class.
12
+ *
13
+ * Socket options are implemented by adopting a specific data transmission
14
+ * protocol between WS client and WS server The first byte
15
+ * of every message is a command type, and the remaining bytes
16
+ * are the actual data.
17
+ *
18
+ * @param WebSocketConstructor
19
+ * @returns Decorated constructor
20
+ */
21
+ export declare function addSocketOptionsSupportToWebSocketClass(WebSocketConstructor: typeof WebSocket): {
22
+ new (url: string | URL, protocols?: string | string[]): {
23
+ send(chunk: any, callback: any): any;
24
+ setSocketOpt(optionClass: number, optionName: number, optionValue: number): any;
25
+ sendCommand(commandType: number, chunk: string | ArrayBuffer | ArrayLike<number>, callback: any): any;
26
+ binaryType: BinaryType;
27
+ readonly bufferedAmount: number;
28
+ readonly extensions: string;
29
+ onclose: ((this: WebSocket, ev: CloseEvent) => any) | null;
30
+ onerror: ((this: WebSocket, ev: Event) => any) | null;
31
+ onmessage: ((this: WebSocket, ev: MessageEvent) => any) | null;
32
+ onopen: ((this: WebSocket, ev: Event) => any) | null;
33
+ readonly protocol: string;
34
+ readonly readyState: number;
35
+ readonly url: string;
36
+ close(code?: number, reason?: string): void;
37
+ close(code?: number, reason?: string): void;
38
+ readonly CONNECTING: 0;
39
+ readonly OPEN: 1;
40
+ readonly CLOSING: 2;
41
+ readonly CLOSED: 3;
42
+ addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
43
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
44
+ addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
45
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
46
+ removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
47
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
48
+ removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
49
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
50
+ dispatchEvent(event: Event): boolean;
51
+ dispatchEvent(event: Event): boolean;
52
+ };
53
+ readonly CONNECTING: 0;
54
+ readonly OPEN: 1;
55
+ readonly CLOSING: 2;
56
+ readonly CLOSED: 3;
57
+ };
58
+ export declare function initOutboundWebsocketProxyServer(listenPort: number, listenHost?: string): Promise<http.Server>;
@@ -0,0 +1,2 @@
1
+ export declare function debugLog(message: any, ...args: any[]): void;
2
+ export declare function findFreePorts(n: number): Promise<number[]>;
@@ -0,0 +1,2 @@
1
+ import { EmscriptenOptions } from '@php-wasm/universal';
2
+ export declare function withNetworking(phpModuleArgs?: EmscriptenOptions): Promise<EmscriptenOptions>;
@@ -0,0 +1,2 @@
1
+ import { MountHandler } from '@php-wasm/universal';
2
+ export declare function createNodeFsMountHandler(localPath: string): MountHandler;
@@ -0,0 +1,9 @@
1
+ import { PHP } from '@php-wasm/universal';
2
+ /**
3
+ * Enables host filesystem usage by mounting root
4
+ * directories (e.g. /, /home, /var) into the in-memory
5
+ * virtual filesystem used by this PHP instance, and
6
+ * setting the current working directory to one used by
7
+ * the current node.js process.
8
+ */
9
+ export declare function useHostFilesystem(php: PHP): void;
package/noop.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * A dummy entrypoint is needed for the @nx/esbuild:esbuild
3
+ * to work properly. See https://github.com/nrwl/nx/pull/14636/files
4
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/node",
3
- "version": "0.9.33",
3
+ "version": "0.9.34",
4
4
  "description": "PHP.wasm for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "license": "GPL-2.0-or-later",
40
40
  "types": "index.d.ts",
41
- "gitHead": "bcfaa019188a6a6e381338704151566eb050638a",
41
+ "gitHead": "7bb2d07709cc230bf3c940b80ef39fa643e53916",
42
42
  "engines": {
43
43
  "node": ">=18.18.0",
44
44
  "npm": ">=8.11.0"
@@ -49,11 +49,11 @@
49
49
  "ini": "4.1.2",
50
50
  "ws": "8.18.0",
51
51
  "yargs": "17.7.2",
52
- "@php-wasm/node-polyfills": "0.9.33",
53
- "@php-wasm/universal": "0.9.33",
54
- "@php-wasm/logger": "0.9.33",
55
- "@php-wasm/util": "0.9.33",
56
- "@wp-playground/common": "0.9.33",
57
- "@wp-playground/wordpress": "0.9.33"
52
+ "@php-wasm/node-polyfills": "0.9.34",
53
+ "@php-wasm/universal": "0.9.34",
54
+ "@php-wasm/logger": "0.9.34",
55
+ "@php-wasm/util": "0.9.34",
56
+ "@wp-playground/common": "0.9.34",
57
+ "@wp-playground/wordpress": "0.9.34"
58
58
  }
59
59
  }