@wordpress/dependency-extraction-webpack-plugin 6.8.1 → 6.8.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/lib/index.js +41 -5
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -369,6 +369,9 @@ class DependencyExtractionWebpackPlugin {
|
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
+
static #staticDepsCurrent = new WeakSet();
|
|
373
|
+
static #staticDepsCache = new WeakMap();
|
|
374
|
+
|
|
372
375
|
/**
|
|
373
376
|
* Can we trace a line of static dependencies from an entry to a module
|
|
374
377
|
*
|
|
@@ -378,6 +381,20 @@ class DependencyExtractionWebpackPlugin {
|
|
|
378
381
|
* @return {boolean} True if there is a static import path to the root
|
|
379
382
|
*/
|
|
380
383
|
static hasStaticDependencyPathToRoot( compilation, block ) {
|
|
384
|
+
if ( DependencyExtractionWebpackPlugin.#staticDepsCache.has( block ) ) {
|
|
385
|
+
return DependencyExtractionWebpackPlugin.#staticDepsCache.get(
|
|
386
|
+
block
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (
|
|
391
|
+
DependencyExtractionWebpackPlugin.#staticDepsCurrent.has( block )
|
|
392
|
+
) {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
DependencyExtractionWebpackPlugin.#staticDepsCurrent.add( block );
|
|
397
|
+
|
|
381
398
|
const incomingConnections = [
|
|
382
399
|
...compilation.moduleGraph.getIncomingConnections( block ),
|
|
383
400
|
].filter(
|
|
@@ -391,6 +408,13 @@ class DependencyExtractionWebpackPlugin {
|
|
|
391
408
|
// If we don't have non-entry, non-library incoming connections,
|
|
392
409
|
// we've reached a root of
|
|
393
410
|
if ( ! incomingConnections.length ) {
|
|
411
|
+
DependencyExtractionWebpackPlugin.#staticDepsCache.set(
|
|
412
|
+
block,
|
|
413
|
+
true
|
|
414
|
+
);
|
|
415
|
+
DependencyExtractionWebpackPlugin.#staticDepsCurrent.delete(
|
|
416
|
+
block
|
|
417
|
+
);
|
|
394
418
|
return true;
|
|
395
419
|
}
|
|
396
420
|
|
|
@@ -409,16 +433,28 @@ class DependencyExtractionWebpackPlugin {
|
|
|
409
433
|
|
|
410
434
|
// All the dependencies were Async, the module was reached via a dynamic import
|
|
411
435
|
if ( ! staticDependentModules.length ) {
|
|
436
|
+
DependencyExtractionWebpackPlugin.#staticDepsCache.set(
|
|
437
|
+
block,
|
|
438
|
+
false
|
|
439
|
+
);
|
|
440
|
+
DependencyExtractionWebpackPlugin.#staticDepsCurrent.delete(
|
|
441
|
+
block
|
|
442
|
+
);
|
|
412
443
|
return false;
|
|
413
444
|
}
|
|
414
445
|
|
|
415
446
|
// Continue to explore any static dependencies
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
447
|
+
const result = staticDependentModules.some(
|
|
448
|
+
( parentStaticDependentModule ) =>
|
|
449
|
+
DependencyExtractionWebpackPlugin.hasStaticDependencyPathToRoot(
|
|
450
|
+
compilation,
|
|
451
|
+
parentStaticDependentModule
|
|
452
|
+
)
|
|
421
453
|
);
|
|
454
|
+
|
|
455
|
+
DependencyExtractionWebpackPlugin.#staticDepsCache.set( block, result );
|
|
456
|
+
DependencyExtractionWebpackPlugin.#staticDepsCurrent.delete( block );
|
|
457
|
+
return result;
|
|
422
458
|
}
|
|
423
459
|
}
|
|
424
460
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/dependency-extraction-webpack-plugin",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.2",
|
|
4
4
|
"description": "Extract WordPress script dependencies from webpack bundles.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "51204ac9382d0551d8fdebd3c8d4623dabfa9f3c"
|
|
42
42
|
}
|