@php-wasm/universal 0.7.19 → 0.9.2

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 DELETED
@@ -1,113 +0,0 @@
1
- import { PHPResponse } from './php-response';
2
- import type { PHPRuntimeId } from './load-php-runtime';
3
- import { IsomorphicLocalPHP, MessageListener, PHPRequest, PHPRequestHeaders, PHPRunOptions, RmDirOptions, ListFilesOptions, SpawnHandler, PHPEventListener, PHPEvent } from './universal-php';
4
- import { Semaphore } from '../../../util/src/index.ts';
5
- import { PHPRequestHandler } from './php-request-handler';
6
- export declare const __private__dont__use: unique symbol;
7
- export declare class PHPExecutionFailureError extends Error {
8
- response: PHPResponse;
9
- source: 'request' | 'php-wasm';
10
- constructor(message: string, response: PHPResponse, source: 'request' | 'php-wasm');
11
- }
12
- /**
13
- * An environment-agnostic wrapper around the Emscripten PHP runtime
14
- * that universals the super low-level API and provides a more convenient
15
- * higher-level API.
16
- *
17
- * It exposes a minimal set of methods to run PHP scripts and to
18
- * interact with the PHP filesystem.
19
- */
20
- export declare abstract class BasePHP implements IsomorphicLocalPHP, Disposable {
21
- #private;
22
- protected [__private__dont__use]: any;
23
- requestHandler?: PHPRequestHandler<any>;
24
- /**
25
- * An exclusive lock that prevent multiple requests from running at
26
- * the same time.
27
- */
28
- semaphore: Semaphore;
29
- /**
30
- * Initializes a PHP runtime.
31
- *
32
- * @internal
33
- * @param PHPRuntime - Optional. PHP Runtime ID as initialized by loadPHPRuntime.
34
- * @param requestHandlerOptions - Optional. Options for the PHPRequestHandler. If undefined, no request handler will be initialized.
35
- */
36
- constructor(PHPRuntimeId?: PHPRuntimeId);
37
- addEventListener(eventType: PHPEvent['type'], listener: PHPEventListener): void;
38
- removeEventListener(eventType: PHPEvent['type'], listener: PHPEventListener): void;
39
- dispatchEvent<Event extends PHPEvent>(event: Event): void;
40
- /** @inheritDoc */
41
- onMessage(listener: MessageListener): Promise<void>;
42
- /** @inheritDoc */
43
- setSpawnHandler(handler: SpawnHandler | string): Promise<void>;
44
- /** @inheritDoc */
45
- get absoluteUrl(): string;
46
- /** @inheritDoc */
47
- get documentRoot(): string;
48
- /** @inheritDoc */
49
- pathToInternalUrl(path: string): string;
50
- /** @inheritDoc */
51
- internalUrlToPath(internalUrl: string): string;
52
- initializeRuntime(runtimeId: PHPRuntimeId): void;
53
- /** @inheritDoc */
54
- setSapiName(newName: string): Promise<void>;
55
- /** @inheritDoc */
56
- setPhpIniPath(path: string): void;
57
- /** @inheritDoc */
58
- setPhpIniEntry(key: string, value: string): void;
59
- /** @inheritDoc */
60
- chdir(path: string): void;
61
- /**
62
- * Do not use. Use new PHPRequestHandler() instead.
63
- * @deprecated
64
- */
65
- request(request: PHPRequest): Promise<PHPResponse>;
66
- /** @inheritDoc */
67
- run(request: PHPRunOptions): Promise<PHPResponse>;
68
- defineConstant(key: string, value: string | boolean | number | null): void;
69
- /** @inheritDoc */
70
- mkdir(path: string): void;
71
- /** @inheritDoc */
72
- mkdirTree(path: string): void;
73
- /** @inheritDoc */
74
- readFileAsText(path: string): string;
75
- /** @inheritDoc */
76
- readFileAsBuffer(path: string): Uint8Array;
77
- /** @inheritDoc */
78
- writeFile(path: string, data: string | Uint8Array): void;
79
- /** @inheritDoc */
80
- unlink(path: string): void;
81
- /** @inheritDoc */
82
- mv(fromPath: string, toPath: string): void;
83
- /** @inheritDoc */
84
- rmdir(path: string, options?: RmDirOptions): void;
85
- /** @inheritDoc */
86
- listFiles(path: string, options?: ListFilesOptions): string[];
87
- /** @inheritDoc */
88
- isDir(path: string): boolean;
89
- /** @inheritDoc */
90
- fileExists(path: string): boolean;
91
- /**
92
- * Hot-swaps the PHP runtime for a new one without
93
- * interrupting the operations of this PHP instance.
94
- *
95
- * @param runtime
96
- * @param cwd. Internal, the VFS path to recreate in the new runtime.
97
- * This arg is temporary and will be removed once BasePHP
98
- * is fully decoupled from the request handler and
99
- * accepts a constructor-level cwd argument.
100
- */
101
- hotSwapPHPRuntime(runtime: number, cwd?: string): void;
102
- exit(code?: number): void;
103
- [Symbol.dispose](): void;
104
- }
105
- export declare function normalizeHeaders(headers: PHPRequestHeaders): PHPRequestHeaders;
106
- type EmscriptenFS = any;
107
- export declare function syncFSTo(source: BasePHP, target: BasePHP, path?: string | null): void;
108
- /**
109
- * Copies the MEMFS directory structure from one FS in another FS.
110
- * Non-MEMFS nodes are ignored.
111
- */
112
- export declare function copyFS(source: EmscriptenFS, target: EmscriptenFS, path: string): void;
113
- export {};
@@ -1,2 +0,0 @@
1
- import { IsomorphicLocalPHP, UniversalPHP } from './universal-php';
2
- export declare function isLocalPHP(playground: UniversalPHP): playground is IsomorphicLocalPHP;
@@ -1,2 +0,0 @@
1
- import { IsomorphicRemotePHP, UniversalPHP } from './universal-php';
2
- export declare function isRemotePHP(playground: UniversalPHP): playground is IsomorphicRemotePHP;