@capsulescodes/browser-php 0.5.12 → 0.6.1
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/README.md +3 -2
- package/bin/cli.js +19 -11
- package/dist/env.js +8231 -6
- package/dist/installer.js +7 -7
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -117,9 +117,10 @@ npm run composer
|
|
|
117
117
|
|
|
118
118
|
The scripts can be configured with environment variables
|
|
119
119
|
|
|
120
|
-
- `BROWSER_PHP_VERSION` : The PHP version you need | default : `8.
|
|
120
|
+
- `BROWSER_PHP_VERSION` : The PHP version you need | default : `8.3`
|
|
121
|
+
- `BROWSER_PHP_CLI` : The CLI output mode | default : `xterm`
|
|
121
122
|
|
|
122
|
-
- `BROWSER_PHP_COMPOSER_VERSION` : The Composer executable version | default : `2.
|
|
123
|
+
- `BROWSER_PHP_COMPOSER_VERSION` : The Composer executable version | default : `2.8.9`
|
|
123
124
|
- `BROWSER_PHP_COMPOSER_PATH` : The Composer executable path | default : `vendor/bin`
|
|
124
125
|
- `BROWSER_PHP_COMPOSER_NAME` : The Composer executable name | default : `composer`
|
|
125
126
|
|
package/bin/cli.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { PHP as
|
|
2
|
+
import { PHP as p } from "@php-wasm/universal";
|
|
3
3
|
import { loadNodeRuntime as n, createNodeFsMountHandler as c } from "@php-wasm/node";
|
|
4
|
-
import
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
4
|
+
import s from "../dist/env.js";
|
|
5
|
+
const r = new p(await n(s.php.version, { emscriptenOptions: { ENV: { TERM: s.php.cli } } }));
|
|
6
|
+
r.mkdir(process.cwd());
|
|
7
|
+
r.mount(process.cwd(), c(process.cwd()));
|
|
8
|
+
r.chdir(process.cwd());
|
|
9
|
+
let d = process.argv.slice(2);
|
|
10
|
+
const t = await r.cli(["php", ...d]);
|
|
11
|
+
t.stderr.pipeTo(new WritableStream({ write(e) {
|
|
12
|
+
process.stderr.write(e);
|
|
13
|
+
} }));
|
|
14
|
+
t.stdout.pipeTo(new WritableStream({ write(e) {
|
|
15
|
+
process.stdout.write(e);
|
|
16
|
+
} }));
|
|
17
|
+
t.exitCode.finally(() => setTimeout(() => process.exit(0), 100));
|
|
18
|
+
const a = process.stderr.write;
|
|
19
|
+
process.stderr.write = function(e, i, o) {
|
|
20
|
+
return typeof e == "string" && (e.includes("Program terminated with exit(0)") || e.includes("ErrorEvent")) ? !0 : a.call(process.stderr, e, i, o);
|
|
21
|
+
};
|