@plaudit/pnpm-plugin-plaudit-config 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.8.0] - 2026-05-13
9
+ ### Added
10
+ - Exported constants to make automation scripts that account for this dependency being present easier
11
+
12
+ ## [1.7.0] - 2026-05-11
13
+ ### Added
14
+ - `fs-ext-extra-prebuilt` to the list of packages with denied build scripts
15
+ - Thanks WordPress!
16
+
8
17
  ## [1.6.0] - 2026-05-04
9
18
  ### Added
10
19
  - `minimatch@^9` to the list of overrides
package/dist/lib.d.mts ADDED
@@ -0,0 +1,17 @@
1
+ export declare const DEFAULT_ALLOWED_BUILDS: {
2
+ readonly "@parcel/watcher": false;
3
+ readonly "core-js": true;
4
+ readonly "core-js-pure": true;
5
+ readonly "fs-ext-extra-prebuilt": false;
6
+ readonly "unrs-resolver": false;
7
+ };
8
+ export declare function addVersionScopingToOverrides(overrides: Record<string, string>): {
9
+ [k: string]: string;
10
+ };
11
+ export declare const DEFAULT_OVERRIDES: {
12
+ readonly "react-autosize-textarea>react": "*";
13
+ readonly "react-autosize-textarea>react-dom": "*";
14
+ readonly "@wordpress/scripts>postcss-loader": "-";
15
+ readonly "@types/wordpress__blocks": "-";
16
+ };
17
+ //# sourceMappingURL=lib.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.d.mts","sourceRoot":"","sources":["../src/lib.mts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB;;;;;;CAMzB,CAAC;AAEX,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;EAY7E;AAED,eAAO,MAAM,iBAAiB;;;;;CAoBpB,CAAC"}
package/dist/lib.mjs ADDED
@@ -0,0 +1,40 @@
1
+ export const DEFAULT_ALLOWED_BUILDS = {
2
+ "@parcel/watcher": false,
3
+ "core-js": true,
4
+ "core-js-pure": true,
5
+ "fs-ext-extra-prebuilt": false,
6
+ "unrs-resolver": false,
7
+ };
8
+ export function addVersionScopingToOverrides(overrides) {
9
+ return Object.fromEntries(Object.entries(overrides)
10
+ .map(([pkg, targetVersion]) => {
11
+ let scopingVersion = targetVersion;
12
+ while (!/^\d/.test(scopingVersion) && scopingVersion.length > 0) {
13
+ scopingVersion = scopingVersion.substring(1);
14
+ }
15
+ if (scopingVersion.length === 0) {
16
+ throw new Error(`Could not convert "${targetVersion}" into a simple version`);
17
+ }
18
+ return [`${pkg}@<${scopingVersion}`, targetVersion];
19
+ }));
20
+ }
21
+ export const DEFAULT_OVERRIDES = {
22
+ "react-autosize-textarea>react": "*",
23
+ "react-autosize-textarea>react-dom": "*",
24
+ "@wordpress/scripts>postcss-loader": "-",
25
+ "@types/wordpress__blocks": "-",
26
+ ...addVersionScopingToOverrides({
27
+ "@floating-ui/react-dom": "^2.1.8",
28
+ "@radix-ui/react-slot": "^1.2.4",
29
+ "@radix-ui/react-primitive": "^2.1.4",
30
+ "@wordpress/components": "^33.0.0",
31
+ "date-fns": "^4.0.0",
32
+ "diff": "^8.0.4",
33
+ "framer-motion": "^12.38.0",
34
+ "micromatch": "^4",
35
+ "minimatch": "^9",
36
+ "react-is": "^18.3.1",
37
+ "uuid": "^11.1.1"
38
+ })
39
+ };
40
+ //# sourceMappingURL=lib.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.mjs","sourceRoot":"","sources":["../src/lib.mts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,iBAAiB,EAAE,KAAK;IACxB,SAAS,EAAE,IAAI;IACf,cAAc,EAAE,IAAI;IACpB,uBAAuB,EAAE,KAAK;IAC9B,eAAe,E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akedPnpmSettings = PnpmSettings & LockfileSettings & {
4
+ rootProjectManifest?: {
5
+ pnpm?: MergeablePnpmSettings;
6
+ };
7
+ minimumReleaseAgeExclude?: string[];
8
+ nodeLinker?: string;
9
+ };
10
+ type MergeablePnpmSettings = {
11
+ onlyBuiltDependencies?: string[];
12
+ ignoredBuiltDependencies?: string[];
13
+ projectAllowBuilds?: PnpmSettings['allowBuilds'];
14
+ projectOverrides?: PnpmSettings['overrides'];
15
+ projectPatchedDependencies?: PnpmSettings['patchedDependencies'];
16
+ };
17
+ declare const _default: {
18
+ hooks: {
19
+ readPackage<Pkg extends import("@pnpm/types").BaseManifest>(pkg: Pkg): Pkg;
20
+ updateConfig(config: FakedPnpmSettings): PnpmSettings & LockfileSettings & {
21
+ rootProjectManifest?: {
22
+ pnpm?: MergeablePnpmSettings;
23
+ };
24
+ minimumReleaseAgeExclude?: string[];
25
+ nodeLinker?: string;
26
+ } & {
27
+ allowBuilds: {
28
+ "@parcel/watcher": false;
29
+ "core-js": true;
30
+ "core-js-pure": true;
31
+ "fs-ext-extra-prebuilt": false;
32
+ "unrs-resolver": false;
33
+ };
34
+ overrides: {
35
+ "react-autosize-textarea>react": "*";
36
+ "react-autosize-textarea>react-dom": "*";
37
+ "@wordpress/scripts>postcss-loader": "-";
38
+ "@types/wordpress__blocks": "-";
39
+ };
40
+ patchedDependencies: {
41
+ [x: string]: string;
42
+ };
43
+ allowUnusedPatches: true;
44
+ dedupePeers: true;
45
+ minimumReleaseAgeExclude: string[];
46
+ nodeLinker: string;
47
+ };
48
+ };
49
+ };
50
+ export default _default;
51
+ //# sourceMappingURL=pnpmfile.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pnpmfile.d.mts","sourceRoot":"","sources":["../src/pnpmfile.mts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAc9C,KAAK,iBAAiB,GAAG,YAAY,GAAC,gBAAgB,GAAC;IAAC,mBAAmB,CAAC,EAAE;QAAC,IAAI,CAAC,EAAE,qBAAqB,CAAA;KAAC,CAAC;IAAC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC;AAGxK,KAAK,qBAAqB,GAAG;IAC5B,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IACpC,kBAAkB,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IACjD,gBAAgB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAC7C,0BAA0B,CAAC,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAA;CAChE,CAAC;;;;6BA4BqB,iBAAiB;kCArCsC;gBAAC,IAAI,CAAC,EAAE,qBAAqB,CAAA;aAAC;uCAA6B,MAAM,EAAE;yBAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;AAatK,wBAmDE"}
@@ -1,6 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const { join } = require("node:path");
1
+ import { join } from "node:path";
2
+ import { DEFAULT_ALLOWED_BUILDS, DEFAULT_OVERRIDES } from "./lib.mjs";
4
3
  /**
5
4
  * A map of "<package id>[@<version identifier>]" -> "file in the 'patches' folder" pairs
6
5
  */
