@php-wasm/universal 3.0.14 → 3.0.16

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/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export { loadPHPRuntime, getLoadedRuntime } from './load-php-runtime';
22
22
  export type { Emscripten } from './emscripten-types';
23
23
  export type { DataModule, EmscriptenOptions, PHPLoaderModule, PHPRuntime, PHPRuntimeId, RuntimeType, } from './load-php-runtime';
24
24
  export type { PHPRequestHandlerConfiguration, RewriteRule, } from './php-request-handler';
25
- export { PHPRequestHandler, applyRewriteRules } from './php-request-handler';
25
+ export { PHPRequestHandler, applyRewriteRules, inferMimeType, } from './php-request-handler';
26
26
  export type { FileNotFoundGetActionCallback, FileNotFoundToInternalRedirect, FileNotFoundToResponse, FileNotFoundAction, CookieStore, } from './php-request-handler';
27
27
  export { rotatePHPRuntime } from './rotate-php-runtime';
28
28
  export { writeFiles } from './write-files';
@@ -230,6 +230,17 @@ export declare class PHPRequestHandler implements AsyncDisposable {
230
230
  request(request: PHPRequest): Promise<PHPResponse>;
231
231
  [Symbol.asyncDispose](): Promise<void>;
232
232
  }
233
+ /**
234
+ * Naively infer a file mime type from its path.
235
+ *
236
+ * @todo Infer the mime type based on the file contents.
237
+ * A naive function like this one can be inaccurate
238
+ * and potentially have negative security consequences.
239
+ *
240
+ * @param path - The file path
241
+ * @returns The inferred mime type.
242
+ */
243
+ export declare function inferMimeType(path: string): string;
233
244
  /**
234
245
  * Applies the given rewrite rules to the given path.
235
246
  *
@@ -26,12 +26,19 @@ export interface PHPRuntimeInitializedEvent {
26
26
  export interface PHPRuntimeBeforeExitEvent {
27
27
  type: 'runtime.beforeExit';
28
28
  }
29
+ /**
30
+ * Emitted when a filesystem write operation occurs (writeFile, mkdir, rmdir, mv, unlink).
31
+ * This event is used to trigger journal flushing for persistent storage.
32
+ */
33
+ export interface PHPFilesystemWriteEvent {
34
+ type: 'filesystem.write';
35
+ }
29
36
  /**
30
37
  * Represents an event related to the PHP instance.
31
38
  * This is intentionally not an extension of CustomEvent
32
39
  * to make it isomorphic between different JavaScript runtimes.
33
40
  */
34
- export type PHPEvent = PHPRequestEndEvent | PHPRequestErrorEvent | PHPRuntimeInitializedEvent | PHPRuntimeBeforeExitEvent;
41
+ export type PHPEvent = PHPRequestEndEvent | PHPRequestErrorEvent | PHPRuntimeInitializedEvent | PHPRuntimeBeforeExitEvent | PHPFilesystemWriteEvent;
35
42
  /**
36
43
  * A callback function that handles PHP events.
37
44
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/universal",
3
- "version": "3.0.14",
3
+ "version": "3.0.16",
4
4
  "description": "PHP.wasm – emscripten bindings for PHP",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,18 +37,18 @@
37
37
  "module": "./index.js",
38
38
  "types": "index.d.ts",
39
39
  "license": "GPL-2.0-or-later",
40
- "gitHead": "0e5227cd89018aaa7f730be5b90bda4cc43f2c41",
40
+ "gitHead": "1f96a559fda4946f36f8543a2715cee411a5c8f2",
41
41
  "engines": {
42
42
  "node": ">=20.18.3",
43
43
  "npm": ">=10.1.0"
44
44
  },
45
45
  "dependencies": {
46
46
  "ini": "4.1.2",
47
- "@php-wasm/node-polyfills": "3.0.14",
48
- "@php-wasm/logger": "3.0.14",
49
- "@php-wasm/util": "3.0.14",
50
- "@php-wasm/stream-compression": "3.0.14",
51
- "@php-wasm/progress": "3.0.14"
47
+ "@php-wasm/node-polyfills": "3.0.16",
48
+ "@php-wasm/logger": "3.0.16",
49
+ "@php-wasm/util": "3.0.16",
50
+ "@php-wasm/stream-compression": "3.0.16",
51
+ "@php-wasm/progress": "3.0.16"
52
52
  },
53
53
  "packageManager": "npm@10.9.2",
54
54
  "overrides": {