@php-wasm/web 1.0.29 → 1.1.1

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.
Files changed (56) hide show
  1. package/index.cjs +21 -0
  2. package/index.cjs.map +1 -0
  3. package/index.js +666 -631
  4. package/index.js.map +1 -1
  5. package/lib/chunked-decoder.d.ts +8 -0
  6. package/lib/directory-handle-mount.d.ts +1 -1
  7. package/lib/get-php-loader-module.d.ts +1 -1
  8. package/lib/load-runtime.d.ts +4 -3
  9. package/lib/tcp-over-fetch-websocket.d.ts +32 -4
  10. package/lib/tls/1_2/types.d.ts +19 -17
  11. package/lib/tls/extensions/parse-extensions.d.ts +8 -4
  12. package/lib/tls/utils.d.ts +1 -1
  13. package/lib/with-icu-data.d.ts +2 -0
  14. package/package.json +28 -14
  15. package/php/asyncify/7_0_33/php_7_0.wasm +0 -0
  16. package/php/asyncify/7_1_30/php_7_1.wasm +0 -0
  17. package/php/asyncify/7_2_34/php_7_2.wasm +0 -0
  18. package/php/asyncify/7_3_33/php_7_3.wasm +0 -0
  19. package/php/asyncify/7_4_33/php_7_4.wasm +0 -0
  20. package/php/asyncify/8_0_30/php_8_0.wasm +0 -0
  21. package/php/asyncify/8_1_23/php_8_1.wasm +0 -0
  22. package/php/asyncify/8_2_10/php_8_2.wasm +0 -0
  23. package/php/asyncify/8_3_0/php_8_3.wasm +0 -0
  24. package/php/asyncify/8_4_0/php_8_4.wasm +0 -0
  25. package/php/asyncify/php_7_0.js +13 -39
  26. package/php/asyncify/php_7_1.js +13 -39
  27. package/php/asyncify/php_7_2.js +13 -39
  28. package/php/asyncify/php_7_3.js +13 -39
  29. package/php/asyncify/php_7_4.js +13 -39
  30. package/php/asyncify/php_8_0.js +13 -39
  31. package/php/asyncify/php_8_1.js +13 -39
  32. package/php/asyncify/php_8_2.js +13 -39
  33. package/php/asyncify/php_8_3.js +13 -39
  34. package/php/asyncify/php_8_4.js +13 -39
  35. package/php/jspi/7_0_33/php_7_0.wasm +0 -0
  36. package/php/jspi/7_1_30/php_7_1.wasm +0 -0
  37. package/php/jspi/7_2_34/php_7_2.wasm +0 -0
  38. package/php/jspi/7_3_33/php_7_3.wasm +0 -0
  39. package/php/jspi/7_4_33/php_7_4.wasm +0 -0
  40. package/php/jspi/8_0_30/php_8_0.wasm +0 -0
  41. package/php/jspi/8_1_23/php_8_1.wasm +0 -0
  42. package/php/jspi/8_2_10/php_8_2.wasm +0 -0
  43. package/php/jspi/8_3_0/php_8_3.wasm +0 -0
  44. package/php/jspi/8_4_0/php_8_4.wasm +0 -0
  45. package/php/jspi/php_7_0.js +13 -39
  46. package/php/jspi/php_7_1.js +13 -39
  47. package/php/jspi/php_7_2.js +13 -39
  48. package/php/jspi/php_7_3.js +13 -39
  49. package/php/jspi/php_7_4.js +13 -39
  50. package/php/jspi/php_8_0.js +13 -39
  51. package/php/jspi/php_8_1.js +13 -39
  52. package/php/jspi/php_8_2.js +13 -39
  53. package/php/jspi/php_8_3.js +13 -39
  54. package/php/jspi/php_8_4.js +13 -39
  55. package/shared/icudt74l.dat +0 -0
  56. package/shared/icudt74l.js +2 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A TransformStream that decodes HTTP chunked transfer encoding.
