@php-wasm/universal 1.2.2 → 2.0.0
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.cjs +40 -9
- package/index.cjs.map +1 -1
- package/index.js +535 -213
- package/index.js.map +1 -1
- package/lib/error-reporting.d.ts +12 -0
- package/lib/index.d.ts +2 -0
- package/lib/php-worker.d.ts +8 -0
- package/lib/php.d.ts +9 -0
- package/lib/rethrow-file-system-error.d.ts +2 -2
- package/lib/sandboxed-spawn-handler-factory.d.ts +12 -0
- package/lib/serialize-error.d.ts +17 -0
- package/package.json +7 -7
- package/__vite-browser-external-Dyvby5gX.cjs +0 -2
- package/__vite-browser-external-Dyvby5gX.cjs.map +0 -1
- package/__vite-browser-external-l0sNRNKZ.js +0 -2
- package/__vite-browser-external-l0sNRNKZ.js.map +0 -1
|
@@ -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-worker.d.ts
CHANGED
|
@@ -27,6 +27,14 @@ export declare class PHPWorker implements LimitedPHPApi, AsyncDisposable {
|
|
|
27
27
|
* a warning.
|
|
28
28
|
*/
|
|
29
29
|
protected __internal_getPHP(): PHP | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
* @deprecated
|
|
33
|
+
* Do not use this method directly in the code consuming
|
|
34
|
+
* the web API. It will change or even be removed without
|
|
35
|
+
* a warning.
|
|
36
|
+
*/
|
|
37
|
+
protected __internal_getRequestHandler(): PHPRequestHandler | undefined;
|
|
30
38
|
setPrimaryPHP(php: PHP): Promise<void>;
|
|
31
39
|
/** @inheritDoc @php-wasm/universal!PHPRequestHandler.pathToInternalUrl */
|
|
32
40
|
pathToInternalUrl(path: string): string;
|
package/lib/php.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare class PHPExecutionFailureError extends Error {
|
|
|
15
15
|
export type UnmountFunction = (() => Promise<any>) | (() => any);
|
|
16
16
|
export type MountHandler = (php: PHP, FS: Emscripten.RootFS, vfsMountPoint: string) => UnmountFunction | Promise<UnmountFunction>;
|
|
17
17
|
export declare const PHP_INI_PATH = "/internal/shared/php.ini";
|
|
18
|
+
export declare const USE_OPCACHE = true;
|
|
18
19
|
/**
|
|
19
20
|
* An environment-agnostic wrapper around the Emscripten PHP runtime
|
|
20
21
|
* that universals the super low-level API and provides a more convenient
|
|
@@ -27,6 +28,8 @@ export declare class PHP implements Disposable {
|
|
|
27
28
|
#private;
|
|
28
29
|
protected [__private__dont__use]: any;
|
|
29
30
|
requestHandler?: PHPRequestHandler;
|
|
31
|
+
private cliCalled;
|
|
32
|
+
private runStreamCalled;
|
|
30
33
|
/**
|
|
31
34
|
* An exclusive lock that prevent multiple requests from running at
|
|
32
35
|
* the same time.
|
|
@@ -114,6 +117,12 @@ export declare class PHP implements Disposable {
|
|
|
114
117
|
* @param path - The new working directory.
|
|
115
118
|
*/
|
|
116
119
|
chdir(path: string): void;
|
|
120
|
+
/**
|
|
121
|
+
* Changes the permissions of a file or directory.
|
|
122
|
+
* @param path - The path to the file or directory.
|
|
123
|
+
* @param mode - The new permissions.
|
|
124
|
+
*/
|
|
125
|
+
chmod(path: string, mode: number): void;
|
|
117
126
|
/**
|
|
118
127
|
* Do not use. Use new PHPRequestHandler() instead.
|
|
119
128
|
* @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
|
|
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": "
|
|
3
|
+
"version": "2.0.0",
|
|
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": "
|
|
40
|
+
"gitHead": "4aa6ec4f0fe23920f735c0050228a509d94ce077",
|
|
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": "
|
|
48
|
-
"@php-wasm/logger": "
|
|
49
|
-
"@php-wasm/util": "
|
|
50
|
-
"@php-wasm/stream-compression": "
|
|
51
|
-
"@php-wasm/progress": "
|
|
47
|
+
"@php-wasm/node-polyfills": "2.0.0",
|
|
48
|
+
"@php-wasm/logger": "2.0.0",
|
|
49
|
+
"@php-wasm/util": "2.0.0",
|
|
50
|
+
"@php-wasm/stream-compression": "2.0.0",
|
|
51
|
+
"@php-wasm/progress": "2.0.0"
|
|
52
52
|
},
|
|
53
53
|
"overrides": {
|
|
54
54
|
"rollup": "^4.34.6",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"__vite-browser-external-Dyvby5gX.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"__vite-browser-external-l0sNRNKZ.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|