Commit 5f2828750c1 for woocommerce

commit 5f2828750c1ea1fe1abef585c81195edd16c9b37
Author: Mikael Korpela <mikael@ihminen.org>
Date:   Fri Nov 20 13:37:20 2026 +0200

    Upgrade pnpm to v12 (#70331)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 644cba66bd7..383b0126007 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -107,7 +107,7 @@ jobs:
               - '.github/workflows/scripts/docs-link-check-policy-test.sh'
               - '.github/workflows/scripts/install-lychee.sh'
             needs-syncpack-validation:
-              - '(.syncpackrc)|(pnpm-lock.yaml)|(pnpm-workspace.yaml)|(.nvmrc)'
+              - '(.syncpackrc)|(package.json)|(pnpm-lock.yaml)|(pnpm-workspace.yaml)|(.nvmrc)'

   phpstan:
     needs: 'identify-jobs-to-run'
@@ -141,6 +141,11 @@ jobs:
       - name: Setup - pnpm
         uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9

+      - name: Setup - node
+        uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
+        with:
+          node-version-file: '.nvmrc'
+
       - name: Setup - spawn linting and testing jobs
         uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
         id: 'project-jobs'
@@ -692,9 +697,9 @@ jobs:
       - name: 'Validate - Node version sources agree'
         run: |
           nvmrc="$(tr -d 'v[:space:]' < .nvmrc)"
-          workspace="$(sed -nE "s/^useNodeVersion:[[:space:]]*['\"]?([^'\"#[:space:]]+).*/\1/p" pnpm-workspace.yaml)"
+          workspace="$(jq -r '.devEngines.runtime.version // empty' package.json)"
           if [ -z "$nvmrc" ] || [ -z "$workspace" ] || [ "$nvmrc" != "$workspace" ]; then
-            echo "::error::.nvmrc ($nvmrc) and useNodeVersion in pnpm-workspace.yaml ($workspace) must name the same Node version."
+            echo "::error::.nvmrc ($nvmrc) and devEngines.runtime.version in package.json ($workspace) must name the same Node version."
             exit 1
           fi

@@ -865,6 +870,6 @@ jobs:
         shell: bash
         working-directory: docs/_docu-tools
         run: |
-            pnpm install --ignore-workspace
+            pnpm install
             pnpm run lint:markdown
             pnpm exec docusaurus build --config ./utils/docusaurus-faster.deploy.config.js
diff --git a/.pnpmfile.cjs b/.pnpmfile.cjs
index 3ecaabfa39d..92c1650ac17 100644
--- a/.pnpmfile.cjs
+++ b/.pnpmfile.cjs
@@ -124,7 +124,10 @@ function computeReferences(
 		if ( ! consumers.has( depName ) ) {
 			continue;
 		}
-		const resolvedDep = resolved[ depName ];
+		const entry = resolved[ depName ];
+		// pnpm 12 hands over `{ specifier, version }`; older versions a plain string.
+		const resolvedDep =
+			entry && typeof entry === 'object' ? entry.version : entry;
 		if ( ! resolvedDep || ! resolvedDep.startsWith( 'link:' ) ) {
 			continue;
 		}
diff --git a/README.md b/README.md
index ea9f6c1bd1f..cd9d7d8cf53 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ To get up and running within the WooCommerce Monorepo, you will need to make sur

 ### Prerequisites

--   [Node.js](https://nodejs.org/): Required to run PNPM and the monorepo's build and test scripts. You do not need to match a specific Node version by hand. PNPM reads the version pinned in [`pnpm-workspace.yaml`](pnpm-workspace.yaml) (`useNodeVersion`, mirrored in [`.nvmrc`](.nvmrc)) and automatically installs and uses it for every script it runs. A Node version manager such as [NVM](https://github.com/nvm-sh/nvm#installing-and-updating) is optional, but still handy for installing Node itself.
+-   [Node.js](https://nodejs.org/): Required to run PNPM and the monorepo's build and test scripts. Use the Node version pinned in [`package.json`](package.json) (`devEngines.runtime`, mirrored in [`.nvmrc`](.nvmrc)); PNPM fails with an error when you run it on a different version. A Node version manager such as [NVM](https://github.com/nvm-sh/nvm#installing-and-updating) is optional, but still handy for installing Node itself.
 -   [PNPM](https://pnpm.io/installation): Our repository utilizes PNPM to manage project dependencies and run various scripts involved in building and testing projects.
 -   [PHP 7.4+](https://www.php.net/manual/en/install.php): WooCommerce Core currently requires PHP version 7.4 or higher. It is also needed to run Composer and various project build scripts. See [troubleshooting](DEVELOPMENT.md#troubleshooting) for troubleshooting problems installing PHP.
 -   [Composer](https://getcomposer.org/doc/00-intro.md): We use Composer to manage all of the dependencies for PHP packages and plugins.
@@ -23,7 +23,7 @@ Once you've installed all prerequisites, the following will prepare all of the b

 ```bash
 # Install the PHP and Composer dependencies for all of the plugins, packages, and tools.
-# PNPM automatically uses the pinned Node version for every script it runs.
+# PNPM fails with an error when the Node version differs from the pinned one (see Prerequisites).
 pnpm install --frozen-lockfile
 # Build all of the plugins, packages, and tools in the monorepo
 pnpm build
diff --git a/docs/_docu-tools/package.json b/docs/_docu-tools/package.json
index f7a36bb9259..723fa0e7877 100644
--- a/docs/_docu-tools/package.json
+++ b/docs/_docu-tools/package.json
@@ -50,10 +50,5 @@
 	},
 	"engines": {
 		"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
-	},
-	"pnpm": {
-		"overrides": {
-			"tinypool@<2.1.2": "^2.1.2"
-		}
 	}
 }
diff --git a/docs/_docu-tools/pnpm-workspace.yaml b/docs/_docu-tools/pnpm-workspace.yaml
new file mode 100644
index 00000000000..316d5ab14a3
--- /dev/null
+++ b/docs/_docu-tools/pnpm-workspace.yaml
@@ -0,0 +1,8 @@
+# Dependency build scripts this docs site doesn't need; denied explicitly so pnpm doesn't fail on them.
+allowBuilds:
+    '@swc/core': false
+    core-js: false
+
+# Docusaurus requires tinypool 1.x, which has critical advisories (GHSA-5gmw-xhrv-c9v3, GHSA-85c8-ppgw-ccpr). Remove once it depends on tinypool 2.x.
+overrides:
+    'tinypool@<2.1.2': ^2.1.2
diff --git a/docs/getting-started/development-environment.md b/docs/getting-started/development-environment.md
index e8d4ae0c9b6..e2ba5afdb94 100644
--- a/docs/getting-started/development-environment.md
+++ b/docs/getting-started/development-environment.md
@@ -11,7 +11,7 @@ sidebar_position: 2
 There are some specific software requirements you will need to consider when developing WooCommerce extensions. The necessary software includes:

 * [Git](https://git-scm.com/) for version control of your source code
-* [Node.js](https://nodejs.org/) to run node-based scripts and build processes. PNPM installs and uses the Node version pinned in the repository automatically, so a version manager such as [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md) is optional.
+* [Node.js](https://nodejs.org/) to run node-based scripts and build processes. Use the Node version pinned in the repository (`devEngines.runtime` in `package.json`, mirrored in `.nvmrc`). PNPM does not install it and fails with an error on a different version, so a version manager such as [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md) is handy.
 * [Pnpm](https://pnpm.io/) is an npm alternative required if you are building WooCommerce from the repository
 * [Composer](https://getcomposer.org/) is an optional dependency management tool for PHP-based development
 * [WP-CLI](http://wp-cli.org/) is the command line interface for WordPress
@@ -78,7 +78,7 @@ cd woocommerce

 #### Install Node

-You need [Node.js](https://nodejs.org/) installed to run PNPM and the build scripts. You do not need to match a specific Node version yourself: PNPM reads the version pinned in `pnpm-workspace.yaml` (`useNodeVersion`, mirrored in `.nvmrc`) and installs and uses it automatically for every script it runs.
+You need [Node.js](https://nodejs.org/) installed to run PNPM and the build scripts. Use the Node version pinned in `package.json` (`devEngines.runtime`, mirrored in `.nvmrc`); PNPM fails with an error when you run it on a different version.

 If you would like a tool to install and switch between Node versions, [Node Version Manager](https://github.com/nvm-sh/nvm) (nvm) is one option. With nvm installed, running `nvm install` from the repository root picks up the pinned version from `.nvmrc`. You can learn more in [the nvm GitHub repository](https://github.com/nvm-sh/nvm?tab=readme-ov-file#intro).

diff --git a/package.json b/package.json
index afbb6005fb7..97ca2944c75 100644
--- a/package.json
+++ b/package.json
@@ -3,10 +3,17 @@
 	"title": "WooCommerce Monorepo",
 	"description": "Monorepo for the WooCommerce ecosystem",
 	"homepage": "https://woocommerce.com/",
-	"packageManager": "pnpm@10.33.0",
+	"packageManager": "pnpm@12.22.0",
 	"engines": {
 		"node": "^24.15.0"
 	},
+	"devEngines": {
+		"runtime": {
+			"name": "node",
+			"version": "24.22.3",
+			"onFail": "error"
+		}
+	},
 	"private": true,
 	"repository": {
 		"type": "git",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 14153148798..3409cb03040 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1,3 +1,196 @@
+---
+lockfileVersion: '9.0'
+
+importers:
+
+  .:
+    configDependencies: {}
+    packageManagerDependencies:
+      '@pnpm/exe':
+        specifier: 12.22.0
+        version: 12.22.0
+      pnpm:
+        specifier: 12.22.0
+        version: 12.22.0
+
+packages:
+
+  '@pnpm/exe.android-arm64@12.22.0':
+    resolution: {integrity: sha512-n0kwk3uOtWGaSMJWUuxG8fLefRonw8jR27dhGzMcDz79Um37QKPLEGZAZF37iASbb2yBBQFl4hue6/SfQnmIdA==}
+    cpu: [arm64]
+    os: [android]
+
+  '@pnpm/exe.android-x64@12.22.0':
+    resolution: {integrity: sha512-1HERYEdvJEjU5p/lyI8g3YNEVdvVz6+omaqI1pKotZB9w92BlSXr0xTqur8X/8GAiE4B/pwZi8+eAi4v+KQVHg==}
+    cpu: [x64]
+    os: [android]
+
+  '@pnpm/exe.darwin-arm64@12.22.0':
+    resolution: {integrity: sha512-CU0m1tFFVW2QD2PDVTsdejYGoPzhMq04l/MnwhpCuM2iBXkMXqV52kH24U5A2SYULV4Y/TTYsKL5InKZblVNvw==}
+    cpu: [arm64]
+    os: [darwin]
+
+  '@pnpm/exe.darwin-x64@12.22.0':
+    resolution: {integrity: sha512-XjVoliuAZjcyQJVymR+n3xmkw3SBME3Sg7wjKBTNbOaTGe3RLIkXt8D9YXOoSnET8gyhQrY8fwThFT+Ki6IVNw==}
+    cpu: [x64]
+    os: [darwin]
+
+  '@pnpm/exe.freebsd-x64@12.22.0':
+    resolution: {integrity: sha512-BefdhvM+nrLXHCRVFmNv5yp4Zhwz29nEP+UPhsvGRRp4YRzgmyxT9r0lVts3Lg0FzcKOtPbM3o0Hyb2y0JF3yw==}
+    cpu: [x64]
+    os: [freebsd]
+
+  '@pnpm/exe.linux-arm64-musl@12.22.0':
+    resolution: {integrity: sha512-72fwiRonMxFAY4Fb611eTaR+8bYwH91SnWCg3aODjhigCMURFe5Pom+TtYM/GMrme2yirGkHbpzU2u0lMMCwTQ==}
+    cpu: [arm64]
+    os: [linux]
+    libc: [musl]
+
+  '@pnpm/exe.linux-arm64@12.22.0':
+    resolution: {integrity: sha512-1MZ3GfFCFckquAJP6WZ985Lrd5MP5YNA7vPZH79W+1QVzwl55fVMdsAOczdGnFeU4jqMwERnk129/1g9zYxhDw==}
+    cpu: [arm64]
+    os: [linux]
+    libc: [glibc]
+
+  '@pnpm/exe.linux-ppc64@12.22.0':
+    resolution: {integrity: sha512-JOmNBnncDB+9pa8ddtIp9qrLrKwvgzV92xWEFAXSBrDcPIIAdD7imtk3kZnoiApdRzPbQHHj6JJKKVmOUXN0Bw==}
+    cpu: [ppc64]
+    os: [linux]
+    libc: [glibc]
+
+  '@pnpm/exe.linux-riscv64@12.22.0':
+    resolution: {integrity: sha512-4oJ2VAuzpEnySBxZ9uz9dwIZYqOcgJ7FWIFdPDf9QbkYo8NbskZ2ySgHwlDVnvQYGhTM45kFRDwjfhKYZJJ9PQ==}
+    cpu: [riscv64]
+    os: [linux]
+    libc: [glibc]
+
+  '@pnpm/exe.linux-s390x@12.22.0':
+    resolution: {integrity: sha512-wLbmg1e+9qAUbqZ29/BUvAQwiZtvgzKg3kjDIN4tkxrCATnneM2G0agFpD9yLHD3FT5J8bUB8RWSur5vqm4Vnw==}
+    cpu: [s390x]
+    os: [linux]
+    libc: [glibc]
+
+  '@pnpm/exe.linux-x64-musl@12.22.0':
+    resolution: {integrity: sha512-ODMJgTVHvs/WOqQKE9Am5u7RztsNjXZpkn73z9z4SsU7Dtrr/3IQkjvsF1MGM9hbhMdGwl2BHAW91eCCipIsHQ==}
+    cpu: [x64]
+    os: [linux]
+    libc: [musl]
+
+  '@pnpm/exe.linux-x64@12.22.0':
+    resolution: {integrity: sha512-iBAZAYCYoow6g0aObKmprKkIBGO72mK4KFfqIrY7jIdHRkAbN67tcN0zgaPE39UAEdMcrkLhLwEml+VMxf8h8Q==}
+    cpu: [x64]
+    os: [linux]
+    libc: [glibc]
+
+  '@pnpm/exe.netbsd-x64@12.22.0':
+    resolution: {integrity: sha512-5y9seaGcEL2OH5p9PG1cZRnSQKENvzK8hTsTjkFxUxXM84OCDvSlaSLr4ABrjrxWKlo4k8bjnmW7NEwznlowGA==}
+    cpu: [x64]
+    os: [netbsd]
+
+  '@pnpm/exe.win32-arm64@12.22.0':
+    resolution: {integrity: sha512-eMJWsyECSWxhGDQwPokhES8dJX0dsu7E0tUfhxAaUnFxX7oBKKNS7kBY9yY75sNq4CmMNLjhOtBwrVjd3bQ1Hg==}
+    cpu: [arm64]
+    os: [win32]
+
+  '@pnpm/exe.win32-x64@12.22.0':
+    resolution: {integrity: sha512-d0D0GIiDkdiUiENlz3sMOR3arSsApaXtBZl2+rDwbwtQJ5IIBopf4KVTSZDPr09yl2NUVglCS5roveGKpYCWOg==}
+    cpu: [x64]
+    os: [win32]
+
+  '@pnpm/exe@12.22.0':
+    resolution: {integrity: sha512-WRo/YKEo/bkvlZ/w6yDpF40xcM502lwsLAxZsiVYaW/OBCELnCQM5i9jlpQ825DP0FCXU6CRrUitM5Gq4drkIQ==}
+    engines: {node: '>=18'}
+    hasBin: true
+
+  pnpm@12.22.0:
+    resolution: {integrity: sha512-iUlAo9mlffpv03OZD7TkHgnC8tdtmC7R11J105Jn+Yj7Ti1AkAy+mSHGjZfGeqGhCW0nZjPbJI97NJJ6yd23pA==}
+    engines: {node: '>=18'}
+    hasBin: true
+
+snapshots:
+
+  '@pnpm/exe.android-arm64@12.22.0':
+    optional: true
+
+  '@pnpm/exe.android-x64@12.22.0':
+    optional: true
+
+  '@pnpm/exe.darwin-arm64@12.22.0':
+    optional: true
+
+  '@pnpm/exe.darwin-x64@12.22.0':
+    optional: true
+
+  '@pnpm/exe.freebsd-x64@12.22.0':
+    optional: true
+
+  '@pnpm/exe.linux-arm64-musl@12.22.0':
+    optional: true
+
+  '@pnpm/exe.linux-arm64@12.22.0':
+    optional: true
+
+  '@pnpm/exe.linux-ppc64@12.22.0':
+    optional: true
+
+  '@pnpm/exe.linux-riscv64@12.22.0':
+    optional: true
+
+  '@pnpm/exe.linux-s390x@12.22.0':
+    optional: true
+
+  '@pnpm/exe.linux-x64-musl@12.22.0':
+    optional: true
+
+  '@pnpm/exe.linux-x64@12.22.0':
+    optional: true
+
+  '@pnpm/exe.netbsd-x64@12.22.0':
+    optional: true
+
+  '@pnpm/exe.win32-arm64@12.22.0':
+    optional: true
+
+  '@pnpm/exe.win32-x64@12.22.0':
+    optional: true
+
+  '@pnpm/exe@12.22.0':
+    optionalDependencies:
+      '@pnpm/exe.android-arm64': 12.22.0
+      '@pnpm/exe.android-x64': 12.22.0
+      '@pnpm/exe.darwin-arm64': 12.22.0
+      '@pnpm/exe.darwin-x64': 12.22.0
+      '@pnpm/exe.freebsd-x64': 12.22.0
+      '@pnpm/exe.linux-arm64': 12.22.0
+      '@pnpm/exe.linux-arm64-musl': 12.22.0
+      '@pnpm/exe.linux-ppc64': 12.22.0
+      '@pnpm/exe.linux-riscv64': 12.22.0
+      '@pnpm/exe.linux-s390x': 12.22.0
+      '@pnpm/exe.linux-x64': 12.22.0
+      '@pnpm/exe.linux-x64-musl': 12.22.0
+      '@pnpm/exe.netbsd-x64': 12.22.0
+      '@pnpm/exe.win32-arm64': 12.22.0
+      '@pnpm/exe.win32-x64': 12.22.0
+
+  pnpm@12.22.0:
+    optionalDependencies:
+      '@pnpm/exe.android-arm64': 12.22.0
+      '@pnpm/exe.android-x64': 12.22.0
+      '@pnpm/exe.darwin-arm64': 12.22.0
+      '@pnpm/exe.darwin-x64': 12.22.0
+      '@pnpm/exe.freebsd-x64': 12.22.0
+      '@pnpm/exe.linux-arm64': 12.22.0
+      '@pnpm/exe.linux-arm64-musl': 12.22.0
+      '@pnpm/exe.linux-ppc64': 12.22.0
+      '@pnpm/exe.linux-riscv64': 12.22.0
+      '@pnpm/exe.linux-s390x': 12.22.0
+      '@pnpm/exe.linux-x64': 12.22.0
+      '@pnpm/exe.linux-x64-musl': 12.22.0
+      '@pnpm/exe.netbsd-x64': 12.22.0
+      '@pnpm/exe.win32-arm64': 12.22.0
+      '@pnpm/exe.win32-x64': 12.22.0
+
+---
 lockfileVersion: '9.0'

 settings:
@@ -301,7 +494,7 @@ overrides:
   react-resize-aware: 3.1.1
   sass: 1.69.5

-pnpmfileChecksum: sha256-7lEtYKkj9MKUQ1wDfOySWQ01OX5tYIUQTnfpMq5epMI=
+pnpmfileChecksum: sha256-GVJ6CWe33cWWfXZmW22zruRgPyt12IRQcOixcR/uroo=

 patchedDependencies:
   '@wordpress/e2e-test-utils-playwright@1.33.2':
@@ -4391,6 +4584,9 @@ importers:

   tools/theme-cli:
     devDependencies:
+      '@woocommerce/eslint-config':
+        specifier: workspace:*
+        version: link:../eslint-config
       '@wordpress/env':
         specifier: catalog:tooling
         version: 12.0.0(@types/node@24.12.2)
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 4679d900be2..0098515583b 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -1,6 +1,3 @@
-# Keep equal to .nvmrc: nvm and actions/setup-node read .nvmrc, pnpm uses this one for every pnpm command. CI fails when they differ. On a major bump also update the engines.node range in .syncpackrc.
-useNodeVersion: 24.22.3
-
 catalogs:
     # A curated set of `@wordpress/*` packages that are bundled with our minimum supported WordPress version.
     wp-min:
@@ -152,7 +149,6 @@ patchedDependencies:

 # Quality of life tweaks (migrated from .npmrc)
 childConcurrency: 8 # 5 by default
-confirmModulesPurge: false
 modulesCacheMaxAge: 20160 # two weeks in minutes
 updateNotifier: false
 virtualStoreDirMaxLength: 60
diff --git a/tools/compare-perf/performance.js b/tools/compare-perf/performance.js
index 98e73832147..1da90c5ed0b 100644
--- a/tools/compare-perf/performance.js
+++ b/tools/compare-perf/performance.js
@@ -29,13 +29,13 @@ const ARTIFACTS_PATH =
  * Wraps a setup/build command so it runs under bash and, when nvm happens to be
  * installed, aligns Node with the checked-out ref's `.nvmrc`.
  *
- * nvm is no longer required: refs built here pin their Node version through
- * pnpm's `useNodeVersion` setting (pnpm-workspace.yaml), so pnpm provisions and
- * uses the correct runtime for every pnpm invocation on its own. Sourcing nvm is
- * kept only as a best-effort fallback for older refs that predate
- * `useNodeVersion`, and is skipped silently when nvm isn't present so the tool
- * works without it. The first `npm`/`pnpm` call still needs a base Node on PATH,
- * which the caller's environment provides (in CI via actions/setup-node).
+ * Refs pin their Node version in `.nvmrc` and, on current refs, in
+ * `devEngines.runtime` (package.json), which makes pnpm fail on any other Node.
+ * Older refs used pnpm's `useNodeVersion`, which provisioned the runtime itself.
+ * Sourcing nvm is a best-effort way to select the pinned Node, and is skipped
+ * silently when nvm isn't present so the tool works without it. The first
+ * `npm`/`pnpm` call still needs a base Node on PATH, which the caller's
+ * environment provides (in CI via actions/setup-node).
  *
  * @param {string} command Setup/build command to run.
  *
diff --git a/tools/theme-cli/changelog/upgrade-pnpm-12 b/tools/theme-cli/changelog/upgrade-pnpm-12
new file mode 100644
index 00000000000..de3655f751d
--- /dev/null
+++ b/tools/theme-cli/changelog/upgrade-pnpm-12
@@ -0,0 +1,3 @@
+Significance: patch
+Type: dev
+Comment: Declare the shared ESLint config as a dev dependency for the pnpm 12 upgrade; no theme change.
diff --git a/tools/theme-cli/package.json b/tools/theme-cli/package.json
index 7235238b201..497826a4474 100644
--- a/tools/theme-cli/package.json
+++ b/tools/theme-cli/package.json
@@ -15,6 +15,7 @@
 		"wp-env": "node scripts/env.mjs"
 	},
 	"devDependencies": {
+		"@woocommerce/eslint-config": "workspace:*",
 		"@wordpress/env": "catalog:tooling",
 		"@wordpress/scripts": "catalog:tooling"
 	},