@plaudit/webpack-extensions 2.42.5 → 2.43.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.
@@ -78,7 +78,7 @@ function makeDependencyExtractionPluginProps(externals, assumeGlobalizedPlauditL
78
78
  }
79
79
  }
80
80
  const PLAUDIT_NAMESPACE = '@plaudit/';
81
- const EXTERNALIZABLE_PLAUDIT_LIBRARIES = ['@plaudit/library-extensions'];
81
+ const EXTERNALIZABLE_PLAUDIT_LIBRARIES = ['@plaudit/frontend-apis', '@plaudit/library-extensions'];
82
82
  function plauditRequestToExternal(request) {
83
83
  if (EXTERNALIZABLE_PLAUDIT_LIBRARIES.includes(request)) {
84
84
  return ['plaudit', camelCaseDash(request.substring(PLAUDIT_NAMESPACE.length))];
@@ -7,6 +7,7 @@ interface AdvancedOutputConfig {
7
7
  additionalDependencies?: string[];
8
8
  directoryLayout?: 'blocks' | 'extensions' | 'plain';
9
9
  assumeGlobalizedPlauditLibraries?: boolean;
10
+ externalize?: string[] | Required<Configuration>['output']['library'];
10
11
  }
11
12
  type PlauditWordpressWebpackConfig = {
12
13
  standaloneBlocks?: boolean;
@@ -478,6 +478,30 @@ function processIndividualWebpackConfig(config, webpackConfig, sources) {
478
478
  }
479
479
  const distinctViableRoots = new Set();
480
480
  viableRoots = viableRoots.filter(value => distinctViableRoots.has(value) ? false : distinctViableRoots.add(value) && true);
481
+ let outputLibrary;
482
+ if (typeof dest === 'object' && dest.externalize) {
483
+ if (Array.isArray(dest.externalize) || typeof dest.externalize === 'string') {
484
+ outputLibrary = {
485
+ name: dest.externalize,
486
+ type: "assign"
487
+ };
488
+ }
489
+ else {
490
+ const originalLibrary = webpackConfig.output?.library;
491
+ if (originalLibrary && typeof originalLibrary === 'object' && !Array.isArray(originalLibrary)) {
492
+ outputLibrary = {
493
+ ...originalLibrary,
494
+ ...dest.externalize
495
+ };
496
+ }
497
+ else {
498
+ outputLibrary = dest.externalize;
499
+ }
500
+ }
501
+ }
502
+ else {
503
+ outputLibrary = webpackConfig.output?.library;
504
+ }
481
505
  return {
482
506
  ...webpackConfig,
483
507
  devtool: 'source-map',
@@ -486,7 +510,8 @@ function processIndividualWebpackConfig(config, webpackConfig, sources) {
486
510
  ...webpackConfig.output,
487
511
  path: outPath,
488
512
  chunkFilename: 'webpack-chunks/[id].js',
489
- publicPath: publicPath
513
+ publicPath: publicPath,
514
+ library: outputLibrary
490
515
  },
491
516
  module: {
492
517
  ...webpackConfig.module,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.42.5",
3
+ "version": "2.43.0",
4
4
  "license": "UNLICENSED",
5
5
  "scripts": {
6
6
  "prepublishOnly": "rm -rf build && mkdir build && tsc",
@@ -23,7 +23,7 @@
23
23
  "devDependencies": {
24
24
  "@plaudit/gutenberg-api-extensions": "^2.66.1",
25
25
  "@types/browser-sync-webpack-plugin": "^2.2.5",
26
- "@types/node": "^22.13.13",
26
+ "@types/node": "^22.14.0",
27
27
  "@types/postcss-functions": "^4.0.4",
28
28
  "@types/tapable": "^2.2.7",
29
29
  "@types/webpack": "^5.28.5",
@@ -38,16 +38,16 @@
38
38
  "@plaudit/postcss-silent-extend": "^3.0.0",
39
39
  "@plaudit/postcss-strip-units": "^3.0.0",
40
40
  "@plaudit/postcss-variables": "^1.1.0",
41
- "@wordpress/dependency-extraction-webpack-plugin": "^6.20.0",
42
- "@wordpress/scripts": "^30.13.0",
41
+ "@wordpress/dependency-extraction-webpack-plugin": "^6.21.0",
42
+ "@wordpress/scripts": "^30.14.1",
43
43
  "autoprefixer": "^10.4.21",
44
- "browser-sync": "^3.0.3",
44
+ "browser-sync": "^3.0.4",
45
45
  "clean-webpack-plugin": "^4.0.0",
46
46
  "copy-webpack-plugin": "^10.2.4",
47
47
  "cssnano": "^6.1.2",
48
48
  "eslint": "^8.57.1",
49
49
  "eslint-plugin-jsdoc": "^48.11.0",
50
- "fork-ts-checker-webpack-plugin": "^9.0.2",
50
+ "fork-ts-checker-webpack-plugin": "^9.0.3",
51
51
  "http-proxy-middleware": "^3.0.3",
52
52
  "json2php": "^0.0.12",
53
53
  "postcss": "^8.5.3",