@@ -10,7 +9,7 @@ const activePatches = {
10
9
  const globalForcePinDependenciesRegex = false; ///^@wordpress\//;
11
10
  const dependencyKeys = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'];
12
11
  let rootPkg = undefined;
13
- module.exports = {
12
+ export default {
14
13
  hooks: {
15
14
  readPackage(pkg) {
16
15
  if (globalForcePinDependenciesRegex) {
@@ -39,33 +38,14 @@ module.exports = {
39
38
  const mergeableConfig = config.rootProjectManifest?.pnpm ?? {};
40
39
  return Object.assign(config, {
41
40
  allowBuilds: {
42
- "core-js": true,
43
- "core-js-pure": true,
44
- "@parcel/watcher": false,
45
- "unrs-resolver": false,
41
+ ...DEFAULT_ALLOWED_BUILDS,
46
42
  ...Object.fromEntries((mergeableConfig.onlyBuiltDependencies ?? []).map(dep => [dep, true])),
47
43
  ...Object.fromEntries((mergeableConfig.ignoredBuiltDependencies ?? []).map(dep => [dep, false])),
48
44
  ...config.allowBuilds,
49
45
  ...mergeableConfig.projectAllowBuilds,
50
46
  },
51
47
  overrides: {
52
- "react-autosize-textarea>react": "*",
53
- "react-autosize-textarea>react-dom": "*",
54
- "@wordpress/scripts>postcss-loader": "-",
55
- "@types/wordpress__blocks": "-",
56
- ...addVersionScopingToOverrides({
57
- "@floating-ui/react-dom": "^2.1.8",
58
- "@radix-ui/react-slot": "^1.2.4",
59
- "@radix-ui/react-primitive": "^2.1.4",
60
- "@wordpress/components": "^33.0.0",
61
- "date-fns": "^4.0.0",
62
- "diff": "^8.0.4",
63
- "framer-motion": "^12.38.0",
64
- "micromatch": "^4",
65
- "minimatch": "^9",
66
- "react-is": "^18.3.1",
67
- "uuid": "^11.1.1"
68
- }),
48
+ ...DEFAULT_OVERRIDES,
69
49
  ...config.overrides,
70
50
  ...mergeableConfig.projectOverrides
71
51
  },
@@ -89,17 +69,4 @@ function forcePinDependencies(pattern, dependenciesObject) {
89
69
  return Object.fromEntries(Object.entries(dependenciesObject)
90
70
  .map(([key, value]) => pattern.test(key) ? [key, value.startsWith("^") ? value.substring(1) : value] : [key, value]));
91
71
  }
92
- function addVersionScopingToOverrides(overrides) {
93
- return Object.fromEntries(Object.entries(overrides)
94
- .map(([pkg, targetVersion]) => {
95
- let scopingVersion = targetVersion;
96
- while (!/^\d/.test(scopingVersion) && scopingVersion.length > 0) {
97
- scopingVersion = scopingVersion.substring(1);
98
- }
99
- if (scopingVersion.length === 0) {
100
- throw new Error(`Could not convert "${targetVersion}" into a simple version`);
101
- }
102
- return [`${pkg}@<${scopingVersion}`, targetVersion];
103
- }));
104
- }
105
- //# sourceMappingURL=pnpmfile.cjs.map
72
+ //# sourceMappingURL=pnpmfile.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pnpmfile.mjs","sourceRoot":"","sources":["../src/pnpmfile.mts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAM/B,OAAO,EAAC,sBAAsB,EAAE,iBAAiB,EAAC,MAAM,WAAW,CAAC;AAEpE;;GAEG;AACH,MAAM,aAAa,GAA2B;AAC7C,iCAAiC;CACxB,CAAC;AACX,MAAM,+BAA+B,GAAG,KAAK,CAAC,CAAA,kBAAkB;AAEhE,MAAM,cAAc,GAAG,CAAC,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,sBAAsB,CAAU,CAAC;AAahH,IAAI,OAAO,GAAuE,SAAS,CAAC;AAE5F,eAAe;IACd,KAAK,EAAE;QACN,WAAW,CAAC,GAAG;YACd,IAAI,+BAA+B,EAAE,CAAC;gBACrC,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;oBAC5C,IAAI,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;wBACxB,GAAG,CAAC,aAAa,CAAC,GAAG,oBAAoB,CAAC,+BAA+B,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;oBAChG,CAAC;gBACF,CAAC;YACF,CAAC;YACD,IAAI,OAAO,KAAK,SAAS,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;gBAC9C,OAAO,GAAG,GAAG,CAAC;YACf,CAAC;iBAAM,CAAC;gBACP,IAAI,GAAG,CAAC,gBAAgB,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;oBAC3C,GAAG,CAAC,gBAAgB,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC;gBAClD,CAAC;gBACD,IAAI,GAAG,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAC;oBAClC,IAAI,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC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mB;oBAC7B,GAAG,eAAe,CAAC,0BAA0B;iBAC7C;gBACD,kBAAkB,EAAE,IAAI;gBACxB,WAAW,EAAE,IAAI;gBACjB,wBAAwB,EAAE,CAAC,YAAY,CAAC;gBACxC,UAAU,EAAE,SAAS;aACO,CAAC,CAAC;QAChC,CAAC;KACuB;CACzB,CAAC;AAEF,SAAS,oBAAoB,CAAC,OAAe,EAAE,kBAA0C;IACxF,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACzB,OAAO,kBAAkB,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC,WAAW,CACxB,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC;SAChC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CACrH,CAAC;AACH,CAAC"}
package/lib.mjs ADDED
@@ -0,0 +1,40 @@
1
+ export const DEFAULT_ALLOWED_BUILDS = {
2
+ "@parcel/watcher": false,
3
+ "core-js": true,
4
+ "core-js-pure": true,
5
+ "fs-ext-extra-prebuilt": false,
6
+ "unrs-resolver": false,
7
+ };
8
+ export function addVersionScopingToOverrides(overrides) {
9
+ return Object.fromEntries(Object.entries(overrides)
10
+ .map(([pkg, targetVersion]) => {
11
+ let scopingVersion = targetVersion;
12
+ while (!/^\d/.test(scopingVersion) && scopingVersion.length > 0) {
13
+ scopingVersion = scopingVersion.substring(1);
14
+ }
15
+ if (scopingVersion.length === 0) {
16
+ throw new Error(`Could not convert "${targetVersion}" into a simple version`);
17
+ }
18
+ return [`${pkg}@<${scopingVersion}`, targetVersion];
19
+ }));
20
+ }
21
+ export const DEFAULT_OVERRIDES = {
22
+ "react-autosize-textarea>react": "*",
23
+ "react-autosize-textarea>react-dom": "*",
24
+ "@wordpress/scripts>postcss-loader": "-",
25
+ "@types/wordpress__blocks": "-",
26
+ ...addVersionScopingToOverrides({
27
+ "@floating-ui/react-dom": "^2.1.8",
28
+ "@radix-ui/react-slot": "^1.2.4",
29
+ "@radix-ui/react-primitive": "^2.1.4",
30
+ "@wordpress/components": "^33.0.0",
31
+ "date-fns": "^4.0.0",
32
+ "diff": "^8.0.4",
33
+ "framer-motion": "^12.38.0",
34
+ "micromatch": "^4",
35
+ "minimatch": "^9",
36
+ "react-is": "^18.3.1",
37
+ "uuid": "^11.1.1"
38
+ })
39
+ };
40
+ //# sourceMappingURL=lib.mjs.map
package/package.json CHANGED
@@ -1,22 +1,28 @@
1
1
  {
2
2
  "name": "@plaudit/pnpm-plugin-plaudit-config",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
+ "exports": {
6
+ ".": "./dist/lib.mjs"
7
+ },
8
+ "type": "module",
5
9
  "files": [
10
+ "./dist",
6
11
  "./patches",
7
- "./pnpmfile.cjs",
12
+ "./*.cjs",
13
+ "./*.mjs",
8
14
  "CHANGELOG.md",
9
15
  "LICENSE.md",
10
16
  "README.md"
11
17
  ],
12
18
  "sideEffects": false,
13
19
  "devDependencies": {
14
- "@pnpm/hooks.pnpmfile": "^1100.0.4",
20
+ "@pnpm/hooks.pnpmfile": "^1100.0.6",
15
21
  "@pnpm/types": "^1101.0.0",
16
22
  "typescript": "^6.0.3"
17
23
  },
18
24
  "scripts": {
19
- "build": "tsc && cp -f dist/pnpmfile.cjs .",
20
- "clean": "rm -rf dist pnpmfile.cjs"
25
+ "build": "tsc && cp -f dist/*.[cm]js .",
26
+ "clean": "rm -rf dist *.[cm]js"
21
27
  }
22
28
  }
package/pnpmfile.mjs ADDED
@@ -0,0 +1,72 @@
1
+ import { join } from "node:path";
2
+ import { DEFAULT_ALLOWED_BUILDS, DEFAULT_OVERRIDES } from "./lib.mjs";
3
+ /**
4
+ * A map of "<package id>[@<version identifier>]" -> "file in the 'patches' folder" pairs
5
+ */
6
+ const activePatches = {
7
+ // "webpack@5.*": "webpack.patch"
8
+ };
9
+ const globalForcePinDependenciesRegex = false; ///^@wordpress\//;
10
+ const dependencyKeys = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'];
11
+ let rootPkg = undefined;
12
+ export default {
13
+ hooks: {
14
+ readPackage(pkg) {
15
+ if (globalForcePinDependenciesRegex) {
16
+ for (const dependencyKey of dependencyKeys) {
17
+ if (pkg[dependencyKey]) {
18
+ pkg[dependencyKey] = forcePinDependencies(globalForcePinDependenciesRegex, pkg[dependencyKey]);
19
+ }
20
+ }
21
+ }
22
+ if (rootPkg === undefined || pkg === rootPkg) {
23
+ rootPkg = pkg;
24
+ }
25
+ else {
26
+ if (pkg.peerDependencies?.['@types/node']) {
27
+ pkg.peerDependencies['@types/node'] += " || >24";
28
+ }
29
+ if (pkg.peerDependencies?.eslint) {
30
+ if (pkg.peerDependencies.eslint.includes("^9") && !pkg.peerDependencies.eslint.includes("^10")) {
31
+ pkg.peerDependencies.eslint += " || ^10.0.0";
32
+ }
33
+ }
34
+ }
35
+ return pkg;
36
+ },
37
+ updateConfig(config) {
38
+ const mergeableConfig = config.rootProjectManifest?.pnpm ?? {};
39
+ return Object.assign(config, {
40
+ allowBuilds: {
41
+ ...DEFAULT_ALLOWED_BUILDS,
42
+ ...Object.fromEntries((mergeableConfig.onlyBuiltDependencies ?? []).map(dep => [dep, true])),
43
+ ...Object.fromEntries((mergeableConfig.ignoredBuiltDependencies ?? []).map(dep => [dep, false])),
44
+ ...config.allowBuilds,
45
+ ...mergeableConfig.projectAllowBuilds,
46
+ },
47
+ overrides: {
48
+ ...DEFAULT_OVERRIDES,
49
+ ...config.overrides,
50
+ ...mergeableConfig.projectOverrides
51
+ },
52
+ patchedDependencies: {
53
+ ...Object.fromEntries(Object.entries(activePatches).map(([dependency, patchFilePath]) => [dependency, join(__dirname, 'patches', patchFilePath)])),
54
+ ...config.patchedDependencies,
55
+ ...mergeableConfig.projectPatchedDependencies
56
+ },
57
+ allowUnusedPatches: true,
58
+ dedupePeers: true,
59
+ minimumReleaseAgeExclude: ["@plaudit/*"],
60
+ nodeLinker: "hoisted"
61
+ });
62
+ }
63
+ },
64
+ };
65
+ function forcePinDependencies(pattern, dependenciesObject) {
66
+ if (!dependenciesObject) {
67
+ return dependenciesObject;
68
+ }
69
+ return Object.fromEntries(Object.entries(dependenciesObject)
70
+ .map(([key, value]) => pattern.test(key) ? [key, value.startsWith("^") ? value.substring(1) : value] : [key, value]));
71
+ }
72
+ //# sourceMappingURL=pnpmfile.mjs.map