@wp-playground/cli 3.0.18 → 3.0.19

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.
@@ -10,7 +10,6 @@ import { type RunCLIArgs, type SpawnedWorker, type WorkerType } from '../run-cli
10
10
  * implemented in TypeScript and orchestrated by this class.
11
11
  */
12
12
  export declare class BlueprintsV1Handler {
13
- private phpVersion;
14
13
  private lastProgressMessage;
15
14
  private siteUrl;
16
15
  private processIdSpaceLength;
@@ -20,8 +19,8 @@ export declare class BlueprintsV1Handler {
20
19
  processIdSpaceLength: number;
21
20
  });
22
21
  getWorkerType(): WorkerType;
23
- bootPrimaryWorker(phpPort: NodeMessagePort, fileLockManagerPort: NodeMessagePort, nativeInternalDirPath: string): Promise<import("@php-wasm/universal").RemoteAPI<PlaygroundCliBlueprintV1Worker>>;
24
- bootSecondaryWorker({ worker, fileLockManagerPort, firstProcessId, nativeInternalDirPath, }: {
22
+ bootAndSetUpInitialPlayground(phpPort: NodeMessagePort, fileLockManagerPort: NodeMessagePort, nativeInternalDirPath: string): Promise<import("@php-wasm/universal").RemoteAPI<PlaygroundCliBlueprintV1Worker>>;
23
+ bootPlayground({ worker, fileLockManagerPort, firstProcessId, nativeInternalDirPath, }: {
25
24
  worker: SpawnedWorker;
26
25
  fileLockManagerPort: NodeMessagePort;
27
26
  firstProcessId: number;
@@ -36,7 +36,7 @@ export type PrimaryWorkerBootOptions = WorkerBootOptions & {
36
36
  };
37
37
  interface WorkerBootRequestHandlerOptions {
38
38
  siteUrl: string;
39
- allow?: string;
39
+ followSymlinks: boolean;
40
40
  phpVersion: SupportedPHPVersion;
41
41
  firstProcessId: number;
42
42
  processIdSpaceLength: number;
@@ -44,6 +44,7 @@ interface WorkerBootRequestHandlerOptions {
44
44
  nativeInternalDirPath: string;
45
45
  mountsBeforeWpInstall: Array<Mount>;
46
46
  mountsAfterWpInstall: Array<Mount>;
47
+ withXdebug?: boolean;
47
48
  }
48
49
  export declare class PlaygroundCliBlueprintV1Worker extends PHPWorker {
49
50
  booted: boolean;
@@ -59,9 +60,9 @@ export declare class PlaygroundCliBlueprintV1Worker extends PHPWorker {
59
60
  * @see phpwasm-emscripten-library-file-locking-for-node.js
60
61
  */
61
62
  useFileLockManager(port: MessagePort): Promise<void>;
62
- bootAsPrimaryWorker({ siteUrl, mountsBeforeWpInstall, mountsAfterWpInstall, phpVersion: php, wordPressZip, sqliteIntegrationPluginZip, firstProcessId, processIdSpaceLength, dataSqlPath, followSymlinks, trace, internalCookieStore, withXdebug, nativeInternalDirPath, }: PrimaryWorkerBootOptions): Promise<void>;
63
- bootAsSecondaryWorker(args: WorkerBootOptions): Promise<void>;
64
- bootRequestHandler({ siteUrl, allow, phpVersion, firstProcessId, processIdSpaceLength, trace, nativeInternalDirPath, mountsBeforeWpInstall, mountsAfterWpInstall, }: WorkerBootRequestHandlerOptions): Promise<void>;
63
+ bootAndSetUpInitialWorker({ siteUrl, mountsBeforeWpInstall, mountsAfterWpInstall, phpVersion: php, wordPressZip, sqliteIntegrationPluginZip, firstProcessId, processIdSpaceLength, dataSqlPath, followSymlinks, trace, internalCookieStore, withXdebug, nativeInternalDirPath, }: PrimaryWorkerBootOptions): Promise<void>;
64
+ bootWorker(args: WorkerBootOptions): Promise<void>;
65
+ bootRequestHandler({ siteUrl, followSymlinks, phpVersion, firstProcessId, processIdSpaceLength, trace, nativeInternalDirPath, mountsBeforeWpInstall, mountsAfterWpInstall, withXdebug, }: WorkerBootRequestHandlerOptions): Promise<void>;
65
66
  dispose(): Promise<void>;
66
67
  }
67
68
  export {};
@@ -21,8 +21,8 @@ export declare class BlueprintsV2Handler {
21
21
  processIdSpaceLength: number;
22
22
  });
23
23
  getWorkerType(): WorkerType;
24
- bootPrimaryWorker(phpPort: NodeMessagePort, fileLockManagerPort: NodeMessagePort, nativeInternalDirPath: string): Promise<RemoteAPI<PlaygroundCliBlueprintV2Worker>>;
25
- bootSecondaryWorker({ worker, fileLockManagerPort, firstProcessId, nativeInternalDirPath, }: {
24
+ bootAndSetUpInitialPlayground(phpPort: NodeMessagePort, fileLockManagerPort: NodeMessagePort, nativeInternalDirPath: string): Promise<RemoteAPI<PlaygroundCliBlueprintV2Worker>>;
25
+ bootPlayground({ worker, fileLockManagerPort, firstProcessId, nativeInternalDirPath, }: {
26
26
  worker: SpawnedWorker;
27
27
  fileLockManagerPort: NodeMessagePort;
28
28
  firstProcessId: number;
@@ -56,8 +56,8 @@ export declare class PlaygroundCliBlueprintV2Worker extends PHPWorker {
56
56
  * @see phpwasm-emscripten-library-file-locking-for-node.js
57
57
  */
58
58
  useFileLockManager(port: MessagePort): Promise<void>;
59
- bootAsPrimaryWorker(args: PrimaryWorkerBootArgs): Promise<void>;
60
- bootAsSecondaryWorker(args: SecondaryWorkerBootArgs): Promise<void>;
59
+ bootAndSetUpInitialWorker(args: PrimaryWorkerBootArgs): Promise<void>;
60
+ bootWorker(args: SecondaryWorkerBootArgs): Promise<void>;
61
61
  runBlueprintV2(args: WorkerRunBlueprintArgs): Promise<void>;
62
62
  bootRequestHandler({ siteUrl, allow, phpVersion, createFiles, constants, phpIniEntries, firstProcessId, processIdSpaceLength, trace, nativeInternalDirPath, withXdebug, onPHPInstanceCreated, }: WorkerBootRequestHandlerOptions): Promise<void>;
63
63
  dispose(): Promise<void>;
package/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";const n=require("./run-cli-Dz_ghzvE.cjs");n.parseOptionsAndRunCLI();
1
+ "use strict";const n=require("./run-cli-4UcAoCNX.cjs");n.parseOptionsAndRunCLI();
2
2
  //# sourceMappingURL=cli.cjs.map
package/cli.js CHANGED
@@ -1,3 +1,3 @@
1
- import { p } from "./run-cli-BBfr5tmj.js";
1
+ import { p } from "./run-cli-fhMEvo2X.js";
2
2
  p();
3
3
  //# sourceMappingURL=cli.js.map
package/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./run-cli-Dz_ghzvE.cjs");exports.LogVerbosity=e.LogVerbosity;exports.parseOptionsAndRunCLI=e.parseOptionsAndRunCLI;exports.runCLI=e.runCLI;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./run-cli-4UcAoCNX.cjs");exports.LogVerbosity=e.LogVerbosity;exports.parseOptionsAndRunCLI=e.parseOptionsAndRunCLI;exports.runCLI=e.runCLI;
2
2
  //# sourceMappingURL=index.cjs.map
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { L as o, p as a, r as n } from "./run-cli-BBfr5tmj.js";
1
+ import { L as o, p as a, r as n } from "./run-cli-fhMEvo2X.js";
2
2
  export {
3
3
  o as LogVerbosity,
4
4
  a as parseOptionsAndRunCLI,
@@ -10,6 +10,7 @@ export declare class LoadBalancer {
10
10
  workerLoads: WorkerLoad[];
11
11
  constructor(initialWorker: RemoteAPI<PlaygroundCliWorker>);
12
12
  addWorker(worker: RemoteAPI<PlaygroundCliWorker>): void;
13
+ removeWorker(worker: RemoteAPI<PlaygroundCliWorker>): Promise<void>;
13
14
  handleRequest(request: PHPRequest): Promise<PHPResponse>;
14
15
  }
15
16
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-playground/cli",
3
- "version": "3.0.18",
3
+ "version": "3.0.19",
4
4
  "description": "WordPress Playground CLI",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "bin": {
35
35
  "wp-playground-cli": "wp-playground.js"
36
36
  },
37
- "gitHead": "0cc6674fcad128d2f9cdbc1163d671309d0e3211",
37
+ "gitHead": "5d6cbf03fb33b4c58c587c43a4a7793d4b050885",
38
38
  "dependencies": {
39
39
  "@zip.js/zip.js": "2.7.57",
40
40
  "ajv": "8.12.0",
@@ -61,16 +61,16 @@
61
61
  "ws": "8.18.3",
62
62
  "xml2js": "0.6.2",
63
63
  "yargs": "17.7.2",
64
- "@php-wasm/logger": "3.0.18",
65
- "@php-wasm/progress": "3.0.18",
66
- "@php-wasm/universal": "3.0.18",
67
- "@wp-playground/blueprints": "3.0.18",
68
- "@wp-playground/common": "3.0.18",
69
- "@wp-playground/wordpress": "3.0.18",
70
- "@php-wasm/node": "3.0.18",
71
- "@php-wasm/util": "3.0.18",
72
- "@wp-playground/storage": "3.0.18",
73
- "@php-wasm/xdebug-bridge": "3.0.18"
64
+ "@php-wasm/logger": "3.0.19",
65
+ "@php-wasm/progress": "3.0.19",
66
+ "@php-wasm/universal": "3.0.19",
67
+ "@wp-playground/blueprints": "3.0.19",
68
+ "@wp-playground/common": "3.0.19",
69
+ "@wp-playground/wordpress": "3.0.19",
70
+ "@php-wasm/node": "3.0.19",
71
+ "@php-wasm/util": "3.0.19",
72
+ "@wp-playground/storage": "3.0.19",
73
+ "@php-wasm/xdebug-bridge": "3.0.19"
74
74
  },
75
75
  "packageManager": "npm@10.9.2",
76
76
  "overrides": {
@@ -0,0 +1,46 @@
1
+ "use strict";var he=Object.create;var K=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var be=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of ge(o))!ye.call(e,s)&&s!==t&&K(e,s,{get:()=>o[s],enumerable:!(i=me(o,s))||i.enumerable});return e};var ve=(e,o,t)=>(t=e!=null?he(we(e)):{},be(o||!e||!e.__esModule?K(t,"default",{value:e,enumerable:!0}):t,e));const m=require("@php-wasm/logger"),x=require("@php-wasm/universal"),W=require("@wp-playground/blueprints"),X=require("@wp-playground/common"),p=require("fs"),J=require("worker_threads"),M=require("./mounts-BJFrPHGW.cjs"),Pe=require("express"),Se=require("@php-wasm/node"),Y=require("os"),ke=require("wasm-feature-detect"),xe=require("yargs"),h=require("path"),D=require("@wp-playground/storage"),Q=require("@php-wasm/progress"),Ie=require("@wp-playground/wordpress"),j=require("fs-extra"),Ce=require("@php-wasm/xdebug-bridge"),ee=require("tmp-promise"),Ee=require("ps-man"),A=require("fast-xml-parser"),v=require("jsonc-parser");var $=typeof document<"u"?document.currentScript:null;async function Le(e){const o=Pe(),t=await new Promise((n,r)=>{const a=o.listen(e.port,()=>{const l=a.address();l===null||typeof l=="string"?r(new Error("Server address is not available")):n(a)})});o.use("/",async(n,r)=>{let a;try{a=await e.handleRequest({url:n.url,headers:Te(n),method:n.method,body:await Re(n)})}catch(l){m.logger.error(l),a=x.PHPResponse.forHttpCode(500)}r.statusCode=a.httpStatusCode;for(const l in a.headers)r.setHeader(l,a.headers[l]);r.end(a.bytes)});const s=t.address().port;return await e.onBind(t,s)}const Re=async e=>await new Promise(o=>{const t=[];e.on("data",i=>{t.push(i)}),e.on("end",()=>{o(new Uint8Array(Buffer.concat(t)))})}),Te=e=>{const o={};if(e.rawHeaders&&e.rawHeaders.length)for(let t=0;t<e.rawHeaders.length;t+=2)o[e.rawHeaders[t].toLowerCase()]=e.rawHeaders[t+1];return o};class $e{constructor(o){this.workerLoads=[],this.addWorker(o)}addWorker(o){this.workerLoads.push({worker:o,activeRequests:new Set})}async removeWorker(o){const t=this.workerLoads.findIndex(s=>s.worker===o);if(t===-1)return;const[i]=this.workerLoads.splice(t,1);await Promise.allSettled(i.activeRequests)}async handleRequest(o){let t=this.workerLoads[0];for(let s=1;s<this.workerLoads.length;s++){const n=this.workerLoads[s];n.activeRequests.size<t.activeRequests.size&&(t=n)}const i=t.worker.request(o);return t.activeRequests.add(i),i.url=o.url,i.finally(()=>{t.activeRequests.delete(i)})}}function We(e){return/^latest$|^trunk$|^nightly$|^(?:(\d+)\.(\d+)(?:\.(\d+))?)((?:-beta(?:\d+)?)|(?:-RC(?:\d+)?))?$/.test(e)}async function je({sourceString:e,blueprintMayReadAdjacentFiles:o}){if(!e)return;if(e.startsWith("http://")||e.startsWith("https://"))return await W.resolveRemoteBlueprint(e);let t=h.resolve(process.cwd(),e);if(!p.existsSync(t))throw new Error(`Blueprint file does not exist: ${t}`);const i=p.statSync(t);if(i.isDirectory()&&(t=h.join(t,"blueprint.json")),!i.isFile()&&i.isSymbolicLink())throw new Error(`Blueprint path is neither a file nor a directory: ${t}`);const s=h.extname(t);switch(s){case".zip":return D.ZipFilesystem.fromArrayBuffer(p.readFileSync(t).buffer);case".json":{const n=p.readFileSync(t,"utf-8");try{JSON.parse(n)}catch{throw new Error(`Blueprint file at ${t} is not a valid JSON file`)}const r=h.dirname(t),a=new D.NodeJsFilesystem(r);return new D.OverlayFilesystem([new D.InMemoryFilesystem({"blueprint.json":n}),{read(l){if(!o)throw new Error(`Error: Blueprint contained tried to read a local file at path "${l}" (via a resource of type "bundled"). Playground restricts access to local resources by default as a security measure.
2
+
3
+ You can allow this Blueprint to read files from the same parent directory by explicitly adding the --blueprint-may-read-adjacent-files option to your command.`);return a.read(l)}}])}default:throw new Error(`Unsupported blueprint file extension: ${s}. Only .zip and .json files are supported.`)}}class Be{constructor(o,t){this.lastProgressMessage="",this.args=o,this.siteUrl=t.siteUrl,this.processIdSpaceLength=t.processIdSpaceLength,this.phpVersion=o.php}getWorkerType(){return"v2"}async bootAndSetUpInitialPlayground(o,t,i){const s=x.consumeAPI(o);await s.useFileLockManager(t);const n={...this.args,phpVersion:this.phpVersion,siteUrl:this.siteUrl,firstProcessId:1,processIdSpaceLength:this.processIdSpaceLength,trace:this.args.debug||!1,blueprint:this.args.blueprint,withXdebug:!1,xdebug:void 0,nativeInternalDirPath:i};return await s.bootAndSetUpInitialWorker(n),s}async bootPlayground({worker:o,fileLockManagerPort:t,firstProcessId:i,nativeInternalDirPath:s}){const n=x.consumeAPI(o.phpPort);await n.useFileLockManager(t);const r={...this.args,phpVersion:this.phpVersion,siteUrl:this.siteUrl,firstProcessId:i,processIdSpaceLength:this.processIdSpaceLength,trace:this.args.debug||!1,withXdebug:!!this.args.xdebug,nativeInternalDirPath:s,mountsBeforeWpInstall:this.args["mount-before-install"]||[],mountsAfterWpInstall:this.args.mount||[]};return await n.bootWorker(r),n}writeProgressUpdate(o,t,i){t!==this.lastProgressMessage&&(this.lastProgressMessage=t,o.isTTY?(o.cursorTo(0),o.write(t),o.clearLine(1),i&&o.write(`
4
+ `)):o.write(`${t}
5
+ `))}}const Z=h.join(Y.homedir(),".wordpress-playground");async function Fe(e){return await re("https://github.com/WordPress/sqlite-database-integration/archive/refs/heads/develop.zip","sqlite.zip",e)}async function re(e,o,t){const i=h.join(Z,o);return j.existsSync(i)||(j.ensureDirSync(Z),await Me(e,i,t)),ne(i)}async function Me(e,o,t){const s=(await t.monitorFetch(fetch(e))).body.getReader(),n=`${o}.partial`,r=j.createWriteStream(n);for(;;){const{done:a,value:l}=await s.read();if(l&&r.write(l),a)break}r.close(),r.closed||await new Promise((a,l)=>{r.on("finish",()=>{j.renameSync(n,o),a(null)}),r.on("error",u=>{j.removeSync(n),l(u)})})}function ne(e,o){return new File([j.readFileSync(e)],h.basename(e))}class De{constructor(o,t){this.lastProgressMessage="",this.args=o,this.siteUrl=t.siteUrl,this.processIdSpaceLength=t.processIdSpaceLength}getWorkerType(){return"v1"}async bootAndSetUpInitialPlayground(o,t,i){let s;const n=new Q.EmscriptenDownloadMonitor;if(!this.args.skipWordPressSetup){let I=!1;n.addEventListener("progress",B=>{if(I)return;const{loaded:k,total:f}=B.detail,F=Math.floor(Math.min(100,100*k/f));I=F===100,this.writeProgressUpdate(process.stdout,`Downloading WordPress ${F}%...`,I)}),s=await Ie.resolveWordPressRelease(this.args.wp),m.logger.log(`Resolved WordPress release URL: ${s?.releaseUrl}`)}const r=s&&h.join(Z,`prebuilt-wp-content-for-wp-${s.version}.zip`),a=s?p.existsSync(r)?ne(r):await re(s.releaseUrl,`${s.version}.zip`,n):void 0;m.logger.log("Fetching SQLite integration plugin...");const l=this.args.skipSqliteSetup?void 0:await Fe(n),u=this.args.followSymlinks===!0,c=this.args.experimentalTrace===!0,d=this.args["mount-before-install"]||[],g=this.args.mount||[],b=x.consumeAPI(o);await b.isConnected(),m.logger.log("Booting WordPress...");const S=await W.resolveRuntimeConfiguration(this.getEffectiveBlueprint());return await b.useFileLockManager(t),await b.bootAndSetUpInitialWorker({phpVersion:S.phpVersion,wpVersion:S.wpVersion,siteUrl:this.siteUrl,mountsBeforeWpInstall:d,mountsAfterWpInstall:g,wordPressZip:a&&await a.arrayBuffer(),sqliteIntegrationPluginZip:await l?.arrayBuffer(),firstProcessId:0,processIdSpaceLength:this.processIdSpaceLength,followSymlinks:u,trace:c,internalCookieStore:this.args.internalCookieStore,withXdebug:!1,nativeInternalDirPath:i}),s&&!this.args["mount-before-install"]&&!p.existsSync(r)&&(m.logger.log("Caching preinstalled WordPress for the next boot..."),p.writeFileSync(r,await X.zipDirectory(b,"/wordpress")),m.logger.log("Cached!")),b}async bootPlayground({worker:o,fileLockManagerPort:t,firstProcessId:i,nativeInternalDirPath:s}){const n=x.consumeAPI(o.phpPort);await n.isConnected();const r=await W.resolveRuntimeConfiguration(this.getEffectiveBlueprint());return await n.useFileLockManager(t),await n.bootWorker({phpVersion:r.phpVersion,siteUrl:this.siteUrl,mountsBeforeWpInstall:this.args["mount-before-install"]||[],mountsAfterWpInstall:this.args.mount||[],firstProcessId:i,processIdSpaceLength:this.processIdSpaceLength,followSymlinks:this.args.followSymlinks===!0,trace:this.args.experimentalTrace===!0,internalCookieStore:this.args.internalCookieStore,withXdebug:!!this.args.xdebug,nativeInternalDirPath:s}),await n.isReady(),n}async compileInputBlueprint(o){const t=this.getEffectiveBlueprint(),i=new Q.ProgressTracker;let s="",n=!1;return i.addEventListener("progress",r=>{if(n)return;n=r.detail.progress===100;const a=Math.floor(r.detail.progress);s=r.detail.caption||s||"Running the Blueprint";const l=`${s.trim()} – ${a}%`;this.writeProgressUpdate(process.stdout,l,n)}),await W.compileBlueprintV1(t,{progress:i,additionalSteps:o})}getEffectiveBlueprint(){const o=this.args.blueprint;return W.isBlueprintBundle(o)?o:{login:this.args.login,...o||{},preferredVersions:{php:this.args.php??o?.preferredVersions?.php??X.RecommendedPHPVersion,wp:this.args.wp??o?.preferredVersions?.wp??"latest",...o?.preferredVersions||{}}}}writeProgressUpdate(o,t,i){this.args.verbosity!==q.Quiet.name&&t!==this.lastProgressMessage&&(this.lastProgressMessage=t,o.isTTY?(o.cursorTo(0),o.write(t),o.clearLine(1),i&&o.write(`
6
+ `)):o.write(`${t}
7
+ `))}}async function Ae(e,o=!0){const i=`${h.basename(process.argv0)}${e}${process.pid}-`,s=await ee.dir({prefix:i,unsafeCleanup:!0});return o&&ee.setGracefulCleanup(),s}async function Ue(e,o,t){const s=(await qe(e,o,t)).map(n=>new Promise(r=>{p.rm(n,{recursive:!0},a=>{a?m.logger.warn(`Failed to delete stale Playground temp dir: ${n}`,a):m.logger.info(`Deleted stale Playground temp dir: ${n}`),r()})}));await Promise.all(s)}async function qe(e,o,t){try{const i=p.readdirSync(t).map(n=>h.join(t,n)),s=[];for(const n of i)await Ne(e,o,n)&&s.push(n);return s}catch(i){return m.logger.warn(`Failed to find stale Playground temp dirs: ${i}`),[]}}async function Ne(e,o,t){if(!p.lstatSync(t).isDirectory())return!1;const s=h.basename(t);if(!s.includes(e))return!1;const n=s.match(new RegExp(`^(.+)${e}(\\d+)-`));if(!n)return!1;const r={executableName:n[1],pid:n[2]};if(await Ve(r.pid,r.executableName))return!1;const a=Date.now()-o;return p.statSync(t).mtime.getTime()<a}async function Ve(e,o){const[t]=await new Promise((i,s)=>{Ee.list({pid:e,name:o,clean:!0},(n,r)=>{n?s(n):i(r)})});return!!t&&t.pid===e&&t.command===o}async function _e(e,o,t){const i=t==="win32"?"junction":"dir";p.symlinkSync(e,o,i)}async function Oe(e){try{p.lstatSync(e).isSymbolicLink()&&p.unlinkSync(e)}catch{}}function He(e,o){return o.filter(t=>{const i=h.resolve(t.hostPath),s=h.join(e,h.sep);return i===e||i.startsWith(s)})}const E={ignoreAttributes:!1,attributeNamePrefix:"",preserveOrder:!0,cdataPropName:"__cdata",commentPropName:"__xmlComment",allowBooleanAttributes:!0,trimValues:!0},ie={ignoreAttributes:E.ignoreAttributes,attributeNamePrefix:E.attributeNamePrefix,preserveOrder:E.preserveOrder,cdataPropName:E.cdataPropName,commentPropName:E.commentPropName,suppressBooleanAttributes:!E.allowBooleanAttributes,format:!0,indentBy:" "},U={allowEmptyContent:!0,allowTrailingComma:!0};function ze(e,o){const{name:t,host:i,port:s,mappings:n,ideKey:r}=o,a=new A.XMLParser(E),l=(()=>{try{return a.parse(e,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),u={server:[{path_mappings:n.map(f=>({mapping:[],":@":{"local-root":`$PROJECT_DIR$/${ae(h.relative(o.projectDir,f.hostPath))}`,"remote-root":f.vfsPath}}))}],":@":{name:t,host:`${i}:${s}`,use_path_mappings:"true"}};let c=l?.find(f=>!!f?.project);if(c){const f=c[":@"]?.version;if(f===void 0)throw new Error('PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but the <project> configuration has no version number.');if(f!=="4")throw new Error(`PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but we found a <project> configuration with version "${f}".`)}c===void 0&&(c={project:[],":@":{version:"4"}},l.push(c));let d=c.project?.find(f=>!!f?.component&&f?.[":@"]?.name==="PhpServers");d===void 0&&(d={component:[],":@":{name:"PhpServers"}},c.project===void 0&&(c.project=[]),c.project.push(d));let g=d.component?.find(f=>!!f?.servers);g===void 0&&(g={servers:[]},d.component===void 0&&(d.component=[]),d.component.push(g));const b=g.servers?.findIndex(f=>!!f?.server&&f?.[":@"]?.name===t);(b===void 0||b<0)&&(g.servers===void 0&&(g.servers=[]),g.servers.push(u));let S=c.project?.find(f=>!!f?.component&&f?.[":@"]?.name==="RunManager");if(S===void 0&&(S={component:[],":@":{name:"RunManager"}},c.project===void 0&&(c.project=[]),c.project.push(S)),(S.component?.findIndex(f=>!!f?.configuration&&f?.[":@"]?.name===t)??-1)<0){const f={configuration:[{method:[],":@":{v:"2"}}],":@":{name:t,type:"PhpRemoteDebugRunConfigurationType",factoryName:"PHP Remote Debug",filter_connections:"FILTER",server_name:t,session_id:r}};S.component===void 0&&(S.component=[]),S.component.push(f)}const k=new A.XMLBuilder(ie).build(l);try{a.parse(k,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}return k}function Xe(e,o){const{name:t,mappings:i}=o,s=[];let n=e,r=v.parseTree(n,s,U);if(r===void 0||s.length)throw new Error("VS Code configuration file is not valid JSON.");let a=v.findNodeAtLocation(r,["configurations"]);if(a===void 0||a.children===void 0){const u=v.modify(n,["configurations"],[],{});n=v.applyEdits(n,u),r=v.parseTree(n,[],U),a=v.findNodeAtLocation(r,["configurations"])}const l=a?.children?.findIndex(u=>v.findNodeAtLocation(u,["name"])?.value===t);if(l===void 0||l<0){const u={name:t,type:"php",request:"launch",port:9003,pathMappings:i.reduce((g,b)=>(g[b.vfsPath]=`\${workspaceFolder}/${ae(h.relative(o.workspaceDir,b.hostPath))}`,g),{})},c=a?.children?.length||0,d=v.modify(n,["configurations",c],u,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
8
+ `}});n=se(n,d)}return n}async function Je({name:e,ides:o,host:t,port:i,cwd:s,mounts:n,ideKey:r="PLAYGROUNDCLI"}){const a=He(s,n),l=[];if(o.includes("phpstorm")){const u=".idea/workspace.xml",c=h.join(s,u);if(!p.existsSync(c)){if(p.existsSync(h.dirname(c)))p.writeFileSync(c,`<?xml version="1.0" encoding="UTF-8"?>
9
+ <project version="4">
10
+ </project>`);else if(o.length==1)throw new Error("PhpStorm IDE integration requested, but no '.idea' directory was found in the current working directory.")}if(p.existsSync(c)){const d=p.readFileSync(c,"utf8"),g=ze(d,{name:e,host:t,port:i,projectDir:s,mappings:a,ideKey:r});p.writeFileSync(c,g)}l.push(u)}if(o.includes("vscode")){const u=".vscode/launch.json",c=h.join(s,u);if(!p.existsSync(c)){if(p.existsSync(h.dirname(c)))p.writeFileSync(c,`{
11
+ "configurations": []
12
+ }`);else if(o.length==1)throw new Error("VS Code IDE integration requested, but no '.vscode' directory was found in the current working directory.")}if(p.existsSync(c)){const d=p.readFileSync(c,"utf-8"),g=Xe(d,{name:e,workspaceDir:s,mappings:a});g!==d&&(p.writeFileSync(c,g),l.push(u))}}return l}async function Ze(e,o){const t=h.join(o,".idea/workspace.xml");if(p.existsSync(t)){const s=p.readFileSync(t,"utf8"),n=new A.XMLParser(E),r=(()=>{try{return n.parse(s,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),u=r.find(d=>!!d?.project)?.project?.find(d=>!!d?.component&&d?.[":@"]?.name==="PhpServers")?.component?.find(d=>!!d?.servers),c=u?.servers?.findIndex(d=>!!d?.server&&d?.[":@"]?.name===e);if(c!==void 0&&c>=0){u.servers.splice(c,1);const g=new A.XMLBuilder(ie).build(r);try{n.parse(g,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}g===`<?xml version="1.0" encoding="UTF-8"?>
13
+ <project version="4">
14
+ <component name="PhpServers">
15
+ <servers></servers>
16
+ </component>
17
+ </project>`?p.unlinkSync(t):p.writeFileSync(t,g)}}const i=h.join(o,".vscode/launch.json");if(p.existsSync(i)){const s=[],n=p.readFileSync(i,"utf-8"),r=v.parseTree(n,s,U);if(r===void 0||s.length)throw new Error("VS Code configuration file is not valid JSON.");const l=v.findNodeAtLocation(r,["configurations"])?.children?.findIndex(u=>v.findNodeAtLocation(u,["name"])?.value===e);if(l!==void 0&&l>=0){const u=v.modify(n,["configurations",l],void 0,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
18
+ `}}),c=se(n,u);c===`{
19
+ "configurations": []
20
+ }`?p.unlinkSync(i):p.writeFileSync(i,c)}}}function se(e,o){const t=[],i=v.applyEdits(e,o);if(t.length=0,v.parseTree(i,t,U),t.length){const s=t.map(r=>({message:v.printParseErrorCode(r.error),offset:r.offset,length:r.length,fragment:i.slice(Math.max(0,r.offset-20),Math.min(i.length,r.offset+r.length+10))})).map(r=>`${r.message} at ${r.offset}:${r.length} (${r.fragment})`),n=o.map(r=>`At ${r.offset}:${r.length} - (${r.content})`);throw new Error(`VS Code configuration file (.vscode/launch.json) is not valid a JSONC after Playground CLI modifications. This is likely a Playground CLI bug. Please report it at https://github.com/WordPress/wordpress-playground/issues and include the contents of your ".vscode/launch.json" file.
21
+
22
+ Applied edits: ${n.join(`
23
+ `)}
24
+
25
+ The errors are: ${s.join(`
26
+ `)}`)}return i}function ae(e){return e.replaceAll(h.sep,h.posix.sep)}const q={Quiet:{name:"quiet",severity:m.LogSeverity.Fatal},Normal:{name:"normal",severity:m.LogSeverity.Info},Debug:{name:"debug",severity:m.LogSeverity.Debug}};async function Ye(){try{const e=xe(process.argv.slice(2)).usage("Usage: wp-playground <command> [options]").positional("command",{describe:"Command to run",choices:["server","run-blueprint","build-snapshot"],demandOption:!0}).option("outfile",{describe:"When building, write to this output file.",type:"string",default:"wordpress.zip"}).option("port",{describe:"Port to listen on when serving.",type:"number",default:9400}).option("site-url",{describe:"Site URL to use for WordPress. Defaults to http://127.0.0.1:{port}",type:"string"}).option("php",{describe:"PHP version to use.",type:"string",default:X.RecommendedPHPVersion,choices:x.SupportedPHPVersions}).option("wp",{describe:"WordPress version to use.",type:"string",default:"latest"}).option("mount",{describe:"Mount a directory to the PHP runtime (can be used multiple times). Format: /host/path:/vfs/path",type:"array",string:!0,coerce:M.parseMountWithDelimiterArguments}).option("mount-before-install",{describe:"Mount a directory to the PHP runtime before WordPress installation (can be used multiple times). Format: /host/path:/vfs/path",type:"array",string:!0,coerce:M.parseMountWithDelimiterArguments}).option("mount-dir",{describe:'Mount a directory to the PHP runtime (can be used multiple times). Format: "/host/path" "/vfs/path"',type:"array",nargs:2,array:!0,coerce:M.parseMountDirArguments}).option("mount-dir-before-install",{describe:'Mount a directory before WordPress installation (can be used multiple times). Format: "/host/path" "/vfs/path"',type:"string",nargs:2,array:!0,coerce:M.parseMountDirArguments}).option("login",{describe:"Should log the user in",type:"boolean",default:!1}).option("blueprint",{describe:"Blueprint to execute.",type:"string"}).option("blueprint-may-read-adjacent-files",{describe:'Consent flag: Allow "bundled" resources in a local blueprint to read files in the same directory as the blueprint file.',type:"boolean",default:!1}).option("skip-wordpress-setup",{describe:"Do not download, unzip, and install WordPress. Useful for mounting a pre-configured WordPress directory at /wordpress.",type:"boolean",default:!1}).option("skip-sqlite-setup",{describe:"Skip the SQLite integration plugin setup to allow the WordPress site to use MySQL.",type:"boolean",default:!1}).option("quiet",{describe:"Do not output logs and progress messages.",type:"boolean",default:!1,hidden:!0}).option("verbosity",{describe:"Output logs and progress messages.",type:"string",choices:Object.values(q).map(r=>r.name),default:"normal"}).option("debug",{describe:"Print PHP error log content if an error occurs during Playground boot.",type:"boolean",default:!1}).option("auto-mount",{describe:"Automatically mount the specified directory. If no path is provided, mount the current working directory. You can mount a WordPress directory, a plugin directory, a theme directory, a wp-content directory, or any directory containing PHP and HTML files.",type:"string"}).option("follow-symlinks",{describe:`Allow Playground to follow symlinks by automatically mounting symlinked directories and files encountered in mounted directories.
27
+ Warning: Following symlinks will expose files outside mounted directories to Playground and could be a security risk.`,type:"boolean",default:!1}).option("experimental-trace",{describe:"Print detailed messages about system behavior to the console. Useful for troubleshooting.",type:"boolean",default:!1,hidden:!0}).option("internal-cookie-store",{describe:"Enable internal cookie handling. When enabled, Playground will manage cookies internally using an HttpCookieStore that persists cookies across requests. When disabled, cookies are handled externally (e.g., by a browser in Node.js environments).",type:"boolean",default:!1}).option("xdebug",{describe:"Enable Xdebug.",type:"boolean",default:!1}).option("experimental-unsafe-ide-integration",{describe:"Enable experimental IDE development tools. This option edits IDE config files to set Xdebug path mappings and web server details. CAUTION: If there are bugs, this feature may break your IDE config files. Please consider backing up your IDE configs before using this feature.",type:"string",choices:["","vscode","phpstorm"],coerce:r=>r===""?["vscode","phpstorm"]:[r]}).option("experimental-devtools",{describe:"Enable experimental browser development tools.",type:"boolean"}).conflicts("experimental-unsafe-ide-integration","experimental-devtools").option("experimental-multi-worker",{describe:"Enable experimental multi-worker support which requires a /wordpress directory backed by a real filesystem. Pass a positive number to specify the number of workers to use. Otherwise, default to the number of CPUs minus 1.",type:"number",coerce:r=>r??Y.cpus().length-1}).option("experimental-blueprints-v2-runner",{describe:"Use the experimental Blueprint V2 runner.",type:"boolean",default:!1,hidden:!0}).option("mode",{describe:"Blueprints v2 runner mode to use. This option is required when using the --experimental-blueprints-v2-runner flag with a blueprint.",type:"string",choices:["create-new-site","apply-to-existing-site"],hidden:!0}).showHelpOnFail(!1).strictOptions().check(async r=>{if((r["skip-wordpress-setup"]||r.skipWordpressSetup)&&(r.skipWordPressSetup=!0),r.wp!==void 0&&!We(r.wp))try{new URL(r.wp)}catch{throw new Error('Unrecognized WordPress version. Please use "latest", a URL, or a numeric version such as "6.2", "6.0.1", "6.2-beta1", or "6.2-RC1"')}if(r["site-url"]!==void 0&&r["site-url"]!=="")try{new URL(r["site-url"])}catch{throw new Error(`Invalid site-url "${r["site-url"]}". Please provide a valid URL (e.g., http://localhost:8080 or https://example.com)`)}if(r["auto-mount"]){let a=!1;try{a=p.statSync(r["auto-mount"]).isDirectory()}catch{a=!1}if(!a)throw new Error(`The specified --auto-mount path is not a directory: '${r["auto-mount"]}'.`)}if(r["experimental-multi-worker"]!==void 0&&r["experimental-multi-worker"]<=1)throw new Error("The --experimental-multi-worker flag must be a positive integer greater than 1.");if(r["experimental-blueprints-v2-runner"]===!0){if(r.mode!==void 0){if("skip-wordpress-setup"in r)throw new Error("The --skipWordPressSetup option cannot be used with the --mode option. Use one or the other.");if("skip-sqlite-setup"in r)throw new Error("The --skipSqliteSetup option is not supported in Blueprint V2 mode.");if(r["auto-mount"]!==void 0)throw new Error("The --mode option cannot be used with --auto-mount because --auto-mount automatically sets the mode.")}else r["skip-wordpress-setup"]===!0?r.mode="apply-to-existing-site":r.mode="create-new-site";const a=r.allow||[];r.followSymlinks===!0&&a.push("follow-symlinks"),r["blueprint-may-read-adjacent-files"]===!0&&a.push("read-local-fs"),r.allow=a}else if(r.mode!==void 0)throw new Error("The --mode option requires the --experimentalBlueprintsV2Runner flag.");return!0});e.wrap(e.terminalWidth());const o=await e.argv,t=o._[0];["run-blueprint","server","build-snapshot"].includes(t)||(e.showHelp(),process.exit(1));const i={...o,command:t,mount:[...o.mount||[],...o["mount-dir"]||[]],"mount-before-install":[...o["mount-before-install"]||[],...o["mount-dir-before-install"]||[]]},s=await le(i);s===void 0&&process.exit(0);const n=(()=>{let r;return async()=>{r!==void 0&&(r=s[Symbol.asyncDispose]()),await r,process.exit(0)}})();process.on("SIGINT",n),process.on("SIGTERM",n)}catch(e){if(!(e instanceof Error))throw e;if(process.argv.includes("--debug"))x.printDebugDetails(e);else{const t=[];let i=e;do t.push(i.message),i=i.cause;while(i instanceof Error);console.error("\x1B[1m"+t.join(" caused by ")+"\x1B[0m")}process.exit(1)}}const H=e=>process.stdout.isTTY?"\x1B[1m"+e+"\x1B[0m":e,Ge=e=>process.stdout.isTTY?`\x1B[2m${e}\x1B[0m`:e,z=e=>process.stdout.isTTY?`\x1B[3m${e}\x1B[0m`:e,te=e=>process.stdout.isTTY?`\x1B[33m${e}\x1B[0m`:e;async function le(e){let o,t;const i=[];if(e.autoMount!==void 0&&(e.autoMount===""&&(e={...e,autoMount:process.cwd()}),e=M.expandAutoMounts(e)),e.quiet&&(e.verbosity="quiet",delete e.quiet),e.debug?e.verbosity="debug":e.verbosity==="debug"&&(e.debug=!0),e.verbosity){const l=Object.values(q).find(u=>u.name===e.verbosity).severity;m.logger.setSeverityFilterLevel(l)}const s=Y.platform()==="win32"?void 0:await import("fs-ext").then(l=>l.flockSync).catch(()=>{m.logger.warn("The fs-ext package is not installed. Internal file locking will not be integrated with host OS file locking.")}),n=new Se.FileLockManagerForNode(s);let r=!1,a=!0;return m.logger.log("Starting a PHP server..."),Le({port:e.port,onBind:async(l,u)=>{const c="127.0.0.1",d=`http://${c}:${u}`,g=e["site-url"]||d,b=e.experimentalMultiWorker??1,S=b+1,I=Math.floor(Number.MAX_SAFE_INTEGER/S),B="-playground-cli-site-",k=await Ae(B);m.logger.debug(`Native temp dir for VFS root: ${k.path}`);const f="WP Playground CLI - Listen for Xdebug",F=".playground-xdebug-root",G=h.join(process.cwd(),F);if(await Oe(G),e.xdebug&&e.experimentalUnsafeIdeIntegration){await _e(k.path,G,process.platform);const w={hostPath:h.join(".",h.sep,F),vfsPath:"/"};try{await Ze(f,process.cwd());const y=typeof e.xdebug=="object"?e.xdebug:void 0,T=await Je({name:f,host:c,port:u,ides:e.experimentalUnsafeIdeIntegration,cwd:process.cwd(),mounts:[w,...e["mount-before-install"]||[],...e.mount||[]],ideKey:y?.ideKey}),P=e.experimentalUnsafeIdeIntegration,C=P.includes("vscode"),L=P.includes("phpstorm");console.log(""),console.log(H("Xdebug configured successfully")),console.log(te("Updated IDE config: ")+T.join(" ")),console.log(te("Playground source root: ")+".playground-xdebug-root"+z(Ge(" – you can set breakpoints and preview Playground's VFS structure in there."))),console.log(""),C&&(console.log(H("VS Code / Cursor instructions:")),console.log(" 1. Open the Run and Debug panel on the left sidebar"),console.log(` 2. Select "${z(f)}" from the dropdown`),console.log(' 3. Click "start debugging"'),console.log(" 4. Set a breakpoint. For example, in .playground-xdebug-root/wordpress/index.php"),console.log(" 5. Visit Playground in your browser to hit the breakpoint"),L&&console.log("")),L&&(console.log(H("PhpStorm instructions:")),console.log(` 1. Choose "${z(f)}" debug configuration in the toolbar`),console.log(" 2. Click the debug button (bug icon)`"),console.log(" 3. Set a breakpoint. For example, in .playground-xdebug-root/wordpress/index.php"),console.log(" 4. Visit Playground in your browser to hit the breakpoint")),console.log("")}catch(y){throw new Error("Could not configure Xdebug",{cause:y})}}const ce=h.dirname(k.path),ue=2*24*60*60*1e3;Ue(B,ue,ce);const N=h.join(k.path,"internal");p.mkdirSync(N);const pe=["wordpress","tmp","home"];for(const w of pe){const y=P=>P.vfsPath===`/${w}`;if(!(e["mount-before-install"]?.some(y)||e.mount?.some(y))){const P=h.join(k.path,w);p.mkdirSync(P),e["mount-before-install"]===void 0&&(e["mount-before-install"]=[]),e["mount-before-install"].unshift({vfsPath:`/${w}`,hostPath:P})}}if(e["mount-before-install"])for(const w of e["mount-before-install"])m.logger.debug(`Mount before WP install: ${w.vfsPath} -> ${w.hostPath}`);if(e.mount)for(const w of e.mount)m.logger.debug(`Mount after WP install: ${w.vfsPath} -> ${w.hostPath}`);let R;e["experimental-blueprints-v2-runner"]?R=new Be(e,{siteUrl:g,processIdSpaceLength:I}):(R=new De(e,{siteUrl:g,processIdSpaceLength:I}),typeof e.blueprint=="string"&&(e.blueprint=await je({sourceString:e.blueprint,blueprintMayReadAdjacentFiles:e["blueprint-may-read-adjacent-files"]===!0})));let V=!1;const _=async function(){V||(V=!0,await Promise.all(i.map(async({playground:y,worker:T})=>{await y.dispose(),await T.terminate()})),l&&await new Promise(y=>l.close(y)),await k.cleanup())},de=Ke(S,R.getWorkerType(),({exitCode:w,workerIndex:y})=>{V||w===0&&m.logger.error(`Worker ${y} exited with code ${w}
28
+ `)});m.logger.log(`Setting up WordPress ${e.wp}`);try{const w=await de,y=await oe(n);{const P=w.shift(),C=await R.bootAndSetUpInitialPlayground(P.phpPort,y,N);if(await C.isReady(),r=!0,m.logger.log("Booted!"),o=new $e(C),!e["experimental-blueprints-v2-runner"]){const L=await R.compileInputBlueprint(e["additional-blueprint-steps"]||[]);L&&(m.logger.log("Running the Blueprint..."),await W.runBlueprintV1Steps(L,C),m.logger.log("Finished running the blueprint"))}if(e.command==="build-snapshot"){await et(t,e.outfile),m.logger.log(`WordPress exported to ${e.outfile}`),await _();return}else if(e.command==="run-blueprint"){m.logger.log("Blueprint executed"),await _();return}await o.removeWorker(C),await C.dispose(),await P.worker.terminate()}m.logger.log("Preparing workers...");const T=I;return[t]=await Promise.all(w.map(async(P,C)=>{const L=T+C*I,fe=await oe(n),O=await R.bootPlayground({worker:P,fileLockManagerPort:fe,firstProcessId:L,nativeInternalDirPath:N});return i.push({playground:O,worker:P.worker}),o.addWorker(O),O})),m.logger.log(`WordPress is running on ${d} with ${b} worker(s)`),e.xdebug&&e.experimentalDevtools&&(await Ce.startBridge({phpInstance:t,phpRoot:"/wordpress"})).start(),{playground:t,server:l,serverUrl:d,[Symbol.asyncDispose]:_,workerThreadCount:b}}catch(w){if(!e.debug)throw w;let y="";throw await t?.fileExists(m.errorLogPath)&&(y=await t.readFileAsText(m.errorLogPath)),new Error(y,{cause:w})}},async handleRequest(l){if(!r)return x.PHPResponse.forHttpCode(502,"WordPress is not ready yet");if(a){a=!1;const u={"Content-Type":["text/plain"],"Content-Length":["0"],Location:[l.url]};return l.headers?.cookie?.includes("playground_auto_login_already_happened")&&(u["Set-Cookie"]=["playground_auto_login_already_happened=1; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/"]),new x.PHPResponse(302,u,new Uint8Array)}return await o.handleRequest(l)}})}async function Ke(e,o,t){const i=[];for(let s=0;s<e;s++){const n=await Qe(o),r=a=>{t({exitCode:a,workerIndex:s})};i.push(new Promise((a,l)=>{n.once("message",function(u){u.command==="worker-script-initialized"&&a({worker:n,phpPort:u.phpPort})}),n.once("error",function(u){console.error(u);const c=new Error(`Worker failed to load worker. ${u.message?`Original error: ${u.message}`:""}`);l(c)}),n.once("exit",r)}))}return Promise.all(i)}async function Qe(e){return e==="v1"?new J.Worker(new URL("./worker-thread-v1.cjs",typeof document>"u"?require("url").pathToFileURL(__filename).href:$&&$.tagName.toUpperCase()==="SCRIPT"&&$.src||new URL("run-cli-4UcAoCNX.cjs",document.baseURI).href)):new J.Worker(new URL("./worker-thread-v2.cjs",typeof document>"u"?require("url").pathToFileURL(__filename).href:$&&$.tagName.toUpperCase()==="SCRIPT"&&$.src||new URL("run-cli-4UcAoCNX.cjs",document.baseURI).href))}async function oe(e){const{port1:o,port2:t}=new J.MessageChannel;return await ke.jspi()?x.exposeAPI(e,null,o):await x.exposeSyncAPI(e,o),t}async function et(e,o){await e.run({code:`<?php
29
+ $zip = new ZipArchive();
30
+ if(false === $zip->open('/tmp/build.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE)) {
31
+ throw new Exception('Failed to create ZIP');
32
+ }
33
+ $files = new RecursiveIteratorIterator(
34
+ new RecursiveDirectoryIterator('/wordpress')
35
+ );
36
+ foreach ($files as $file) {
37
+ echo $file . PHP_EOL;
38
+ if (!$file->isFile()) {
39
+ continue;
40
+ }
41
+ $zip->addFile($file->getPathname(), $file->getPathname());
42
+ }
43
+ $zip->close();
44
+
45
+ `});const t=await e.readFileAsBuffer("/tmp/build.zip");p.writeFileSync(o,t)}exports.LogVerbosity=q;exports.parseOptionsAndRunCLI=Ye;exports.runCLI=le;
46
+ //# sourceMappingURL=run-cli-4UcAoCNX.cjs.map