@php-wasm/universal 0.6.2 → 0.6.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/lib/base-php.d.ts CHANGED
@@ -92,3 +92,11 @@ export declare abstract class BasePHP implements IsomorphicLocalPHP {
92
92
  exit(code?: number): void;
93
93
  }
94
94
  export declare function normalizeHeaders(headers: PHPRequestHeaders): PHPRequestHeaders;
95
+ type EmscriptenFS = any;
96
+ export declare function syncFSTo(source: BasePHP, target: BasePHP, path?: string | null): void;
97
+ /**
98
+ * Copies the MEMFS directory structure from one FS in another FS.
99
+ * Non-MEMFS nodes are ignored.
100
+ */
101
+ export declare function copyFS(source: EmscriptenFS, target: EmscriptenFS, path: string): void;
102
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Encodes a multipart/form-data request body.
3
+ *
4
+ * @param data - The form data to encode.
5
+ * @returns The encoded body and a correctly formatted content type header.
6
+ */
7
+ export declare function encodeAsMultipart(data: Record<string, string | Uint8Array | File>): Promise<{
8
+ bytes: Uint8Array;
9
+ contentType: string;
10
+ }>;
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { FileInfo, IsomorphicLocalPHP, IsomorphicRemotePHP, MessageListener, PHPOutput, PHPRunOptions, UniversalPHP, ListFilesOptions, RmDirOptions, PHPEvent, PHPEventListener, HTTPMethod, PHPRequest, PHPRequestHeaders, RequestHandler, SpawnHandler, } from './universal-php';
1
+ export type { IsomorphicLocalPHP, IsomorphicRemotePHP, MessageListener, PHPOutput, PHPRunOptions, UniversalPHP, ListFilesOptions, RmDirOptions, PHPEvent, PHPEventListener, HTTPMethod, PHPRequest, PHPRequestHeaders, RequestHandler, SpawnHandler, } from './universal-php';
2
2
  export { UnhandledRejectionsTarget } from './wasm-error-reporting';
3
3
  export type { IteratePhpFilesOptions as IterateFilesOptions } from './iterate-files';
4
4
  export { iteratePhpFiles as iterateFiles } from './iterate-files';
@@ -122,7 +122,7 @@ export interface RequestHandler {
122
122
  * headers: {
123
123
  * 'X-foo': 'bar',
124
124
  * },
125
- * formData: {
125
+ * body: {
126
126
  * foo: 'bar',
127
127
  * },
128
128
  * });
@@ -431,18 +431,11 @@ export interface PHPRequest {
431
431
  */
432
432
  headers?: PHPRequestHeaders;
433
433
  /**
434
- * Uploaded files
434
+ * Request body.
435
+ * If an object is given, the request will be encoded as multipart
436
+ * and sent with a `multipart/form-data` header.
435
437
  */
436
- files?: Record<string, File>;
437
- /**
438
- * Request body without the files.
439
- */
440
- body?: string;
441
- /**
442
- * Form data. If set, the request body will be ignored and
443
- * the content-type header will be set to `application/x-www-form-urlencoded`.
444
- */
445
- formData?: Record<string, unknown>;
438
+ body?: string | Uint8Array | Record<string, string | Uint8Array | File>;
446
439
  }
447
440
  export interface PHPRunOptions {
448
441
  /**
@@ -466,13 +459,13 @@ export interface PHPRunOptions {
466
459
  */
467
460
  headers?: PHPRequestHeaders;
468
461
  /**
469
- * Request body without the files.
462
+ * Request body.
470
463
  */
471
- body?: string;
464
+ body?: string | Uint8Array;
472
465
  /**
473
- * Uploaded files.
466
+ * Environment variables to set for this run.
474
467
  */
475
- fileInfos?: FileInfo[];
468
+ env?: Record<string, string>;
476
469
  /**
477
470
  * The code snippet to eval instead of a php file.
478
471
  */
@@ -494,12 +487,6 @@ export interface PHPOutput {
494
487
  /** Stderr lines */
495
488
  stderr: string[];
496
489
  }
497
- export interface FileInfo {
498
- key: string;
499
- name: string;
500
- type: string;
501
- data: Uint8Array;
502
- }
503
490
  export interface RmDirOptions {
504
491
  /**
505
492
  * If true, recursively removes the directory and all its contents.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/universal",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "PHP.wasm – emscripten bindings for PHP",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,7 +36,7 @@
36
36
  "main": "./index.cjs",
37
37
  "module": "./index.js",
38
38
  "license": "GPL-2.0-or-later",
39
- "gitHead": "3c0de0d0847c3550a75a026bef9724eac421afbf",
39
+ "gitHead": "8b74852e9701f5083b367f9a294f34200230ce79",
40
40
  "engines": {
41
41
  "node": ">=18.18.2",
42
42
  "npm": ">=8.11.0"