@wp-playground/cli 3.1.0 → 3.1.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/cli.cjs +1 -1
- package/cli.js +1 -1
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/package.json +14 -14
- package/{run-cli-CIkDrr7x.cjs → run-cli-D-GS-Yv7.cjs} +6 -6
- package/{run-cli-CIkDrr7x.cjs.map → run-cli-D-GS-Yv7.cjs.map} +1 -1
- package/{run-cli-BzYAH0YF.js → run-cli-FHDubnX7.js} +27 -27
- package/{run-cli-BzYAH0YF.js.map → run-cli-FHDubnX7.js.map} +1 -1
- package/worker-thread-v1.cjs +1 -1
- package/worker-thread-v1.js +1 -1
- package/worker-thread-v2.cjs +1 -1
- package/worker-thread-v2.js +1 -1
package/worker-thread-v1.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@php-wasm/node"),f=require("@php-wasm/progress"),n=require("@php-wasm/universal"),b=require("@php-wasm/util"),I=require("@wp-playground/common"),u=require("@wp-playground/wordpress"),q=require("tls"),P=require("worker_threads"),i=require("./run-cli-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@php-wasm/node"),f=require("@php-wasm/progress"),n=require("@php-wasm/universal"),b=require("@php-wasm/util"),I=require("@wp-playground/common"),u=require("@wp-playground/wordpress"),q=require("tls"),P=require("worker_threads"),i=require("./run-cli-D-GS-Yv7.cjs"),W=require("@php-wasm/logger");function R(r,e,...t){console.log(performance.now().toFixed(6).padStart(15,"0"),r.toString().padStart(16,"0"),b.sprintf(e,...t))}class w extends n.PHPWorker{constructor(e){super(void 0,e),this.bootedRequestHandler=!1,this.bootedWordPress=!1}async useFileLockManager(e){this.fileLockManager=await n.consumeAPISync(e)}async bootWordPress(e,t){if(this.bootedWordPress)throw new Error("WordPress already booted");this.bootedWordPress=!0;const{siteUrl:s,wordpressInstallMode:o,wordPressZip:c,sqliteIntegrationPluginZip:d,dataSqlPath:m,constants:y}=e;try{await u.bootWordPress(this.__internal_getRequestHandler(),{siteUrl:s,wordpressInstallMode:o,wordPressZip:c!==void 0?new File([c],"wordpress.zip"):void 0,sqliteIntegrationPluginZip:d!==void 0?new File([d],"sqlite-integration-plugin.zip"):void 0,createFiles:{"/internal/shared/ca-bundle.crt":q.rootCertificates.join(`
|
|
2
2
|
`)},phpIniEntries:{"openssl.cafile":"/internal/shared/ca-bundle.crt",allow_url_fopen:"1",disable_functions:""},dataSqlPath:m,constants:y});const a=n.consumeAPI(t);await a.applyPostInstallMountsToAllWorkers(),a[n.releaseApiProxy](),h()}catch(a){throw p(a),a}}async bootRequestHandler(e){if(this.bootedRequestHandler)throw new Error("Playground already booted");this.bootedRequestHandler=!0;try{const t=await u.bootRequestHandler({siteUrl:e.siteUrl,maxPhpInstances:1,createPhpRuntime:k(e,this.fileLockManager),onPHPInstanceCreated:async o=>{await i.mountResources(o,e.mountsBeforeWpInstall),this.bootedWordPress&&await i.mountResources(o,e.mountsAfterWpInstall)},sapiName:"cli",cookieStore:!1,pathAliases:e.pathAliases,spawnHandler:()=>n.sandboxedSpawnHandlerFactory(()=>{let o=e;return this.bootedWordPress||(o={...e,mountsAfterWpInstall:[]}),H(o,this.fileLockManager)})});this.__internal_setRequestHandler(t);const s=await t.getPrimaryPhp();await this.setPrimaryPHP(s),h()}catch(t){throw p(t),t}}async mountAfterWordPressInstall(e){this.bootedWordPress=!0,await i.mountResources(this.__internal_getPHP(),e)}async dispose(){await this[Symbol.asyncDispose]()}}function k(r,e){return async()=>await g.loadNodeRuntime(r.phpVersion||I.RecommendedPHPVersion,{fileLockManager:e,emscriptenOptions:{processId:r.processId,trace:r.trace?R:void 0,nativeInternalDirPath:r.nativeInternalDirPath},followSymlinks:r.followSymlinks,withIntl:r.withIntl,withRedis:r.withRedis,withMemcached:r.withMemcached,withXdebug:r.withXdebug})}async function H(r,e){const t=await i.spawnWorkerThread("v1"),s=n.consumeAPI(t.phpPort);return s.useFileLockManager(e),await s.bootRequestHandler({...r,processId:t.processId}),{php:s,reap:()=>{try{s.dispose()}catch{}try{t.worker.terminate()}catch{}}}}process.on("unhandledRejection",r=>{W.logger.error("Unhandled rejection:",r)});const l=new P.MessageChannel,[h,p]=n.exposeAPI(new w(new f.EmscriptenDownloadMonitor),void 0,l.port1);P.parentPort?.postMessage({command:"worker-script-initialized",phpPort:l.port2},[l.port2]);exports.PlaygroundCliBlueprintV1Worker=w;
|
|
3
3
|
//# sourceMappingURL=worker-thread-v1.cjs.map
|
package/worker-thread-v1.js
CHANGED
|
@@ -6,7 +6,7 @@ import { RecommendedPHPVersion as H } from "@wp-playground/common";
|
|
|
6
6
|
import { bootWordPress as R, bootRequestHandler as k } from "@wp-playground/wordpress";
|
|
7
7
|
import { rootCertificates as q } from "tls";
|
|
8
8
|
import { MessageChannel as A, parentPort as M } from "worker_threads";
|
|
9
|
-
import { a as n, s as _ } from "./run-cli-
|
|
9
|
+
import { a as n, s as _ } from "./run-cli-FHDubnX7.js";
|
|
10
10
|
import { logger as v } from "@php-wasm/logger";
|
|
11
11
|
function S(t, e, ...r) {
|
|
12
12
|
console.log(
|
package/worker-thread-v2.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("@php-wasm/logger"),m=require("@php-wasm/node"),$=require("@php-wasm/progress"),n=require("@php-wasm/universal"),x=require("@php-wasm/util"),S=require("@wp-playground/blueprints"),W=require("@wp-playground/wordpress"),A=require("fs"),y=require("path"),B=require("tls"),R=require("worker_threads"),T=require("./run-cli-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("@php-wasm/logger"),m=require("@php-wasm/node"),$=require("@php-wasm/progress"),n=require("@php-wasm/universal"),x=require("@php-wasm/util"),S=require("@wp-playground/blueprints"),W=require("@wp-playground/wordpress"),A=require("fs"),y=require("path"),B=require("tls"),R=require("worker_threads"),T=require("./run-cli-D-GS-Yv7.cjs");async function g(s,e){for(const t of e)try{s.mkdir(t.vfsPath),await s.mount(t.vfsPath,m.createNodeFsMountHandler(t.hostPath))}catch{i.stderr(`\x1B[31m\x1B[1mError mounting path ${t.hostPath} at ${t.vfsPath}\x1B[0m
|
|
2
2
|
`),process.exit(1)}}function C(s,e,...t){console.log(performance.now().toFixed(6).padStart(15,"0"),s.toString().padStart(16,"0"),x.sprintf(e,...t))}Object.defineProperty(process.stdout,"isTTY",{value:!0});Object.defineProperty(process.stderr,"isTTY",{value:!0});const i={lastWriteWasProgress:!1,progress(s){T.shouldRenderProgress(process.stdout)&&(process.stdout.isTTY?(i.lastWriteWasProgress||process.stdout.write(`
|
|
3
3
|
`),process.stdout.write("\r\x1B[K"+s),i.lastWriteWasProgress=!0):console.log(s))},stdout(s){process.stdout.write(`
|
|
4
4
|
|
package/worker-thread-v2.js
CHANGED
|
@@ -9,7 +9,7 @@ import { existsSync as G } from "fs";
|
|
|
9
9
|
import m from "path";
|
|
10
10
|
import { rootCertificates as Y } from "tls";
|
|
11
11
|
import { MessageChannel as z, parentPort as K } from "worker_threads";
|
|
12
|
-
import { s as J, b as Q } from "./run-cli-
|
|
12
|
+
import { s as J, b as Q } from "./run-cli-FHDubnX7.js";
|
|
13
13
|
async function b(s, e) {
|
|
14
14
|
for (const t of e)
|
|
15
15
|
try {
|