You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[PHP-wasm Node] Fix Identifier '__filename' has already been declared (#143)
## Motivation for the change, related issues
`__filename` and `__dirname` are available in CommonJS but unavailable
in ES modules. ([Node.js
docs](https://nodejs.org/api/esm.html#no-__filename-or-__dirname)).
In Automattic/wordpress-playground-private#129
we made sure `__filename` and `__dirname` are available, but this broke
ES module support and the latest version of PHP-wasm (1.0.36) can't
initialize the PHP environment because of errors like `The "path"
argument must be of type string or an instance of URL. Received
undefined` and `SyntaxError: Identifier '__filename' has already been
declared`
## Implementation details
This PR addresses the issue by creating only the `__dirname` and
`__filename` constants only if they weren't previously defined. The
downside is that we need to define them as vars and not consts.
The PR also adds package install tests to CI, and the test creates
temporary packages from the current commit, installs them into an ESM
and CJS project,t and runs simple tests that boot WordPress using
`runCLI`.
## Testing Instructions (or ideally a Blueprint)
I tested this by manually updating PHP-wasm and Playground packages in
Studio and a personal project.
I also tested that we can run Playground CLI using `npx PACKAGE_URL
server`, and that we can use the CLI in Windows and MacOS using Bun.
- Run `npx nx debug playground-cli --php=8.3 server` and confirm it
still works
---------
Co-authored-by: Adam Zieliński <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+41-50Lines changed: 41 additions & 50 deletions
Original file line number
Diff line number
Diff line change
@@ -4,120 +4,111 @@ All notable changes to this project are documented in this file by a CI job
4
4
that runs on every NPM release. The file follows the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
5
5
format.
6
6
7
-
## [v1.0.37] (2025-05-15)
7
+
## [v1.0.37] (2025-05-15)
8
8
9
9
### Various
10
10
11
-
- Define `DB_NAME` constant when it's missing. ([#140](https://github.com/Automattic/wordpress-playground-private/pull/140))
12
-
- Support limiting files added to self-hosted packages. ([#149](https://github.com/Automattic/wordpress-playground-private/pull/149))
11
+
-Define `DB_NAME` constant when it's missing. ([#140](https://github.com/Automattic/wordpress-playground-private/pull/140))
12
+
-Support limiting files added to self-hosted packages. ([#149](https://github.com/Automattic/wordpress-playground-private/pull/149))
13
13
14
14
### Contributors
15
15
16
16
The following contributors merged PRs in this release:
17
17
18
18
@brandonpayton@JanJakes
19
19
20
-
21
-
## [v1.0.36] (2025-05-08)
20
+
## [v1.0.36] (2025-05-08)
22
21
23
22
### Various
24
23
25
-
- Document mounting OPFS storage *after* the boot. ([#141](https://github.com/Automattic/wordpress-playground-private/pull/141))
26
-
- QUERY_STRING should default to empty string. ([#139](https://github.com/Automattic/wordpress-playground-private/pull/139))
27
-
- Remove null steps that are added. ([#135](https://github.com/Automattic/wordpress-playground-private/pull/135))
28
-
-[CLI] Fix package entry point path. ([#136](https://github.com/Automattic/wordpress-playground-private/pull/136))
24
+
-Document mounting OPFS storage _after_ the boot. ([#141](https://github.com/Automattic/wordpress-playground-private/pull/141))
25
+
-QUERY_STRING should default to empty string. ([#139](https://github.com/Automattic/wordpress-playground-private/pull/139))
26
+
-Remove null steps that are added. ([#135](https://github.com/Automattic/wordpress-playground-private/pull/135))
27
+
-[CLI] Fix package entry point path. ([#136](https://github.com/Automattic/wordpress-playground-private/pull/136))
29
28
30
29
### Contributors
31
30
32
31
The following contributors merged PRs in this release:
33
32
34
33
@ashfame@bgrgicak@sejas
35
34
35
+
## [v1.0.35] (2025-05-08)
36
36
37
-
## [v1.0.35] (2025-05-08)
38
-
39
-
40
-
41
-
42
-
## [v1.0.34] (2025-05-08)
37
+
## [v1.0.34] (2025-05-08)
43
38
44
39
### Various
45
40
46
-
- Document mounting OPFS storage *after* the boot. ([#141](https://github.com/Automattic/wordpress-playground-private/pull/141))
41
+
-Document mounting OPFS storage _after_ the boot. ([#141](https://github.com/Automattic/wordpress-playground-private/pull/141))
47
42
48
43
### Contributors
49
44
50
45
The following contributors merged PRs in this release:
51
46
52
47
@ashfame
53
48
54
-
55
-
## [v1.0.33] (2025-05-08)
49
+
## [v1.0.33] (2025-05-08)
56
50
57
51
### Various
58
52
59
-
- Add MySQL network calls to Asyncify tests. ([#108](https://github.com/Automattic/wordpress-playground-private/pull/108))
60
-
- Format the plugin-proxy file. ([#127](https://github.com/Automattic/wordpress-playground-private/pull/127))
61
-
- Plugin proxy: Allow all repos from WordPress, Automattic and Woocommerce organizations. ([#128](https://github.com/Automattic/wordpress-playground-private/pull/128))
62
-
- QUERY_STRING should default to empty string. ([#139](https://github.com/Automattic/wordpress-playground-private/pull/139))
63
-
- Remove null steps that are added. ([#135](https://github.com/Automattic/wordpress-playground-private/pull/135))
-[CLI] Fix package entry point path. ([#136](https://github.com/Automattic/wordpress-playground-private/pull/136))
66
-
-[PHP-wasm Node] Add support for resolving wasm paths in Windows. ([#129](https://github.com/Automattic/wordpress-playground-private/pull/129))
67
-
-[PHP-wasm Node] Dynamically mount symlinks. ([#125](https://github.com/Automattic/wordpress-playground-private/pull/125))
53
+
-Add MySQL network calls to Asyncify tests. ([#108](https://github.com/Automattic/wordpress-playground-private/pull/108))
54
+
-Format the plugin-proxy file. ([#127](https://github.com/Automattic/wordpress-playground-private/pull/127))
55
+
-Plugin proxy: Allow all repos from WordPress, Automattic and Woocommerce organizations. ([#128](https://github.com/Automattic/wordpress-playground-private/pull/128))
56
+
-QUERY_STRING should default to empty string. ([#139](https://github.com/Automattic/wordpress-playground-private/pull/139))
57
+
-Remove null steps that are added. ([#135](https://github.com/Automattic/wordpress-playground-private/pull/135))
-[CLI] Fix package entry point path. ([#136](https://github.com/Automattic/wordpress-playground-private/pull/136))
60
+
-[PHP-wasm Node] Add support for resolving wasm paths in Windows. ([#129](https://github.com/Automattic/wordpress-playground-private/pull/129))
61
+
-[PHP-wasm Node] Dynamically mount symlinks. ([#125](https://github.com/Automattic/wordpress-playground-private/pull/125))
68
62
69
63
### Contributors
70
64
71
65
The following contributors merged PRs in this release:
72
66
73
67
@adamziel@ashfame@bgrgicak@ingeniumed@sejas
74
68
75
-
76
-
## [v1.0.32] (2025-05-06)
69
+
## [v1.0.32] (2025-05-06)
77
70
78
71
### Various
79
72
80
-
- Add MySQL network calls to Asyncify tests. ([#108](https://github.com/Automattic/wordpress-playground-private/pull/108))
81
-
- Format the plugin-proxy file. ([#127](https://github.com/Automattic/wordpress-playground-private/pull/127))
82
-
- Plugin proxy: Allow all repos from WordPress, Automattic and Woocommerce organizations. ([#128](https://github.com/Automattic/wordpress-playground-private/pull/128))
-[PHP-wasm Node] Add support for resolving wasm paths in Windows. ([#129](https://github.com/Automattic/wordpress-playground-private/pull/129))
85
-
-[PHP-wasm Node] Dynamically mount symlinks. ([#125](https://github.com/Automattic/wordpress-playground-private/pull/125))
73
+
-Add MySQL network calls to Asyncify tests. ([#108](https://github.com/Automattic/wordpress-playground-private/pull/108))
74
+
-Format the plugin-proxy file. ([#127](https://github.com/Automattic/wordpress-playground-private/pull/127))
75
+
-Plugin proxy: Allow all repos from WordPress, Automattic and Woocommerce organizations. ([#128](https://github.com/Automattic/wordpress-playground-private/pull/128))
0 commit comments