@wp-playground/common 1.0.15 → 1.0.17

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/index.js +4 -4
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- function l(e){return`json_decode(base64_decode('${d(JSON.stringify(e))}'), true)`}function $(e){const t={};for(const r in e)t[r]=l(e[r]);return t}function d(e){return p(new TextEncoder().encode(e))}function p(e){const t=String.fromCodePoint(...e);return btoa(t)}function h(e=fetch){const t={};return async function(i,n){t[i]||(t[i]=e(i,n).then(o=>({body:o.body,responseInit:{status:o.status,statusText:o.statusText,headers:o.headers}})));const{body:a,responseInit:s}=await t[i],[f,u]=a.tee();return t[i]={body:f,responseInit:s},new Response(u,s)}}const w="8.0",c="/tmp/file.zip",x=async(e,t,r,i=!0)=>{if(t instanceof File){const a=t;t=c,await e.writeFile(t,new Uint8Array(await a.arrayBuffer()))}const n=$({zipPath:t,extractToPath:r,overwriteFiles:i});await e.run({code:`<?php
1
+ function l(e){return`json_decode(base64_decode('${d(JSON.stringify(e))}'), true)`}function $(e){const t={};for(const r in e)t[r]=l(e[r]);return t}function d(e){return p(new TextEncoder().encode(e))}function p(e){const t=String.fromCodePoint(...e);return btoa(t)}function h(e=fetch){const t={};return async function(i,n){t[i]||(t[i]=e(i,n).then(o=>({body:o.body,responseInit:{status:o.status,statusText:o.statusText,headers:o.headers}})));const{body:a,responseInit:s}=await t[i],[f,u]=a.tee();return t[i]={body:f,responseInit:s},new Response(u,s)}}const w="8.0",c="/tmp/file.zip",z=async(e,t,r,i=!0)=>{if(t instanceof File){const a=t;t=c,await e.writeFile(t,new Uint8Array(await a.arrayBuffer()))}const n=$({zipPath:t,extractToPath:r,overwriteFiles:i});await e.run({code:`<?php
2
2
  function unzip($zipPath, $extractTo, $overwriteFiles = true)
3
3
  {
4
4
  if (!is_dir($extractTo)) {
@@ -20,11 +20,11 @@ function l(e){return`json_decode(base64_decode('${d(JSON.stringify(e))}'), true)
20
20
  $zip->close();
21
21
  chmod($extractTo, 0777);
22
22
  } else {
23
- throw new Exception("Could not unzip file");
23
+ throw new Exception("Could not unzip file: " . $zip->getStatusString());
24
24
  }
25
25
  }
26
26
  unzip(${n.zipPath}, ${n.extractToPath}, ${n.overwriteFiles});
27
- `}),await e.fileExists(c)&&await e.unlink(c)},z=async(e,t)=>{const r=`/tmp/file${Math.random()}.zip`,i=$({directoryPath:t,outputPath:r});await e.run({code:`<?php
27
+ `}),await e.fileExists(c)&&await e.unlink(c)},x=async(e,t)=>{const r=`/tmp/file${Math.random()}.zip`,i=$({directoryPath:t,outputPath:r});await e.run({code:`<?php
28
28
  function zipDirectory($directoryPath, $outputPath) {
29
29
  $zip = new ZipArchive;
30
30
  $res = $zip->open($outputPath, ZipArchive::CREATE);
@@ -45,4 +45,4 @@ function l(e){return`json_decode(base64_decode('${d(JSON.stringify(e))}'), true)
45
45
  chmod($outputPath, 0777);
46
46
  }
47
47
  zipDirectory(${i.directoryPath}, ${i.outputPath});
48
- `});const n=await e.readFileAsBuffer(r);return e.unlink(r),n};export{w as RecommendedPHPVersion,h as createMemoizedFetch,x as unzipFile,z as zipDirectory};
48
+ `});const n=await e.readFileAsBuffer(r);return e.unlink(r),n};export{w as RecommendedPHPVersion,h as createMemoizedFetch,z as unzipFile,x as zipDirectory};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-playground/common",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "Common exports and utilities for WordPress Playground",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,11 +27,11 @@
27
27
  "access": "public",
28
28
  "directory": "../../../dist/packages/playground/common"
29
29
  },
30
- "gitHead": "916516040522ab257109dd617bfcc493bb4f2eb1",
30
+ "gitHead": "c6b9b151a8baf922d23294d953e346458b9616cb",
31
31
  "dependencies": {
32
32
  "comlink": "^4.4.1",
33
33
  "ini": "4.1.2",
34
- "@php-wasm/universal": "1.0.15",
35
- "@php-wasm/util": "1.0.15"
34
+ "@php-wasm/universal": "1.0.17",
35
+ "@php-wasm/util": "1.0.17"
36
36
  }
37
37
  }