@php-wasm/universal 1.2.2 → 1.2.3

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.
@@ -0,0 +1,12 @@
1
+ import type { StreamedPHPResponse } from './php-response';
2
+ import { PHPResponse } from './php-response';
3
+ export declare function printDebugDetails(e: any, streamedResponse?: StreamedPHPResponse): Promise<void>;
4
+ /**
5
+ * Pretty prints the full stack trace of the error and all its causes.
6
+ * Includes debug details for each error in the chain.
7
+ * This is needed
8
+ *
9
+ * @param e
10
+ */
11
+ export declare function prettyPrintFullStackTrace(e: any): Promise<void>;
12
+ export declare function printResponseDebugDetails(response: PHPResponse): void;
package/lib/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { FSHelpers } from './fs-helpers';
3
3
  export type { ListFilesOptions, RmDirOptions } from './fs-helpers';
4
4
  export { PHPWorker } from './php-worker';
5
5
  export { getPhpIniEntries, setPhpIniEntries, withPHPIniValues } from './ini';
6
+ export { printDebugDetails, prettyPrintFullStackTrace, printResponseDebugDetails, } from './error-reporting';
6
7
  export { UnhandledRejectionsTarget } from './wasm-error-reporting';
7
8
  export { HttpCookieStore } from './http-cookie-store';
8
9
  export type { IteratePhpFilesOptions as IterateFilesOptions } from './iterate-files';
@@ -29,5 +30,6 @@ export type { FileTree } from './write-files';
29
30
  export { DEFAULT_BASE_URL, ensurePathPrefix, removePathPrefix, toRelativeUrl, } from './urls';
30
31
  export { isExitCode } from './is-exit-code';
31
32
  export { proxyFileSystem } from './proxy-file-system';
33
+ export { sandboxedSpawnHandlerFactory } from './sandboxed-spawn-handler-factory';
32
34
  export * from './api';
33
35
  export type { WithAPIState as WithIsReady } from './api';
package/lib/php.d.ts CHANGED
@@ -27,6 +27,8 @@ export declare class PHP implements Disposable {
27
27
  #private;
28
28
  protected [__private__dont__use]: any;
29
29
  requestHandler?: PHPRequestHandler;
30
+ private cliCalled;
31
+ private runStreamCalled;
30
32
  /**
31
33
  * An exclusive lock that prevent multiple requests from running at
32
34
  * the same time.
@@ -114,6 +116,12 @@ export declare class PHP implements Disposable {
114
116
  * @param path - The new working directory.
115
117
  */
116
118
  chdir(path: string): void;
119
+ /**
120
+ * Changes the permissions of a file or directory.
121
+ * @param path - The path to the file or directory.
122
+ * @param mode - The new permissions.
123
+ */
124
+ chmod(path: string, mode: number): void;
117
125
  /**
118
126
  * Do not use. Use new PHPRequestHandler() instead.
119
127
  * @deprecated
@@ -5,10 +5,10 @@
5
5
  * @see https://github.com/emscripten-core/emscripten/blob/main/system/lib/libc/musl/arch/emscripten/bits/errno.h
6
6
  * @see https://github.com/emscripten-core/emscripten/blob/38eedc630f17094b3202fd48ac0c2c585dbea31e/system/include/wasi/api.h#L336
7
7
  */
8
- export interface ErrnoError extends Error {
8
+ export declare class ErrnoError extends Error {
9
+ constructor(errno: number, message?: string, options?: any);
9
10
  node?: any;
10
11
  errno: number;
11
- message: string;
12
12
  }
13
13
  /**
14
14
  * @see https://github.com/emscripten-core/emscripten/blob/38eedc630f17094b3202fd48ac0c2c585dbea31e/system/include/wasi/api.h#L336
@@ -0,0 +1,12 @@
1
+ import type { PHPProcessManager } from './php-process-manager';
2
+ /**
3
+ * An isomorphic proc_open() handler that implements typical shell in TypeScript
4
+ * without relying on a server runtime. It can be used in the browser and Node.js
5
+ * alike whenever you need to spawn a PHP subprocess, query the terminal size, etc.
6
+ * It is open for future expansion if more shell or busybox calls are needed, but
7
+ * advanced shell features such as piping, stream redirection etc. are outside of
8
+ * the scope of this minimal handler. If they become vital at any point, let's
9
+ * explore bringing in an actual shell implementation or at least a proper command
10
+ * parser.
11
+ */
12
+ export declare function sandboxedSpawnHandlerFactory(processManager: PHPProcessManager): any;
@@ -0,0 +1,17 @@
1
+ export type ErrorObject = {
2
+ name?: string;
3
+ message?: string;
4
+ stack?: string;
5
+ cause?: unknown;
6
+ code?: string;
7
+ } & Record<string, unknown>;
8
+ export declare const errorConstructors: Map<unknown, unknown>;
9
+ export declare function addKnownErrorConstructor(constructor: any): void;
10
+ export declare class NonError extends Error {
11
+ name: string;
12
+ constructor(message: any);
13
+ static _prepareSuperMessage(message: any): string;
14
+ }
15
+ export declare function serializeError(value: any, options?: any): any;
16
+ export declare function deserializeError(value: any, options?: any): any;
17
+ export declare function isErrorLike(value: any): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/universal",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
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": "aca5a878610532b47b07a5922fb6056993df0642",
40
+ "gitHead": "a6624a5390d899d164f887dc915a0ba1dbc31c83",
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": "1.2.2",
48
- "@php-wasm/logger": "1.2.2",
49
- "@php-wasm/util": "1.2.2",
50
- "@php-wasm/stream-compression": "1.2.2",
51
- "@php-wasm/progress": "1.2.2"
47
+ "@php-wasm/node-polyfills": "1.2.3",
48
+ "@php-wasm/logger": "1.2.3",
49
+ "@php-wasm/util": "1.2.3",
50
+ "@php-wasm/stream-compression": "1.2.3",
51
+ "@php-wasm/progress": "1.2.3"
52
52
  },
53
53
  "overrides": {
54
54
  "rollup": "^4.34.6",
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=__vite-browser-external-Dyvby5gX.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"__vite-browser-external-Dyvby5gX.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=__vite-browser-external-l0sNRNKZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"__vite-browser-external-l0sNRNKZ.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}