diff --git a/.nvmrc b/.nvmrc index 0e9dc6b5..bb52a169 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v18.13.0 +v18.18.2 diff --git a/package-lock.json b/package-lock.json index 636d18f4..38753c3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,13 +27,13 @@ "@codemirror/state": "6.2.0", "@codemirror/theme-one-dark": "6.1.1", "@codemirror/view": "6.9.3", - "@php-wasm/node": "0.1.56", - "@php-wasm/progress": "0.1.56", - "@php-wasm/universal": "0.1.56", - "@php-wasm/web": "0.1.57", + "@php-wasm/node": "0.5.4", + "@php-wasm/progress": "0.5.4", + "@php-wasm/universal": "0.5.4", + "@php-wasm/web": "0.5.4", "@uiw/react-codemirror": "^4.21.20", - "@wp-playground/blueprints": "0.1.56", - "@wp-playground/client": "0.2.0", + "@wp-playground/blueprints": "0.5.4", + "@wp-playground/client": "0.5.4", "classnames": "^2.3.2", "comlink": "^4.4.1", "compressible": "2.0.18", @@ -9792,37 +9792,93 @@ } }, "node_modules/@php-wasm/node": { - "version": "0.1.56", - "resolved": "https://registry.npmjs.org/@php-wasm/node/-/node-0.1.56.tgz", - "integrity": "sha512-HcIPR8QnBgNsgys+msHktUICG+ENNn3Xt6kjP1OJKA0Yi/Y9bATEe8DJx3RiPyrVDJsb8WLKB+aWq9KVXl8x8w==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@php-wasm/node/-/node-0.5.4.tgz", + "integrity": "sha512-ifYWwyyI7hlHipVVVFnexyJ5s8qBAXW1wFyOwXXgNWUgAuvnEzl0uWYHoP4C2E/ZiJ6sHid3mMO4mGaAHmLthw==", "dependencies": { - "@php-wasm/universal": "0.1.56", - "@php-wasm/util": "0.1.56", + "@php-wasm/node-polyfills": "0.5.4", + "@php-wasm/universal": "0.5.4", + "@php-wasm/util": "0.5.4", "comlink": "^4.4.1", "express": "4.18.2", "ws": "8.13.0", "yargs": "17.7.2" + }, + "engines": { + "node": ">=18.18.2", + "npm": ">=8.11.0" } }, + "node_modules/@php-wasm/node-polyfills": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@php-wasm/node-polyfills/-/node-polyfills-0.5.4.tgz", + "integrity": "sha512-utoe4md8n3gq2UJ1rGRkKBXPZsSEg40zb81IvhOajR/5UGJmxW/ktl6gpRYl3JluXrOlI83/RYTcvAPdEuzY4A==" + }, "node_modules/@php-wasm/progress": { - "version": "0.1.56", - "resolved": "https://registry.npmjs.org/@php-wasm/progress/-/progress-0.1.56.tgz", - "integrity": "sha512-AJG+maCSLX2797lwWOYgEyqy3AXvjilhcmfO22oU/U730BuZVzeLbQJ+v+F08uhGfVeIwe8sqKP9ksl/wWDlkA==" + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@php-wasm/progress/-/progress-0.5.4.tgz", + "integrity": "sha512-ruIv8XN/jCoNJ5hthyYZeKhCo3ZC3/AkNuh1TLyK7xqPfgWuMeAMjTvm/rVmAXQxRe+KeASR00NINRk6K2VXpA==", + "dependencies": { + "@php-wasm/node-polyfills": "0.5.4" + }, + "engines": { + "node": ">=18.18.2", + "npm": ">=8.11.0" + } + }, + "node_modules/@php-wasm/scopes": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@php-wasm/scopes/-/scopes-0.5.4.tgz", + "integrity": "sha512-3mwqEJSSXSgnVSswcgsdSOglduSu22knjSxoCcL0Wzs4RDprZE53XhVXdsGBsKyLDwynJZ8EgidoYa2xHFm7GQ==", + "engines": { + "node": ">=16.15.1", + "npm": ">=8.11.0" + } }, "node_modules/@php-wasm/universal": { - "version": "0.1.56", - "resolved": "https://registry.npmjs.org/@php-wasm/universal/-/universal-0.1.56.tgz", - "integrity": "sha512-qQCpYPrGdfh8PpaIUPOemMtw7bXCEBAThiAokIW5nu+51NRLK2y10Jpk2ce+/iOC9e6SLtpA6Hr2U8GrnPAXjA==" + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@php-wasm/universal/-/universal-0.5.4.tgz", + "integrity": "sha512-hzWO0e778YW0M9cFbgluQrqdbYkN031WHOu3ZRCpzjGFDpIC8tpnvdnn/zMKajf//c8LQmdCHrtOQwpn60u2oQ==", + "engines": { + "node": ">=18.18.2", + "npm": ">=8.11.0" + } }, "node_modules/@php-wasm/util": { - "version": "0.1.56", - "resolved": "https://registry.npmjs.org/@php-wasm/util/-/util-0.1.56.tgz", - "integrity": "sha512-3UW9+kh9wZkWbcxBFv/qhYF8bzE2oPGSUzr0oDnnUJGDzCJnjL5OFcfU7WJD9lKTJ85F5+Hfbg3m/mOQIaniZQ==" + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@php-wasm/util/-/util-0.5.4.tgz", + "integrity": "sha512-10kApnhSRs7kMwIn6xSaAF0ICFMAmFdVUg0Pne3InoM+RuIzMYZPdkmw9ffEVLZ83VWYXknmMpJej7TkZQwiww==", + "engines": { + "node": ">=18.18.2", + "npm": ">=8.11.0" + } }, "node_modules/@php-wasm/web": { - "version": "0.1.57", - "resolved": "https://registry.npmjs.org/@php-wasm/web/-/web-0.1.57.tgz", - "integrity": "sha512-yQIjjteuDwle3HwKr8bETUr9QdsdSK757q2jAMCDqidkJJ5URd3vOQigntV2agciCOxzy/zLMteWzKPq/NJbwA==" + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@php-wasm/web/-/web-0.5.4.tgz", + "integrity": "sha512-xygAwpDdSqXY3MHnFcOP+rbvYbJwLDHWHLupDMY4WKvBn6jZFtWGZ1YdYwluWskqgbK/MQDuPgMkceBAMeLvkg==", + "dependencies": { + "@php-wasm/progress": "0.5.4", + "@php-wasm/universal": "0.5.4", + "@php-wasm/web-service-worker": "0.5.4", + "comlink": "^4.4.1" + }, + "engines": { + "node": ">=16.15.1", + "npm": ">=8.11.0" + } + }, + "node_modules/@php-wasm/web-service-worker": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@php-wasm/web-service-worker/-/web-service-worker-0.5.4.tgz", + "integrity": "sha512-t9SJbHEdx3Re+wvDCT0c90lAFisuwor2OP0IAwKXrrVwGTK3MKttLTZMcg2n2uilsfwVuyy1JdWCcfquEtPDAA==", + "dependencies": { + "@php-wasm/scopes": "0.5.4" + }, + "engines": { + "node": ">=18.18.2", + "npm": ">=8.11.0" + } }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", @@ -17845,16 +17901,20 @@ "link": true }, "node_modules/@wp-playground/blueprints": { - "version": "0.1.56", - "resolved": "https://registry.npmjs.org/@wp-playground/blueprints/-/blueprints-0.1.56.tgz", - "integrity": "sha512-Yvll3D8oLbLgFQLQfDxkgucyLLGi99L9wl0z4+MDmFg4hEegZfP1e+VhjcXHIH3if+2XjMsWKLbUvwwHudzJkg==" + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@wp-playground/blueprints/-/blueprints-0.5.4.tgz", + "integrity": "sha512-mJTlZe3MgwNKAz6tCpG4W3X6D4VH89uQpVXsgqmsTu27vrPQeojU2nGDaavh5rAM9OpbQXCi8Rtz3qjlCJLQvg==", + "engines": { + "node": ">=18.18.2", + "npm": ">=8.11.0" + } }, "node_modules/@wp-playground/client": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@wp-playground/client/-/client-0.2.0.tgz", - "integrity": "sha512-BSXKJJZv4Yh5qs+gQuRJDMiyQc0uJPRNuRj1gdDhFz8p0NSE5fKfP/M9agnUlf3ijrpubCkt7hMpaLuynd2y3Q==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@wp-playground/client/-/client-0.5.4.tgz", + "integrity": "sha512-2AkWdT4QRc5Mw466VDG9PZy7BXZz20ALRsYcka95zBWTm6zHN1LMhePtxYXpbyv43z4Dc/UknDGzBmdBfarT5g==", "engines": { - "node": ">=16.15.1", + "node": ">=18.18.2", "npm": ">=8.11.0" } }, diff --git a/package.json b/package.json index eab354c4..fcc85a68 100644 --- a/package.json +++ b/package.json @@ -31,13 +31,13 @@ "@codemirror/state": "6.2.0", "@codemirror/theme-one-dark": "6.1.1", "@codemirror/view": "6.9.3", - "@php-wasm/node": "0.1.56", - "@php-wasm/progress": "0.1.56", - "@php-wasm/universal": "0.1.56", - "@php-wasm/web": "0.1.57", + "@php-wasm/node": "0.5.4", + "@php-wasm/progress": "0.5.4", + "@php-wasm/universal": "0.5.4", + "@php-wasm/web": "0.5.4", "@uiw/react-codemirror": "^4.21.20", - "@wp-playground/blueprints": "0.1.56", - "@wp-playground/client": "0.2.0", + "@wp-playground/blueprints": "0.5.4", + "@wp-playground/client": "0.5.4", "classnames": "^2.3.2", "comlink": "^4.4.1", "compressible": "2.0.18", diff --git a/packages/wp-now/README.md b/packages/wp-now/README.md index 4bb48fb1..3a39a7ea 100644 --- a/packages/wp-now/README.md +++ b/packages/wp-now/README.md @@ -119,7 +119,7 @@ To execute this Blueprint, create a file named `blueprint-example.json` and run "WP_HOME": "http://myurl.wpnow:8881", "WP_SITEURL": "http://myurl.wpnow:8881" }, - "virtualize": true + "method": "define-before-run" } ] } @@ -141,7 +141,7 @@ The Blueprint to listen on port `80` will look like this: "WP_HOME": "http://myurl.wpnow", "WP_SITEURL": "http://myurl.wpnow" }, - "virtualize": true + "method": "define-before-run" } ] } @@ -162,7 +162,7 @@ Run `wp-now start --blueprint=path/to/blueprint-example.json` where `blueprint-e "WP_DEBUG": true, "WP_DEBUG_LOG": true }, - "virtualize": true + "method": "define-before-run" } ] } @@ -182,7 +182,7 @@ For example, if you run `wp-now start --blueprint=path/to/blueprint-example.json "consts": { "WP_DEBUG_LOG": "/var/www/html/wp-content/themes/atlas/example.log" }, - "virtualize": true + "method": "define-before-run" } ] } diff --git a/packages/wp-now/src/tests/blueprints/wp-config.json b/packages/wp-now/src/tests/blueprints/wp-config.json index 05ae3d22..b2d511d4 100644 --- a/packages/wp-now/src/tests/blueprints/wp-config.json +++ b/packages/wp-now/src/tests/blueprints/wp-config.json @@ -6,7 +6,7 @@ "WP_HOME": "http://127.0.0.1", "WP_SITEURL": "http://127.0.0.1" }, - "virtualize": true + "method": "define-before-run" } ] } diff --git a/packages/wp-now/src/tests/blueprints/wp-debug.json b/packages/wp-now/src/tests/blueprints/wp-debug.json index f189ee3a..d3a49540 100644 --- a/packages/wp-now/src/tests/blueprints/wp-debug.json +++ b/packages/wp-now/src/tests/blueprints/wp-debug.json @@ -5,7 +5,7 @@ "consts": { "WP_DEBUG_LOG": "/var/www/html/wp-content/themes/fake/example.log" }, - "virtualize": true + "method": "define-before-run" } ] } diff --git a/packages/wp-now/src/wp-now.ts b/packages/wp-now/src/wp-now.ts index d794cfd9..18f86a28 100644 --- a/packages/wp-now/src/wp-now.ts +++ b/packages/wp-now/src/wp-now.ts @@ -32,10 +32,6 @@ import getWpNowPath from './get-wp-now-path'; import getWordpressVersionsPath from './get-wordpress-versions-path'; import getSqlitePath from './get-sqlite-path'; -function seemsLikeAPHPFile(path) { - return path.endsWith('.php') || path.includes('.php/'); -} - async function applyToInstances(phpInstances: NodePHP[], callback: Function) { for (let i = 0; i < phpInstances.length; i++) { await callback(phpInstances[i]); @@ -50,19 +46,6 @@ export default async function startWPNow( requestHandler: { documentRoot, absoluteUrl: options.absoluteUrl, - isStaticFilePath: (path) => { - try { - const fullPath = options.documentRoot + path; - return ( - php.fileExists(fullPath) && - !php.isDir(fullPath) && - !seemsLikeAPHPFile(fullPath) - ); - } catch (e) { - output?.error(e); - return false; - } - }, }, }; @@ -338,7 +321,7 @@ async function initWordPress( } await defineWpConfigConsts(php, { consts: wpConfigConsts, - virtualize: true, + method: 'define-before-run' }); return { initializeDefaultDatabase };