@php-wasm/cli 0.5.4 → 0.5.6
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/main.js +4 -4
- package/package.json +5 -5
- /package/{cli.js → php-wasm.js} +0 -0
package/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as v,writeFileSync as f,mkdtempSync as P}from"fs";import{rootCertificates as
|
|
2
|
-
`));o.unshift("-d",`openssl.cafile=${
|
|
3
|
-
${
|
|
4
|
-
`)
|
|
1
|
+
import{existsSync as v,writeFileSync as f,mkdtempSync as P,rmSync as w,rmdirSync as y}from"fs";import{rootCertificates as E}from"tls";import{LatestSupportedPHPVersion as S,SupportedPHPVersionsList as $}from"@php-wasm/universal";import{NodePHP as g}from"@php-wasm/node";import{spawn as C}from"child_process";const R="modulepreload",k=function(a){return"/"+a},d={},H=function(r,c,p){if(!c||c.length===0)return r();const i=document.getElementsByTagName("link");return Promise.all(c.map(t=>{if(t=k(t),t in d)return;d[t]=!0;const e=t.endsWith(".css"),m=e?'[rel="stylesheet"]':"";if(!!p)for(let n=i.length-1;n>=0;n--){const l=i[n];if(l.href===t&&(!e||l.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${t}"]${m}`))return;const s=document.createElement("link");if(s.rel=e?"stylesheet":R,e||(s.as="script",s.crossOrigin=""),s.href=t,document.head.appendChild(s),e)return new Promise((n,l)=>{s.addEventListener("load",n),s.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${t}`)))})})).then(()=>r()).catch(t=>{const e=new Event("vite:preloadError",{cancelable:!0});if(e.payload=t,window.dispatchEvent(e),!e.defaultPrevented)throw t})};let o=process.argv.slice(2);o.length||(o=["--help"]);const u=new URL("ca-bundle.crt",(import.meta||{}).url).pathname;v(u)||f(u,E.join(`
|
|
2
|
+
`));o.unshift("-d",`openssl.cafile=${u}`);async function L(){const a=await H(()=>import("./assets/php-e1f9edd4.js"),[]),r=process.env.PHP||S;if(!$.includes(r))throw new Error(`Unsupported PHP version ${r}`);const{TMPDIR:c,...p}=process.env,i=await g.load(r,{emscriptenOptions:{ENV:{...p,TERM:"xterm"}}});i.useHostFilesystem(),i.setSpawnHandler(e=>{const m=`${process.argv[0]} ${process.execArgv.join(" ")} ${process.argv[1]}`,h=e.replace(/^(?:\\ |[^ ])*php\d?(\s|$)/,m+"$1"),s=P("php-wasm-"),n=`${s}/script.sh`;f(n,`#!/bin/sh
|
|
3
|
+
${h} < /dev/stdin
|
|
4
|
+
`);try{return C(h,[],{shell:!0,stdio:["pipe","pipe","pipe"],timeout:5e3})}finally{w(n),y(s)}}),o.some(e=>e.startsWith("-c"))||o.unshift("-c",a),await i.cli(["php",...o]).catch(e=>{throw e.name==="ExitStatus"&&process.exit(e.status===void 0?1:e.status),e}).finally(()=>{setTimeout(()=>{process.exit(0)},100)})}L();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "PHP.wasm CLI for node.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"license": "GPL-2.0-or-later",
|
|
23
23
|
"type": "module",
|
|
24
24
|
"main": "main.js",
|
|
25
|
-
"bin": "
|
|
26
|
-
"gitHead": "
|
|
25
|
+
"bin": "php-wasm.js",
|
|
26
|
+
"gitHead": "72e190ebb407051ccb5ef544e2a62018395395a0",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"comlink": "^4.4.1",
|
|
29
29
|
"ws": "8.13.0",
|
|
30
|
-
"@php-wasm/universal": "0.5.
|
|
31
|
-
"@php-wasm/node": "0.5.
|
|
30
|
+
"@php-wasm/universal": "0.5.6",
|
|
31
|
+
"@php-wasm/node": "0.5.6"
|
|
32
32
|
}
|
|
33
33
|
}
|
/package/{cli.js → php-wasm.js}
RENAMED
|
File without changes
|