@plaudit/pnpm-plugin-plaudit-config 1.12.1 → 1.12.2
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,10 @@ 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.12.2] - 2026-05-28
|
|
9
|
+
### Fixed
|
|
10
|
+
- The `@wordpress/dependency-extraction-webpack-plugin` patch not handling the same module being imported in different ways across multiple files
|
|
11
|
+
|
|
8
12
|
## [1.12.1] - 2026-05-27
|
|
9
13
|
### Fixed
|
|
10
14
|
- My code not accounting for PNPM's buggy peerDependencies handling
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
diff --git a/lib/index.js b/lib/index.js
|
|
2
|
-
index 8bc7cb29312161fde29039f146c9f0de4d278fc8..
|
|
2
|
+
index 8bc7cb29312161fde29039f146c9f0de4d278fc8..36eac734bc4b73626886c24c40a8104001eeb548 100644
|
|
3
3
|
--- a/lib/index.js
|
|
4
4
|
+++ b/lib/index.js
|
|
5
5
|
@@ -88,9 +88,19 @@ class DependencyExtractionWebpackPlugin {
|
|
@@ -25,7 +25,7 @@ index 8bc7cb29312161fde29039f146c9f0de4d278fc8..888f7a0dacf42ddea85ad6a0b44ff1f0
|
|
|
25
25
|
}
|
|
26
26
|
} catch ( err ) {
|
|
27
27
|
return callback( err );
|
|
28
|
-
@@ -289,6 +299,
|
|
28
|
+
@@ -289,6 +299,13 @@ class DependencyExtractionWebpackPlugin {
|
|
29
29
|
const chunkStaticDeps = new Set();
|
|
30
30
|
/** @type {Set<string>} */
|
|
31
31
|
const chunkDynamicDeps = new Set();
|
|
@@ -33,24 +33,36 @@ index 8bc7cb29312161fde29039f146c9f0de4d278fc8..888f7a0dacf42ddea85ad6a0b44ff1f0
|
|
|
33
33
|
+ const chunkScriptModuleStaticDeps = new Set();
|
|
34
34
|
+ /** @type {Set<string>} */
|
|
35
35
|
+ const chunkScriptModuleDynamicDeps = new Set();
|
|
36
|
+
+
|
|
37
|
+
+ const staticDepsCurrent = new WeakSet();
|
|
38
|
+
+ const staticDepsCache = new WeakMap();
|
|
36
39
|
|
|
37
40
|
if ( injectPolyfill ) {
|
|
38
41
|
chunkStaticDeps.add( 'wp-polyfill' );
|
|
39
|
-
@@ -
|
|
42
|
+
@@ -303,6 +320,8 @@ class DependencyExtractionWebpackPlugin {
|
|
43
|
+
if ( this.useModules ) {
|
|
44
|
+
const isStatic =
|
|
45
|
+
DependencyExtractionWebpackPlugin.hasStaticDependencyPathToRoot(
|
|
46
|
+
+ staticDepsCache,
|
|
47
|
+
+ staticDepsCurrent,
|
|
48
|
+
compilation,
|
|
49
|
+
m
|
|
50
|
+
);
|
|
51
|
+
@@ -310,12 +329,47 @@ class DependencyExtractionWebpackPlugin {
|
|
40
52
|
( isStatic ? chunkStaticDeps : chunkDynamicDeps ).add(
|
|
41
53
|
m.request
|
|
42
54
|
);
|
|
43
55
|
+ } else if ( m.externalType === 'import' || m.externalType === 'module') {
|
|
44
56
|
+ const isStatic =
|
|
45
|
-
+
|
|
46
|
-
+
|
|
47
|
-
+
|
|
48
|
-
+
|
|
57
|
+
+ DependencyExtractionWebpackPlugin.hasStaticDependencyPathToRoot(
|
|
58
|
+
+ staticDepsCache,
|
|
59
|
+
+ staticDepsCurrent,
|
|
60
|
+
+ compilation,
|
|
61
|
+
+ m
|
|
62
|
+
+ );
|
|
49
63
|
+
|
|
50
|
-
+ (isStatic
|
|
51
|
-
+
|
|
52
|
-
+ : chunkScriptModuleDynamicDeps
|
|
53
|
-
+ ).add(userRequest);
|
|
64
|
+
+ (isStatic ? chunkScriptModuleStaticDeps : chunkScriptModuleDynamicDeps)
|
|
65
|
+
+ .add(userRequest);
|
|
54
66
|
} else {
|
|
55
67
|
chunkStaticDeps.add(
|
|
56
68
|
this.mapRequestToDependency( userRequest )
|
|
@@ -59,9 +71,24 @@ index 8bc7cb29312161fde29039f146c9f0de4d278fc8..888f7a0dacf42ddea85ad6a0b44ff1f0
|
|
|
59
71
|
}
|
|
60
72
|
+ if (m.blocks) {
|
|
61
73
|
+ for (const block of m.blocks) {
|
|
62
|
-
+ if (block.constructor.name
|
|
63
|
-
+
|
|
64
|
-
+
|
|
74
|
+
+ if (block.constructor.name !== AsyncDependenciesBlock.name && block.constructor.name !== DependenciesBlock.name) {
|
|
75
|
+
+ continue;
|
|
76
|
+
+ }
|
|
77
|
+
+ for (const dep of block.dependencies) {
|
|
78
|
+
+ if (this.externalizedDeps.has(dep.userRequest)) {
|
|
79
|
+
+ if (block.constructor.name === AsyncDependenciesBlock.name) {
|
|
80
|
+
+ if (this.useModules) {
|
|
81
|
+
+ chunkDynamicDeps.add(dep.request);
|
|
82
|
+
+ } else {
|
|
83
|
+
+ chunkScriptModuleDynamicDeps.add(dep.userRequest)
|
|
84
|
+
+ }
|
|
85
|
+
+ } else {
|
|
86
|
+
+ if (this.useModules) {
|
|
87
|
+
+ chunkStaticDeps.add(dep.request);
|
|
88
|
+
+ } else {
|
|
89
|
+
+ chunkScriptModuleStaticDeps.add(dep.userRequest)
|
|
90
|
+
+ }
|
|
91
|
+
+ }
|
|
65
92
|
+ }
|
|
66
93
|
+ }
|
|
67
94
|
+ }
|
|
@@ -69,7 +96,7 @@ index 8bc7cb29312161fde29039f146c9f0de4d278fc8..888f7a0dacf42ddea85ad6a0b44ff1f0
|
|
|
69
96
|
};
|
|
70
97
|
|
|
71
98
|
// Search for externalized modules in all chunks.
|
|
72
|
-
@@ -383,6 +
|
|
99
|
+
@@ -383,6 +437,18 @@ class DependencyExtractionWebpackPlugin {
|
|
73
100
|
version: contentHash,
|
|
74
101
|
};
|
|
75
102
|
|
|
@@ -88,3 +115,84 @@ index 8bc7cb29312161fde29039f146c9f0de4d278fc8..888f7a0dacf42ddea85ad6a0b44ff1f0
|
|
|
88
115
|
if ( this.useModules ) {
|
|
89
116
|
assetData.type = 'module';
|
|
90
117
|
}
|
|
118
|
+
@@ -444,9 +510,6 @@ class DependencyExtractionWebpackPlugin {
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
- static #staticDepsCurrent = new WeakSet();
|
|
123
|
+
- static #staticDepsCache = new WeakMap();
|
|
124
|
+
-
|
|
125
|
+
/**
|
|
126
|
+
* Can we trace a line of static dependencies from an entry to a module
|
|
127
|
+
*
|
|
128
|
+
@@ -455,20 +518,20 @@ class DependencyExtractionWebpackPlugin {
|
|
129
|
+
*
|
|
130
|
+
* @return {boolean} True if there is a static import path to the root
|
|
131
|
+
*/
|
|
132
|
+
- static hasStaticDependencyPathToRoot( compilation, block ) {
|
|
133
|
+
- if ( DependencyExtractionWebpackPlugin.#staticDepsCache.has( block ) ) {
|
|
134
|
+
- return DependencyExtractionWebpackPlugin.#staticDepsCache.get(
|
|
135
|
+
+ static hasStaticDependencyPathToRoot( staticDepsCache, staticDepsCurrent, compilation, block ) {
|
|
136
|
+
+ if ( staticDepsCache.has( block ) ) {
|
|
137
|
+
+ return staticDepsCache.get(
|
|
138
|
+
block
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (
|
|
143
|
+
- DependencyExtractionWebpackPlugin.#staticDepsCurrent.has( block )
|
|
144
|
+
+ staticDepsCurrent.has( block )
|
|
145
|
+
) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
- DependencyExtractionWebpackPlugin.#staticDepsCurrent.add( block );
|
|
150
|
+
+ staticDepsCurrent.add( block );
|
|
151
|
+
|
|
152
|
+
const incomingConnections = [
|
|
153
|
+
...compilation.moduleGraph.getIncomingConnections( block ),
|
|
154
|
+
@@ -483,11 +546,11 @@ class DependencyExtractionWebpackPlugin {
|
|
155
|
+
// If we don't have non-entry, non-library incoming connections,
|
|
156
|
+
// we've reached a root of
|
|
157
|
+
if ( ! incomingConnections.length ) {
|
|
158
|
+
- DependencyExtractionWebpackPlugin.#staticDepsCache.set(
|
|
159
|
+
+ staticDepsCache.set(
|
|
160
|
+
block,
|
|
161
|
+
true
|
|
162
|
+
);
|
|
163
|
+
- DependencyExtractionWebpackPlugin.#staticDepsCurrent.delete(
|
|
164
|
+
+ staticDepsCurrent.delete(
|
|
165
|
+
block
|
|
166
|
+
);
|
|
167
|
+
return true;
|
|
168
|
+
@@ -508,11 +571,11 @@ class DependencyExtractionWebpackPlugin {
|
|
169
|
+
|
|
170
|
+
// All the dependencies were Async, the module was reached via a dynamic import
|
|
171
|
+
if ( ! staticDependentModules.length ) {
|
|
172
|
+
- DependencyExtractionWebpackPlugin.#staticDepsCache.set(
|
|
173
|
+
+ staticDepsCache.set(
|
|
174
|
+
block,
|
|
175
|
+
false
|
|
176
|
+
);
|
|
177
|
+
- DependencyExtractionWebpackPlugin.#staticDepsCurrent.delete(
|
|
178
|
+
+ staticDepsCurrent.delete(
|
|
179
|
+
block
|
|
180
|
+
);
|
|
181
|
+
return false;
|
|
182
|
+
@@ -522,13 +585,14 @@ class DependencyExtractionWebpackPlugin {
|
|
183
|
+
const result = staticDependentModules.some(
|
|
184
|
+
( parentStaticDependentModule ) =>
|
|
185
|
+
DependencyExtractionWebpackPlugin.hasStaticDependencyPathToRoot(
|
|
186
|
+
+ staticDepsCache, staticDepsCurrent,
|
|
187
|
+
compilation,
|
|
188
|
+
parentStaticDependentModule
|
|
189
|
+
)
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
- DependencyExtractionWebpackPlugin.#staticDepsCache.set( block, result );
|
|
193
|
+
- DependencyExtractionWebpackPlugin.#staticDepsCurrent.delete( block );
|
|
194
|
+
+ staticDepsCache.set( block, result );
|
|
195
|
+
+ staticDepsCurrent.delete( block );
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
}
|