@php-wasm/web 0.1.61 → 0.3.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/.htaccess +0 -4
- package/README.md +4 -0
- package/index.d.ts +15 -19
- package/index.js +393 -371
- package/kitchen-sink/php_5_6.js +85 -0
- package/kitchen-sink/php_5_6.wasm +0 -0
- package/kitchen-sink/php_7_0.js +85 -0
- package/kitchen-sink/php_7_0.wasm +0 -0
- package/kitchen-sink/php_7_1.js +85 -0
- package/kitchen-sink/php_7_1.wasm +0 -0
- package/kitchen-sink/php_7_2.js +85 -0
- package/kitchen-sink/php_7_2.wasm +0 -0
- package/kitchen-sink/php_7_3.js +85 -0
- package/kitchen-sink/php_7_3.wasm +0 -0
- package/kitchen-sink/php_7_4.js +85 -0
- package/kitchen-sink/php_7_4.wasm +0 -0
- package/kitchen-sink/php_8_0.js +85 -0
- package/kitchen-sink/php_8_0.wasm +0 -0
- package/kitchen-sink/php_8_1.js +85 -0
- package/kitchen-sink/php_8_1.wasm +0 -0
- package/kitchen-sink/php_8_2.js +85 -0
- package/kitchen-sink/php_8_2.wasm +0 -0
- package/lib/worker-thread/spawn-php-worker-thread.d.ts +1 -9
- package/{php_5_6.js → light/php_5_6.js} +15 -1
- package/{php_5_6.wasm → light/php_5_6.wasm} +0 -0
- package/{php_7_0.js → light/php_7_0.js} +15 -1
- package/{php_7_0.wasm → light/php_7_0.wasm} +0 -0
- package/{php_7_1.js → light/php_7_1.js} +15 -1
- package/{php_7_1.wasm → light/php_7_1.wasm} +0 -0
- package/{php_7_2.js → light/php_7_2.js} +15 -1
- package/{php_7_2.wasm → light/php_7_2.wasm} +0 -0
- package/{php_7_3.js → light/php_7_3.js} +15 -1
- package/{php_7_3.wasm → light/php_7_3.wasm} +0 -0
- package/{php_7_4.js → light/php_7_4.js} +16 -2
- package/{php_7_4.wasm → light/php_7_4.wasm} +0 -0
- package/{php_8_0.js → light/php_8_0.js} +16 -2
- package/{php_8_0.wasm → light/php_8_0.wasm} +0 -0
- package/{php_8_1.js → light/php_8_1.js} +16 -2
- package/{php_8_1.wasm → light/php_8_1.wasm} +0 -0
- package/{php_8_2.js → light/php_8_2.js} +15 -1
- package/{php_8_2.wasm → light/php_8_2.wasm} +0 -0
- package/package.json +6 -2
- package/lib/worker-thread/parse-startup-options.d.ts +0 -1
package/.htaccess
CHANGED
package/README.md
CHANGED
|
@@ -29,3 +29,7 @@ const response = await php.request({
|
|
|
29
29
|
});
|
|
30
30
|
console.log(response.text);
|
|
31
31
|
```
|
|
32
|
+
|
|
33
|
+
## Attribution
|
|
34
|
+
|
|
35
|
+
`@php-wasm/web` started as a fork of the original PHP to WebAssembly build published by Oraoto in https://github.com/oraoto/pib and modified by Sean Morris in https://github.com/seanmorris/php-wasm.
|
package/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare function consumeAPI<APIType>(remote: Worker | Window): RemoteAPI<
|
|
|
20
20
|
export type PublicAPI<Methods, PipedAPI = unknown> = RemoteAPI<Methods & PipedAPI>;
|
|
21
21
|
export declare function exposeAPI<Methods, PipedAPI>(apiMethods?: Methods, pipedApi?: PipedAPI): [
|
|
22
22
|
() => void,
|
|
23
|
+
(e: Error) => void,
|
|
23
24
|
PublicAPI<Methods, PipedAPI>
|
|
24
25
|
];
|
|
25
26
|
export interface PHPResponseData {
|
|
@@ -142,7 +143,7 @@ export interface RequestHandler {
|
|
|
142
143
|
* }
|
|
143
144
|
* })
|
|
144
145
|
* php.writeFile("/www/index.php", `<?php echo file_get_contents("php://input");`);
|
|
145
|
-
* const result = await php.
|
|
146
|
+
* const result = await php.request({
|
|
146
147
|
* method: "GET",
|
|
147
148
|
* headers: {
|
|
148
149
|
* "Content-Type": "text/plain"
|
|
@@ -380,7 +381,7 @@ export interface IsomorphicLocalPHP extends RequestHandler {
|
|
|
380
381
|
* post_message_to_js(string $data)
|
|
381
382
|
*
|
|
382
383
|
* Arguments:
|
|
383
|
-
* $data –
|
|
384
|
+
* $data (string) – Data to pass to JavaScript.
|
|
384
385
|
*
|
|
385
386
|
* @example
|
|
386
387
|
*
|
|
@@ -519,11 +520,6 @@ export interface PHPRequestHandlerConfiguration {
|
|
|
519
520
|
* Request Handler URL. Used to populate $_SERVER details like HTTP_HOST.
|
|
520
521
|
*/
|
|
521
522
|
absoluteUrl?: string;
|
|
522
|
-
/**
|
|
523
|
-
* Callback used by the PHPRequestHandler to decide whether
|
|
524
|
-
* the requested path refers to a PHP file or a static file.
|
|
525
|
-
*/
|
|
526
|
-
isStaticFilePath?: (path: string) => boolean;
|
|
527
523
|
}
|
|
528
524
|
declare class PHPRequestHandler implements RequestHandler {
|
|
529
525
|
#private;
|
|
@@ -696,6 +692,8 @@ export interface PHPWebLoaderOptions {
|
|
|
696
692
|
downloadMonitor?: EmscriptenDownloadMonitor;
|
|
697
693
|
requestHandler?: PHPRequestHandlerConfiguration;
|
|
698
694
|
dataModules?: Array<DataModule | Promise<DataModule>>;
|
|
695
|
+
/** @deprecated To be replaced with `extensions` in the future */
|
|
696
|
+
loadAllExtensions?: boolean;
|
|
699
697
|
}
|
|
700
698
|
export declare class WebPHP extends BasePHP {
|
|
701
699
|
/**
|
|
@@ -776,7 +774,14 @@ export declare class WebPHPEndpoint implements IsomorphicLocalPHP {
|
|
|
776
774
|
/** @inheritDoc @php-wasm/web!WebPHP.onMessage */
|
|
777
775
|
onMessage(listener: MessageListener): void;
|
|
778
776
|
}
|
|
779
|
-
|
|
777
|
+
/**
|
|
778
|
+
* Loads the PHP loader module for the given PHP version.
|
|
779
|
+
*
|
|
780
|
+
* @param version The PHP version to load.
|
|
781
|
+
* @param variant Internal. Do not use.
|
|
782
|
+
* @returns The PHP loader module.
|
|
783
|
+
*/
|
|
784
|
+
export declare function getPHPLoaderModule(version?: SupportedPHPVersion, variant?: "light" | "kitchen-sink"): Promise<PHPLoaderModule>;
|
|
780
785
|
/**
|
|
781
786
|
* Run this in the main application to register the service worker or
|
|
782
787
|
* reload the registered worker if the app expects a different version
|
|
@@ -787,23 +792,14 @@ export declare function getPHPLoaderModule(version?: SupportedPHPVersion): Promi
|
|
|
787
792
|
* mismatched with the actual version, the service worker
|
|
788
793
|
* will be re-registered.
|
|
789
794
|
*/
|
|
790
|
-
export declare function registerServiceWorker<Client extends Remote<WebPHPEndpoint>>(phpApi: Client, scope: string, scriptUrl: string
|
|
791
|
-
export declare function parseWorkerStartupOptions<T extends Record<string, string>>(): T;
|
|
792
|
-
/**
|
|
793
|
-
* Recommended Worker Thread backend.
|
|
794
|
-
* It's typically "webworker", but in Firefox it's "iframe"
|
|
795
|
-
* because Firefox doesn't support module workers with dynamic imports.
|
|
796
|
-
* See https://github.com/mdn/content/issues/24402
|
|
797
|
-
*/
|
|
798
|
-
export declare const recommendedWorkerBackend: string;
|
|
795
|
+
export declare function registerServiceWorker<Client extends Remote<WebPHPEndpoint>>(phpApi: Client, scope: string, scriptUrl: string): Promise<void>;
|
|
799
796
|
/**
|
|
800
797
|
* Spawns a new Worker Thread.
|
|
801
798
|
*
|
|
802
799
|
* @param workerUrl The absolute URL of the worker script.
|
|
803
|
-
* @param workerBackend The Worker Thread backend to use. Either 'webworker' or 'iframe'.
|
|
804
800
|
* @param config
|
|
805
801
|
* @returns The spawned Worker Thread.
|
|
806
802
|
*/
|
|
807
|
-
export declare function spawnPHPWorkerThread(workerUrl: string,
|
|
803
|
+
export declare function spawnPHPWorkerThread(workerUrl: string, startupOptions?: Record<string, string | string[]>): Promise<Worker>;
|
|
808
804
|
|
|
809
805
|
export {};
|