Skip to content

Commit

Permalink
Merge branch 'trunk' into add/error-and-install-logs-to-ga
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrgicak authored Nov 14, 2024
2 parents 4bc154e + 5746dfc commit 718155a
Show file tree
Hide file tree
Showing 2,042 changed files with 827,978 additions and 1,820 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ All notable changes to this project are documented in this file by a CI job
that runs on every NPM release. The file follows the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
format.

## [v1.0.11] (2024-11-11)




## [v1.0.10] (2024-11-08)

### Enhancements

- [CLI] Set debug constants during boot. ([#1983](https://github.com/WordPress/wordpress-playground/pull/1983))

### Bug Fixes

- [CLI] Restore the "login" argument handler. ([#1985](https://github.com/WordPress/wordpress-playground/pull/1985))

### Contributors

The following contributors merged PRs in this release:

@bgrgicak


## [v1.0.9] (2024-11-04)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "1.0.9",
"version": "1.0.11",
"useWorkspaces": true,
"useNx": true
}
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions packages/docs/site/docs/main/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,28 @@ All notable changes to this project are documented in this file by a CI job
that runs on every NPM release. The file follows the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
format.

## [v1.0.11] (2024-11-11)




## [v1.0.10] (2024-11-08)

### Enhancements

- [CLI] Set debug constants during boot. ([#1983](https://github.com/WordPress/wordpress-playground/pull/1983))

### Bug Fixes

- [CLI] Restore the "login" argument handler. ([#1985](https://github.com/WordPress/wordpress-playground/pull/1985))

### Contributors

The following contributors merged PRs in this release:

@bgrgicak


## [v1.0.9] (2024-11-04)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@php-wasm/cli",
"version": "1.0.9",
"version": "1.0.11",
"description": "PHP.wasm CLI for node.js",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/fs-journal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@php-wasm/fs-journal",
"version": "1.0.9",
"version": "1.0.11",
"description": "Bindings to journal the PHP filesystem",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/logger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@php-wasm/logger",
"version": "1.0.9",
"version": "1.0.11",
"description": "A logger for PHP-wasm clients like Playground and WP-now.",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/node-polyfills/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@php-wasm/node-polyfills",
"version": "1.0.9",
"version": "1.0.11",
"description": "PHP.wasm – polyfills for Node.js",
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions packages/php-wasm/node-polyfills/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import './lib/blob';
import './lib/custom-event';
import './lib/url';
23 changes: 23 additions & 0 deletions packages/php-wasm/node-polyfills/src/lib/url.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { currentJsRuntime } from './current-js-runtime';

if (currentJsRuntime === 'NODE') {
/**
* Polyfill for URL.canParse if it's missing.
*
* URL.canParse is available since Node 19.9.0,
* but Playground currently uses Node 18.18.0.
*
* This implementation is based on the one from `core-js`
* by Denis Pushkarev, https://github.com/zloirock
* https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.url.can-parse.js
*/
if (typeof URL.canParse !== 'function') {
globalThis.URL.canParse = function (url: string) {
try {
return !!new URL(url);
} catch (e) {
return false;
}
};
}
}
2 changes: 1 addition & 1 deletion packages/php-wasm/node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@php-wasm/node",
"version": "1.0.9",
"version": "1.0.11",
"description": "PHP.wasm for Node.js",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/progress/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@php-wasm/progress",
"version": "1.0.9",
"version": "1.0.11",
"description": "PHP.wasm – loading progress monitoring",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/scopes/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@php-wasm/scopes",
"version": "1.0.9",
"version": "1.0.11",
"description": "PHP.wasm – scoped URLs utils",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/stream-compression/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@php-wasm/stream-compression",
"version": "1.0.9",
"version": "1.0.11",
"description": "Stream-based compression bindings.",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/universal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@php-wasm/universal",
"version": "1.0.9",
"version": "1.0.11",
"description": "PHP.wasm – emscripten bindings for PHP",
"repository": {
"type": "git",
Expand Down
4 changes: 1 addition & 3 deletions packages/php-wasm/universal/src/lib/php-request-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ export class PHPRequestHandler {
* @param request - PHP Request data.
*/
async request(request: PHPRequest): Promise<PHPResponse> {
const isAbsolute =
request.url.startsWith('http://') ||
request.url.startsWith('https://');
const isAbsolute = URL.canParse(request.url);
const requestedUrl = new URL(
// Remove the hash part of the URL as it's not meant for the server.
request.url.split('#')[0],
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/util/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@php-wasm/util",
"version": "1.0.9",
"version": "1.0.11",
"type": "module",
"types": "index.d.ts",
"typedoc": {
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/web-service-worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@php-wasm/web-service-worker",
"version": "1.0.9",
"version": "1.0.11",
"description": "PHP.wasm – service worker utils",
"repository": {
"type": "git",
Expand Down
25 changes: 25 additions & 0 deletions packages/php-wasm/web-service-worker/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,31 @@ export async function convertFetchEventToPHPRequest(event: FetchEvent) {
throw e;
}

/**
* Safari has a bug that prevents Service Workers from redirecting relative URLs.
* When attempting to redirect to a relative URL, the network request will return an error.
* See the Webkit bug for details: https://bugs.webkit.org/show_bug.cgi?id=282427.
*
* Because PHP and WordPress can redirect to both relative and absolute URLs
* using the `location` header we need to ensure redirects are processed
* correctly by the Service Worker.
*
* As a workaround for Safari Service Workers, we use `Response.redirect()`
* for all redirect responses (300-399 status codes) coming from PHP.
* This solution was suggested in the Webkit bug comment:
* https://bugs.webkit.org/show_bug.cgi?id=282427#c2
*/
if (
phpResponse.httpStatusCode >= 300 &&
phpResponse.httpStatusCode <= 399 &&
phpResponse.headers['location']
) {
return Response.redirect(
phpResponse.headers['location'][0],
phpResponse.httpStatusCode
);
}

return new Response(phpResponse.bytes, {
headers: phpResponse.headers,
status: phpResponse.httpStatusCode,
Expand Down
Loading

0 comments on commit 718155a

Please sign in to comment.