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