3
+ * Each chunk starts with the chunk size in hex followed by CRLF,
4
+ * then the chunk data, then CRLF. A chunk size of 0 indicates the end.
5
+ */
6
+ export declare class ChunkedDecoderStream extends TransformStream<Uint8Array, Uint8Array> {
7
+ constructor();
8
+ }
@@ -1,4 +1,4 @@
1
- import { Emscripten, MountHandler, PHP } from '@php-wasm/universal';
1
+ import type { Emscripten, MountHandler, PHP } from '@php-wasm/universal';
2
2
  declare global {
3
3
  interface FileSystemFileHandle {
4
4
  move(target: FileSystemDirectoryHandle): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { PHPLoaderModule, SupportedPHPVersion } from '@php-wasm/universal';
1
+ import type { PHPLoaderModule, SupportedPHPVersion } from '@php-wasm/universal';
2
2
  /**
3
3
  * Loads the PHP loader module for the given PHP version.
4
4
  *
@@ -1,8 +1,9 @@
1
- import { EmscriptenOptions, PHPLoaderModule, SupportedPHPVersion } from '@php-wasm/universal';
2
- import { TCPOverFetchOptions } from './tcp-over-fetch-websocket';
1
+ import type { SupportedPHPVersion, EmscriptenOptions, PHPLoaderModule } from '@php-wasm/universal';
2
+ import type { TCPOverFetchOptions } from './tcp-over-fetch-websocket';
3
3
  export interface LoaderOptions {
4
4
  emscriptenOptions?: EmscriptenOptions;
5
5
  onPhpLoaderModuleLoaded?: (module: PHPLoaderModule) => void;
6
6
  tcpOverFetch?: TCPOverFetchOptions;
7
+ withICU?: boolean;
7
8
  }
8
- export declare function loadWebRuntime(phpVersion: SupportedPHPVersion, options?: LoaderOptions): Promise<number>;
9
+ export declare function loadWebRuntime(phpVersion: SupportedPHPVersion, loaderOptions?: LoaderOptions): Promise<number>;
@@ -1,4 +1,6 @@
1
- import { GeneratedCertificate } from './tls/certificates';
1
+ /// <reference types="node" />
2
+ import type { GeneratedCertificate } from './tls/certificates';
3
+ import type { EmscriptenOptions } from '@php-wasm/universal';
2
4
  export type TCPOverFetchOptions = {
3
5
  CAroot: GeneratedCertificate;
4
6
  corsProxyUrl?: string;
@@ -7,7 +9,7 @@ export type TCPOverFetchOptions = {
7
9
  * Sets up a WebSocket that analyzes the received bytes and, if they look like
8
10
  * TLS or HTTP, handles the network transmission using fetch().
9
11
  */
10
- export declare const tcpOverFetchWebsocket: (tcpOptions: TCPOverFetchOptions) => {
12
+ export declare const tcpOverFetchWebsocket: (emOptions: EmscriptenOptions, tcpOptions: TCPOverFetchOptions) => {
11
13
  websocket: {
12
14
  url: (_: any, host: string, port: string) => string;
13
15
  subprotocol: string;
@@ -55,6 +57,19 @@ export declare const tcpOverFetchWebsocket: (tcpOptions: TCPOverFetchOptions) =>
55
57
  };
56
58
  };
57
59
  };
60
+ onAbort?: ((message: string) => void) | undefined;
61
+ debug?: boolean | undefined;
62
+ ENV?: Record<string, string> | undefined;
63
+ locateFile?: ((path: string) => string) | undefined;
64
+ noInitialRun?: boolean | undefined;
65
+ print?: ((message: string) => void) | undefined;
66
+ printErr?: ((message: string) => void) | undefined;
67
+ quit?: ((status: number, toThrow: any) => void) | undefined;
68
+ onRuntimeInitialized?: ((phpRuntime: any) => void) | undefined;
69
+ monitorRunDependencies?: ((left: number) => void) | undefined;
70
+ onMessage?: ((listener: import("packages/php-wasm/universal/src/lib/load-php-runtime").EmscriptenMessageListener) => void) | undefined;
71
+ outboundNetworkProxyServer?: import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | undefined;
72
+ instantiateWasm?: ((info: WebAssembly.Imports, receiveInstance: (instance: WebAssembly.Instance, module: WebAssembly.Module) => void) => void) | undefined;
58
73
  };
59
74
  export interface TCPOverFetchWebsocketOptions {
60
75
  CAroot?: GeneratedCertificate;
@@ -69,8 +84,6 @@ export interface TCPOverFetchWebsocketOptions {
69
84
  corsProxyUrl?: string;
70
85
  }
71
86
  export declare class TCPOverFetchWebsocket {
72
- url: string;
73
- options: string[];
74
87
  CONNECTING: number;
75
88
  OPEN: number;
76
89
  CLOSING: number;
@@ -90,6 +103,8 @@ export declare class TCPOverFetchWebsocket {
90
103
  clientDownstream: TransformStream<any, any>;
91
104
  fetchInitiated: boolean;
92
105
  bufferedBytesFromClient: Uint8Array;
106
+ url: string;
107
+ options: string[];
93
108
  constructor(url: string, options: string[], { CAroot, corsProxyUrl, outputType, }?: TCPOverFetchWebsocketOptions);
94
109
  on(eventName: string, callback: (e: any) => void): void;
95
110
  once(eventName: string, callback: (e: any) => void): void;
@@ -110,3 +125,16 @@ export declare class TCPOverFetchWebsocket {
110
125
  fetchOverHTTP(): Promise<void>;
111
126
  close(): void;
112
127
  }
128
+ export declare class RawBytesFetch {
129
+ /**
130
+ * Streams a HTTP response including the status line and headers.
131
+ */
132
+ static fetchRawResponseBytes(request: Request, corsProxyUrl?: string): ReadableStream<any>;
133
+ private static headersAsBytes;
134
+ /**
135
+ * Parses a raw, streamed HTTP request into a Request object
136
+ * with known headers and a readable body stream.
137
+ */
138
+ static parseHttpRequest(requestBytesStream: ReadableStream<Uint8Array>, host: string, protocol: 'http' | 'https'): Promise<Request>;
139
+ private static parseRequestHeaders;
140
+ }
@@ -3,11 +3,12 @@
3
3
  * from the TLS 1.2 RFC.
4
4
  * https://datatracker.ietf.org/doc/html/rfc5246#section-6.2
5
5
  */
6
- import { ParsedExtension } from '../extensions/parse-extensions';
7
- export declare const enum CompressionMethod {
8
- Null = 0,
9
- Deflate = 1
10
- }
6
+ import type { ParsedExtension } from '../extensions/parse-extensions';
7
+ export declare const CompressionMethod: {
8
+ readonly Null: 0;
9
+ readonly Deflate: 1;
10
+ };
11
+ export type CompressionMethod = (typeof CompressionMethod)[keyof typeof CompressionMethod];
11
12
  /**
12
13
  * TLS 1.2 Record layer types defined after the structs
13
14
  * from the TLS 1.2 RFC.
@@ -102,18 +103,19 @@ export declare const ContentTypes: {
102
103
  readonly ApplicationData: 23;
103
104
  };
104
105
  export type ContentType = (typeof ContentTypes)[keyof typeof ContentTypes];
105
- export declare const enum HandshakeType {
106
- HelloRequest = 0,
107
- ClientHello = 1,
108
- ServerHello = 2,
109
- Certificate = 11,
110
- ServerKeyExchange = 12,
111
- CertificateRequest = 13,
112
- ServerHelloDone = 14,
113
- CertificateVerify = 15,
114
- ClientKeyExchange = 16,
115
- Finished = 20
116
- }
106
+ export declare const HandshakeType: {
107
+ readonly HelloRequest: 0;
108
+ readonly ClientHello: 1;
109
+ readonly ServerHello: 2;
110
+ readonly Certificate: 11;
111
+ readonly ServerKeyExchange: 12;
112
+ readonly CertificateRequest: 13;
113
+ readonly ServerHelloDone: 14;
114
+ readonly CertificateVerify: 15;
115
+ readonly ClientKeyExchange: 16;
116
+ readonly Finished: 20;
117
+ };
118
+ export type HandshakeType = (typeof HandshakeType)[keyof typeof HandshakeType];
117
119
  export type HandshakeMessageBody = HelloRequest | ClientHello | ServerHello | Certificate | ServerKeyExchange | CertificateRequest | ServerHelloDone | CertificateVerify | ClientKeyExchange | Finished;
118
120
  export interface HandshakeMessage<Body extends HandshakeMessageBody> {
119
121
  type: typeof ContentTypes.Handshake;
@@ -1,7 +1,11 @@
1
- import { ServerNameExtension, ServerNameList } from './0_server_name';
2
- import { ParsedSupportedGroups, SupportedGroupsExtension } from './10_supported_groups';
3
- import { ParsedECPointFormats, ECPointFormatsExtension } from './11_ec_point_formats';
4
- import { SignatureAlgorithms, SignatureAlgorithmsExtension } from './13_signature_algorithms';
1
+ import type { ServerNameList } from './0_server_name';
2
+ import { ServerNameExtension } from './0_server_name';
3
+ import type { ParsedSupportedGroups } from './10_supported_groups';
4
+ import { SupportedGroupsExtension } from './10_supported_groups';
5
+ import type { ParsedECPointFormats } from './11_ec_point_formats';
6
+ import { ECPointFormatsExtension } from './11_ec_point_formats';
7
+ import type { SignatureAlgorithms } from './13_signature_algorithms';
8
+ import { SignatureAlgorithmsExtension } from './13_signature_algorithms';
5
9
  export declare const TLSExtensionsHandlers: {
6
10
  readonly server_name: typeof ServerNameExtension;
7
11
  readonly signature_algorithms: typeof SignatureAlgorithmsExtension;
@@ -5,9 +5,9 @@ export declare function as2Bytes(value: number): Uint8Array;
5
5
  export declare function as3Bytes(value: number): Uint8Array;
6
6
  export declare function as8Bytes(value: number): Uint8Array;
7
7
  export declare class ArrayBufferReader {
8
- private buffer;
9
8
  private view;
10
9
  offset: number;
10
+ private buffer;
11
11
  constructor(buffer: ArrayBuffer);
12
12
  readUint8(): number;
13
13
  readUint16(): number;
@@ -0,0 +1,2 @@
1
+ import type { EmscriptenOptions } from '@php-wasm/universal';
2
+ export declare function withICUData(options: EmscriptenOptions): Promise<EmscriptenOptions>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/web",
3
- "version": "1.0.29",
3
+ "version": "1.1.1",
4
4
  "description": "PHP.wasm for the web",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,31 +21,45 @@
21
21
  "displayName": "@php-wasm/web",
22
22
  "tsconfig": "./tsconfig.lib.json"
23
23
  },
24
+ "exports": {
25
+ ".": {
26
+ "import": "./index.js",
27
+ "require": "./index.cjs"
28
+ },
29
+ "./package.json": "./package.json"
30
+ },
24
31
  "publishConfig": {
25
32
  "access": "public",
26
33
  "directory": "../../../dist/packages/php-wasm/web"
27
34
  },
28
35
  "license": "GPL-2.0-or-later",
29
36
  "type": "module",
30
- "main": "index.js",
37
+ "main": "./index.cjs",
38
+ "module": "./index.js",
31
39
  "types": "index.d.ts",
32
- "gitHead": "173e69f62e1b43bd7353b875054bb1ef5e394de8",
40
+ "gitHead": "8bff9428d68d3c4a5e84c6cd633e82bf8512a4e3",
33
41
  "engines": {
34
- "node": ">=16.15.1",
35
- "npm": ">=8.11.0"
42
+ "node": ">=20.18.3",
43
+ "npm": ">=10.1.0"
36
44
  },
37
45
  "dependencies": {
38
46
  "comlink": "^4.4.1",
39
- "events": "3.3.0",
40
- "express": "4.19.2",
47
+ "express": "4.21.2",
41
48
  "ini": "4.1.2",
42
49
  "wasm-feature-detect": "1.8.0",
43
- "ws": "8.18.0",
50
+ "ws": "8.18.1",
44
51
  "yargs": "17.7.2",
45
- "@php-wasm/universal": "1.0.29",
46
- "@php-wasm/util": "1.0.29",
47
- "@php-wasm/logger": "1.0.29",
48
- "@php-wasm/fs-journal": "1.0.29",
49
- "@php-wasm/web-service-worker": "1.0.29"
52
+ "@php-wasm/universal": "1.1.1",
53
+ "@php-wasm/util": "1.1.1",
54
+ "@php-wasm/logger": "1.1.1",
55
+ "@php-wasm/fs-journal": "1.1.1",
56
+ "@php-wasm/web-service-worker": "1.1.1"
57
+ },
58
+ "overrides": {
59
+ "rollup": "^4.34.6",
60
+ "react": "18.3.1",
61
+ "react-dom": "18.3.1",
62
+ "typescript": "5.4.5",
63
+ "ws": "^8.18.0"
50
64
  }
51
- }
65
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file