@php-wasm/web 0.1.61 → 0.2.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/index.d.ts +5 -12
- package/index.js +276 -283
- package/lib/worker-thread/spawn-php-worker-thread.d.ts +1 -9
- package/package.json +6 -2
- package/php_5_6.js +15 -1
- package/php_5_6.wasm +0 -0
- package/php_7_0.js +15 -1
- package/php_7_0.wasm +0 -0
- package/php_7_1.js +15 -1
- package/php_7_1.wasm +0 -0
- package/php_7_2.js +15 -1
- package/php_7_2.wasm +0 -0
- package/php_7_3.js +15 -1
- package/php_7_3.wasm +0 -0
- package/php_7_4.js +16 -2
- package/php_7_4.wasm +0 -0
- package/php_8_0.js +16 -2
- package/php_8_0.wasm +0 -0
- package/php_8_1.js +16 -2
- package/php_8_1.wasm +0 -0
- package/php_8_2.js +15 -1
- package/php_8_2.wasm +0 -0
- package/README.md +0 -31
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Recommended Worker Thread backend.
|
|
3
|
-
* It's typically "webworker", but in Firefox it's "iframe"
|
|
4
|
-
* because Firefox doesn't support module workers with dynamic imports.
|
|
5
|
-
* See https://github.com/mdn/content/issues/24402
|
|
6
|
-
*/
|
|
7
|
-
export declare const recommendedWorkerBackend: string;
|
|
8
1
|
/**
|
|
9
2
|
* Spawns a new Worker Thread.
|
|
10
3
|
*
|
|
11
4
|
* @param workerUrl The absolute URL of the worker script.
|
|
12
|
-
* @param workerBackend The Worker Thread backend to use. Either 'webworker' or 'iframe'.
|
|
13
5
|
* @param config
|
|
14
6
|
* @returns The spawned Worker Thread.
|
|
15
7
|
*/
|
|
16
|
-
export declare function spawnPHPWorkerThread(workerUrl: string,
|
|
8
|
+
export declare function spawnPHPWorkerThread(workerUrl: string, startupOptions?: Record<string, string>): Promise<Worker>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "PHP.wasm for the web",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,5 +29,9 @@
|
|
|
29
29
|
"type": "module",
|
|
30
30
|
"main": "index.js",
|
|
31
31
|
"types": "index.d.ts",
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "cd4062de74f7f18058d3f962e124d0fdff78b5a7",
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=16.15.1",
|
|
35
|
+
"npm": ">=8.11.0"
|
|
36
|
+
}
|
|
33
37
|
}
|
package/php_5_6.js
CHANGED
|
@@ -63,7 +63,21 @@ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Data dependencies call removeRunDependency() when they are loaded.
|
|
68
|
+
* The synchronous call stack then continues to run. If an error occurs
|
|
69
|
+
* in PHP initialization, e.g. Out Of Memory error, it will not be
|
|
70
|
+
* caught by any try/catch. This override propagates the failure to
|
|
71
|
+
* PHPLoader.onAbort() so that it can be handled.
|
|
72
|
+
*/
|
|
73
|
+
const originalRemoveRunDependency = PHPLoader['removeRunDependency'];
|
|
74
|
+
PHPLoader['removeRunDependency'] = function (...args) {
|
|
75
|
+
try {
|
|
76
|
+
originalRemoveRunDependency(...args);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
PHPLoader['onAbort'](e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
return PHPLoader;
|
|
69
83
|
|
package/php_5_6.wasm
CHANGED
|
Binary file
|
package/php_7_0.js
CHANGED
|
@@ -63,7 +63,21 @@ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Data dependencies call removeRunDependency() when they are loaded.
|
|
68
|
+
* The synchronous call stack then continues to run. If an error occurs
|
|
69
|
+
* in PHP initialization, e.g. Out Of Memory error, it will not be
|
|
70
|
+
* caught by any try/catch. This override propagates the failure to
|
|
71
|
+
* PHPLoader.onAbort() so that it can be handled.
|
|
72
|
+
*/
|
|
73
|
+
const originalRemoveRunDependency = PHPLoader['removeRunDependency'];
|
|
74
|
+
PHPLoader['removeRunDependency'] = function (...args) {
|
|
75
|
+
try {
|
|
76
|
+
originalRemoveRunDependency(...args);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
PHPLoader['onAbort'](e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
return PHPLoader;
|
|
69
83
|
|
package/php_7_0.wasm
CHANGED
|
Binary file
|
package/php_7_1.js
CHANGED
|
@@ -63,7 +63,21 @@ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Data dependencies call removeRunDependency() when they are loaded.
|
|
68
|
+
* The synchronous call stack then continues to run. If an error occurs
|
|
69
|
+
* in PHP initialization, e.g. Out Of Memory error, it will not be
|
|
70
|
+
* caught by any try/catch. This override propagates the failure to
|
|
71
|
+
* PHPLoader.onAbort() so that it can be handled.
|
|
72
|
+
*/
|
|
73
|
+
const originalRemoveRunDependency = PHPLoader['removeRunDependency'];
|
|
74
|
+
PHPLoader['removeRunDependency'] = function (...args) {
|
|
75
|
+
try {
|
|
76
|
+
originalRemoveRunDependency(...args);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
PHPLoader['onAbort'](e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
return PHPLoader;
|
|
69
83
|
|
package/php_7_1.wasm
CHANGED
|
Binary file
|
package/php_7_2.js
CHANGED
|
@@ -63,7 +63,21 @@ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Data dependencies call removeRunDependency() when they are loaded.
|
|
68
|
+
* The synchronous call stack then continues to run. If an error occurs
|
|
69
|
+
* in PHP initialization, e.g. Out Of Memory error, it will not be
|
|
70
|
+
* caught by any try/catch. This override propagates the failure to
|
|
71
|
+
* PHPLoader.onAbort() so that it can be handled.
|
|
72
|
+
*/
|
|
73
|
+
const originalRemoveRunDependency = PHPLoader['removeRunDependency'];
|
|
74
|
+
PHPLoader['removeRunDependency'] = function (...args) {
|
|
75
|
+
try {
|
|
76
|
+
originalRemoveRunDependency(...args);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
PHPLoader['onAbort'](e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
return PHPLoader;
|
|
69
83
|
|
package/php_7_2.wasm
CHANGED
|
Binary file
|
package/php_7_3.js
CHANGED
|
@@ -63,7 +63,21 @@ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Data dependencies call removeRunDependency() when they are loaded.
|
|
68
|
+
* The synchronous call stack then continues to run. If an error occurs
|
|
69
|
+
* in PHP initialization, e.g. Out Of Memory error, it will not be
|
|
70
|
+
* caught by any try/catch. This override propagates the failure to
|
|
71
|
+
* PHPLoader.onAbort() so that it can be handled.
|
|
72
|
+
*/
|
|
73
|
+
const originalRemoveRunDependency = PHPLoader['removeRunDependency'];
|
|
74
|
+
PHPLoader['removeRunDependency'] = function (...args) {
|
|
75
|
+
try {
|
|
76
|
+
originalRemoveRunDependency(...args);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
PHPLoader['onAbort'](e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
return PHPLoader;
|
|
69
83
|
|
package/php_7_3.wasm
CHANGED
|
Binary file
|
package/php_7_4.js
CHANGED
|
@@ -63,8 +63,22 @@ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Data dependencies call removeRunDependency() when they are loaded.
|
|
68
|
+
* The synchronous call stack then continues to run. If an error occurs
|
|
69
|
+
* in PHP initialization, e.g. Out Of Memory error, it will not be
|
|
70
|
+
* caught by any try/catch. This override propagates the failure to
|
|
71
|
+
* PHPLoader.onAbort() so that it can be handled.
|
|
72
|
+
*/
|
|
73
|
+
const originalRemoveRunDependency = PHPLoader['removeRunDependency'];
|
|
74
|
+
PHPLoader['removeRunDependency'] = function (...args) {
|
|
75
|
+
try {
|
|
76
|
+
originalRemoveRunDependency(...args);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
PHPLoader['onAbort'](e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
68
82
|
return PHPLoader;
|
|
69
83
|
|
|
70
84
|
// Close the opening bracket from esm-prefix.js:
|
package/php_7_4.wasm
CHANGED
|
Binary file
|
package/php_8_0.js
CHANGED
|
@@ -62,8 +62,22 @@ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
|
|
|
62
62
|
return originalHandleSleep(startAsync);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Data dependencies call removeRunDependency() when they are loaded.
|
|
68
|
+
* The synchronous call stack then continues to run. If an error occurs
|
|
69
|
+
* in PHP initialization, e.g. Out Of Memory error, it will not be
|
|
70
|
+
* caught by any try/catch. This override propagates the failure to
|
|
71
|
+
* PHPLoader.onAbort() so that it can be handled.
|
|
72
|
+
*/
|
|
73
|
+
const originalRemoveRunDependency = PHPLoader['removeRunDependency'];
|
|
74
|
+
PHPLoader['removeRunDependency'] = function (...args) {
|
|
75
|
+
try {
|
|
76
|
+
originalRemoveRunDependency(...args);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
PHPLoader['onAbort'](e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
return PHPLoader;
|
|
69
83
|
|
package/php_8_0.wasm
CHANGED
|
Binary file
|
package/php_8_1.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import dependencyFilename from './php_8_1.wasm';
|
|
2
2
|
export { dependencyFilename };
|
|
3
|
-
export const dependenciesTotalSize =
|
|
3
|
+
export const dependenciesTotalSize = 5653952;
|
|
4
4
|
export function init(RuntimeName, PHPLoader) {
|
|
5
5
|
/**
|
|
6
6
|
* Overrides Emscripten's default ExitStatus object which gets
|
|
@@ -63,7 +63,21 @@ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Data dependencies call removeRunDependency() when they are loaded.
|
|
68
|
+
* The synchronous call stack then continues to run. If an error occurs
|
|
69
|
+
* in PHP initialization, e.g. Out Of Memory error, it will not be
|
|
70
|
+
* caught by any try/catch. This override propagates the failure to
|
|
71
|
+
* PHPLoader.onAbort() so that it can be handled.
|
|
72
|
+
*/
|
|
73
|
+
const originalRemoveRunDependency = PHPLoader['removeRunDependency'];
|
|
74
|
+
PHPLoader['removeRunDependency'] = function (...args) {
|
|
75
|
+
try {
|
|
76
|
+
originalRemoveRunDependency(...args);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
PHPLoader['onAbort'](e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
return PHPLoader;
|
|
69
83
|
|
package/php_8_1.wasm
CHANGED
|
Binary file
|
package/php_8_2.js
CHANGED
|
@@ -63,7 +63,21 @@ if (PHPLoader.debug && typeof Asyncify !== "undefined") {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Data dependencies call removeRunDependency() when they are loaded.
|
|
68
|
+
* The synchronous call stack then continues to run. If an error occurs
|
|
69
|
+
* in PHP initialization, e.g. Out Of Memory error, it will not be
|
|
70
|
+
* caught by any try/catch. This override propagates the failure to
|
|
71
|
+
* PHPLoader.onAbort() so that it can be handled.
|
|
72
|
+
*/
|
|
73
|
+
const originalRemoveRunDependency = PHPLoader['removeRunDependency'];
|
|
74
|
+
PHPLoader['removeRunDependency'] = function (...args) {
|
|
75
|
+
try {
|
|
76
|
+
originalRemoveRunDependency(...args);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
PHPLoader['onAbort'](e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
return PHPLoader;
|
|
69
83
|
|
package/php_8_2.wasm
CHANGED
|
Binary file
|
package/README.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# WebAssembly PHP for the web
|
|
2
|
-
|
|
3
|
-
This package ships WebAssembly PHP binaries and the JavaScript API optimized for the web and a low bundle size. It comes with the Libzip extension and the SQLite extension.
|
|
4
|
-
|
|
5
|
-
Here's how to use it:
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
import { PHP } from '@php-wasm/web';
|
|
9
|
-
|
|
10
|
-
// PHP.load() calls import('php.wasm') internally
|
|
11
|
-
// Your bundler must resolve import('php.wasm') as a static file URL.
|
|
12
|
-
// If you use Webpack, you can use the file-loader to do so.
|
|
13
|
-
const php = await PHP.load('8.0', {
|
|
14
|
-
requestHandler: {
|
|
15
|
-
documentRoot: '/www',
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// Create and run a script directly
|
|
20
|
-
php.mkdirTree('/www');
|
|
21
|
-
php.writeFile('/www/index.php', `<?php echo "Hello " . $_POST['name']; ?>`);
|
|
22
|
-
await php.run({ scriptPath: './index.php' });
|
|
23
|
-
|
|
24
|
-
// Or use the familiar HTTP concepts:
|
|
25
|
-
const response = await php.request({
|
|
26
|
-
method: 'POST',
|
|
27
|
-
url: '/index.php',
|
|
28
|
-
data: { name: 'John' },
|
|
29
|
-
});
|
|
30
|
-
console.log(response.text);
|
|
31
|
-
```
|