@php-wasm/cli 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.
Files changed (2) hide show
  1. package/main.js +4 -4
  2. package/package.json +4 -4
package/main.js CHANGED
@@ -1,4 +1,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();
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 $,PHP as g}from"@php-wasm/universal";import{spawn as R}from"child_process";import{loadNodeRuntime as C,useHostFilesystem as k}from"@php-wasm/node";const H="modulepreload",L=function(a){return"/"+a},d={},_=function(r,c,p){if(!c||c.length===0)return r();const i=document.getElementsByTagName("link");return Promise.all(c.map(t=>{if(t=L(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":H,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 h=new URL("ca-bundle.crt",(import.meta||{}).url).pathname;v(h)||f(h,E.join(`
2
+ `));o.unshift("-d",`openssl.cafile=${h}`);async function x(){const a=await _(()=>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=new g(await C(r,{emscriptenOptions:{ENV:{...p,TERM:"xterm"}}}));k(i),i.setSpawnHandler(e=>{const m=`${process.argv[0]} ${process.execArgv.join(" ")} ${process.argv[1]}`,u=e.replace(/^(?:\\ |[^ ])*php\d?(\s|$)/,m+"$1"),s=P("php-wasm-"),n=`${s}/script.sh`;f(n,`#!/bin/sh
3
+ ${u} < /dev/stdin
4
+ `);try{return R(u,[],{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)})}x();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/cli",
3
- "version": "0.7.20",
3
+ "version": "0.9.4",
4
4
  "description": "PHP.wasm CLI for node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,12 +23,12 @@
23
23
  "type": "module",
24
24
  "main": "main.js",
25
25
  "bin": "php-wasm.js",
26
- "gitHead": "5915ef756c88da8dcb665f9f0e49ddc0c0b10d50",
26
+ "gitHead": "702bb9bed9c153ea23651059592aea19c1ba9be4",
27
27
  "dependencies": {
28
28
  "comlink": "^4.4.1",
29
29
  "ini": "4.1.2",
30
30
  "ws": "8.13.0",
31
- "@php-wasm/universal": "0.7.20",
32
- "@php-wasm/node": "0.7.20"
31
+ "@php-wasm/universal": "0.9.4",
32
+ "@php-wasm/node": "0.9.4"
33
33
  }
34
34
  }