Skip to content

Commit 9bf43b4

Browse files
matticbotrenovate-botanomiex
authored
Update wordpress monorepo (#45915)
* Update wordpress monorepo * pnpmfile: `@automattic/components` is not compatible with `@wordpress/icons` v11 * Pnpmfile hack for `@wordpress/media-utils` and `@wordpress/admin-ui` missing deps on `react` * tests: Fix deep mocking Various packages are now using `exports`, which means we can't have jest mock some deep entry point anymore. Fortunately all the tests seem ok with using a Proxy object to mock the whole package. * pnpm: Hack packages to flag ESM files correctly as ESM We do this by injecting a stub `package.json` into the directory holding the ESM `.js` files, because the resolution algorithm looks at the closest package.json rather than the package-as-a-whole's package.json. On the down side, we have to make sure to copy the `sideEffects` property into the stub, because that too looks at the closest one. Hopefully there aren't more things like that. In addition to the Gutenberg packages, the `uuid` package also has this issue showing up now for some reason. * webpack: Set `resolve.fullySpecified` to false for Gutenberg packages When the file is correctly flagged as containing ESM, Webpack by default requires the full file import rather than a directory or extensionless import. We can change that behavior by setting `resolve.fullySpecified`. Gutenberg itself doesn't run into this because they're relying on webpack/babel to be lenient with files that are flagged as CommonJS but contain ESM code. * scan: Revert dataviews test hack from #45551 No longer necessary after the ESM-fixing hack in this PR. * Gutenberg seems to have stopped publishing the `.native.js` entry points. Disable linting of our `.native.[jt]s` files until that is resolved. * Fix typechecks We can't deep-import the types directly anymore, so we have to start with what we can import and use utility functions and accessors to drill down to the types we need. * forms: Hack around `@wordpress/interactivity` going ESM-only. I worked out a hacky way to get the test to pass without being too invasive. In the long run it would be better to convert `packages/forms` to run Jest in ESM mode, i.e. `NODE_OPTIONS=--experimental-vm-modules jest --config=tests/jest.config.js`. But making that happen will be a lot more invasive: probably you'll need to set `"type": "module"` in `package.json` too so all the existing ESM-containing `.js` files get properly interpreted as ESM, and then you'll have to fully specify all the imports (i.e. change `import from './subdir'` to `import from './subdir/index.js'` and `import from './file'` to `import from './file.js'`), and clean up anything else that breaks too. On the easier side, you could just rename some of the config files, like `babel.config.js` → `babel.config.cjs` and `tools/webpack.config.*.js` → `tools/webpack.config.*.cjs`, if converting them is too annoying. --------- Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Brad Jorsch <[email protected]>
1 parent e6e29dc commit 9bf43b4

File tree

180 files changed

+3629
-3279
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+3629
-3279
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Hack for https://github.com/WordPress/gutenberg/issues/73363
2+
3+
diff --git a/build-module/package.json b/build-module/package.json
4+
new file mode 100644
5+
index 0000000000000000000000000000000000000000..089153bcb5adf57dc25f206a9dad3114c9cff80d
6+
--- /dev/null
7+
+++ b/build-module/package.json
8+
@@ -0,0 +1 @@
9+
+{"type":"module","sideEffects":false}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Hack for https://github.com/WordPress/gutenberg/issues/73363
2+
3+
diff --git a/build-module/package.json b/build-module/package.json
4+
new file mode 100644
5+
index 0000000000000000000000000000000000000000..089153bcb5adf57dc25f206a9dad3114c9cff80d
6+
--- /dev/null
7+
+++ b/build-module/package.json
8+
@@ -0,0 +1 @@
9+
+{"type":"module"}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Hack for https://github.com/WordPress/gutenberg/issues/73363
2+
3+
diff --git a/build-module/package.json b/build-module/package.json
4+
new file mode 100644
5+
index 0000000000000000000000000000000000000000..f0545ca9fef129d2d48e3abe6266bb8c63a180f5
6+
--- /dev/null
7+
+++ b/build-module/package.json
8+
@@ -0,0 +1,8 @@
9+
+{
10+
+ "type": "module",
11+
+ "sideEffects": [
12+
+ "index.js",
13+
+ "store/index.js",
14+
+ "hooks/**"
15+
+ ]
16+
+}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hack for https://github.com/WordPress/gutenberg/issues/73363
2+
3+
diff --git a/build-module/package.json b/build-module/package.json
4+
new file mode 100644
5+
index 0000000000000000000000000000000000000000..86525a602634f6df4fa899b3f3ccff98fb383f97
6+
--- /dev/null
7+
+++ b/build-module/package.json
8+
@@ -0,0 +1,6 @@
9+
+{
10+
+ "type": "module",
11+
+ "sideEffects": [
12+
+ "*/init.js"
13+
+ ]
14+
+}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hack for https://github.com/WordPress/gutenberg/issues/73363
2+
3+
diff --git a/build-module/package.json b/build-module/package.json
4+
new file mode 100644
5+
index 0000000000000000000000000000000000000000..b8b0e42861ff4e6a8d35d18c3af1fd78edb5cd65
6+
--- /dev/null
7+
+++ b/build-module/package.json
8+
@@ -0,0 +1,6 @@
9+
+{
10+
+ "type": "module",
11+
+ "sideEffects": [
12+
+ "{index.js,store/index.js}"
13+
+ ]
14+
+}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hack for https://github.com/WordPress/gutenberg/issues/73363
2+
3+
diff --git a/build-module/package.json b/build-module/package.json
4+
new file mode 100644
5+
index 0000000000000000000000000000000000000000..01ba5824acf704e5bdf0f1ba39082f8b7ed45143
6+
--- /dev/null
7+
+++ b/build-module/package.json
8+
@@ -0,0 +1,6 @@
9+
+{
10+
+ "type": "module",
11+
+ "sideEffects": [
12+
+ "index.js"
13+
+ ]
14+
+}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Hack for https://github.com/WordPress/gutenberg/issues/73363
2+
3+
diff --git a/build-module/package.json b/build-module/package.json
4+
new file mode 100644
5+
index 0000000000000000000000000000000000000000..ec566419b6da8e8e2bca9ba950ad82c0914ea410
6+
--- /dev/null
7+
+++ b/build-module/package.json
8+
@@ -0,0 +1,9 @@
9+
+{
10+
+ "type": "module",
11+
+ "sideEffects": [
12+
+ "index.js",
13+
+ "store/index.js",
14+
+ "hooks/**",
15+
+ "bindings/**"
16+
+ ]
17+
+}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hack for https://github.com/WordPress/gutenberg/issues/73363
2+
3+
diff --git a/build-module/package.json b/build-module/package.json
4+
new file mode 100644
5+
index 0000000000000000000000000000000000000000..58bcd63dc1d5a2fc49de44b1760d6dbfb34b838a
6+
--- /dev/null
7+
+++ b/build-module/package.json
8+
@@ -0,0 +1,6 @@
9+
+{
10+
+ "type": "module",
11+
+ "sideEffects": [
12+
+ "{index.js,store/index.js}"
13+
+ ]
14+
+}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hack for https://github.com/WordPress/gutenberg/issues/73363
2+
3+
diff --git a/build-module/package.json b/build-module/package.json
4+
new file mode 100644
5+
index 0000000000000000000000000000000000000000..ed3b18a17925393bc4ca3f33ae7f38976518ca5f
6+
--- /dev/null
7+
+++ b/build-module/package.json
8+
@@ -0,0 +1,6 @@
9+
+{
10+
+ "type": "module",
11+
+ "sideEffects": [
12+
+ "{index.js,store/index.js,hooks/**}"
13+
+ ]
14+
+}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Hack for https://github.com/WordPress/gutenberg/issues/73363
2+
3+
diff --git a/build-module/package.json b/build-module/package.json
4+
new file mode 100644
5+
index 0000000000000000000000000000000000000000..b8b0e42861ff4e6a8d35d18c3af1fd78edb5cd65
6+
--- /dev/null
7+
+++ b/build-module/package.json
8+
@@ -0,0 +1,6 @@
9+
+{
10+
+ "type": "module",
11+
+ "sideEffects": [
12+
+ "{index.js,store/index.js}"
13+
+ ]
14+
+}

0 commit comments

Comments
 (0)