@plaudit/webpack-extensions 2.20.1 → 2.21.1

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.
@@ -142,7 +142,7 @@ function disableDefaultURLProcessing(webpackConfig) {
142
142
  }
143
143
  }
144
144
  }
145
- function injectPostcssConfigOverrides(webpackConfig, variables, verbose, processingModules) {
145
+ function injectPostcssConfigOverrides(webpackConfig, variables, verbose) {
146
146
  if (webpackConfig.module?.rules) {
147
147
  const postcssConfig = (0, static_configs_1.postcssConfigBuilder)(verbose, name => variables(name) ?? (name === 'ENV' ? '' : undefined));
148
148
  return webpackConfig.module.rules.map(rule => {
@@ -163,7 +163,7 @@ function injectPostcssConfigOverrides(webpackConfig, variables, verbose, process
163
163
  }
164
164
  }
165
165
  if (rule.test instanceof RegExp && (rule.test.test("index.ts") || rule.test.test("index.mts"))) { // Then this is the javascript and typescript rule
166
- return { ...rule, test: processingModules ? scriptWithModuleExtension : scriptWithoutModuleExtension }; // This hacks in differentiated support for mjs and mts files
166
+ rule.test = /\.m?[jt]sx?$/; // This hacks in support for mjs and mts files
167
167
  }
168
168
  }
169
169
  return rule;
@@ -197,7 +197,7 @@ function parseEntrypointsJSON(dir) {
197
197
  }
198
198
  }
199
199
  function processIndividualWebpackConfig(config, webpackConfig, sources) {
200
- let scriptExtension;
200
+ let scriptExtension; // This is only used in non-block contexts. It might not actually be necessary, but it is good to have
201
201
  let entrypointFields;
202
202
  const processingModules = webpackConfig.output?.module ?? false;
203
203
  if (processingModules) {
@@ -211,7 +211,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources) {
211
211
  const { standaloneBlocks, variablesFilePath, verbose } = config;
212
212
  let currentVariables = config.currentVariables;
213
213
  disableDefaultURLProcessing(webpackConfig);
214
- const fixedRules = injectPostcssConfigOverrides(webpackConfig, name => currentVariables[name], verbose, processingModules);
214
+ const fixedRules = injectPostcssConfigOverrides(webpackConfig, name => currentVariables[name], verbose);
215
215
  return sources.map(([src, dest]) => {
216
216
  const srcRoots = (typeof dest !== 'string' && dest.withLegacyBlocksIn
217
217
  ? [...src.split(','), ...resolveLegacyBlockScriptsInFolder(dest.withLegacyBlocksIn)]
@@ -223,7 +223,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources) {
223
223
  return undefined;
224
224
  }
225
225
  const copyFiles = srcIsDirectory && src !== dest;
226
- const plugins = webpackConfig.plugins?.filter(isTruthy) ?? [];
226
+ const plugins = webpackConfig.plugins?.filter(isTruthy).filter(plugin => plugin.constructor.name !== 'RtlCssPlugin') ?? [];
227
227
  if (process.env["NO_TS_CHECKER"] !== "true") {
228
228
  const include = (Array.isArray(srcRoot) ? srcRoot : [srcRoot])
229
229
  .filter(sr => node_path_1.default.extname(sr).length === 0 || scriptOrStyleTest(sr, scriptExtension) === "script")
@@ -363,7 +363,7 @@ function processIndividualWebpackConfig(config, webpackConfig, sources) {
363
363
  },
364
364
  resolve: {
365
365
  ...webpackConfig.resolve,
366
- extensions: processingModules ? ['.mjsx', '.mjs', '.mtsx', '.mts'] : ['.jsx', '.tsx', '.ts', '...']
366
+ extensions: ['.mjsx', '.mjs', '.mtsx', '.mts', '.jsx', '.tsx', '.ts', '...']
367
367
  },
368
368
  stats: config.stats,
369
369
  plugins: copyFiles
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.20.1",
3
+ "version": "2.21.1",
4
4
  "scripts": {
5
5
  "prepublishOnly": "rm -rf build && mkdir build && tsc",
6
6
  "build": "tsc",
@@ -14,12 +14,14 @@
14
14
  },
15
15
  "typesVersions": {
16
16
  "*": {
17
- "wordpress-scripts-wrapper": ["build/wordpress-scripts-wrapper.d.ts"]
17
+ "wordpress-scripts-wrapper": [
18
+ "build/wordpress-scripts-wrapper.d.ts"
19
+ ]
18
20
  }
19
21
  },
20
22
  "devDependencies": {
21
23
  "@types/browser-sync-webpack-plugin": "^2.2.5",
22
- "@types/node": "^20.12.10",
24
+ "@types/node": "^20.12.12",
23
25
  "@types/tapable": "^2.2.7",
24
26
  "@types/webpack": "^5.28.5",
25
27
  "@types/webpack-sources": "^3.2.3",
@@ -33,7 +35,7 @@
33
35
  "@plaudit/postcss-silent-extend": "^3.0.0",
34
36
  "@plaudit/postcss-strip-units": "^3.0.0",
35
37
  "@plaudit/postcss-variables": "^1.0.0",
36
- "@wordpress/scripts": "^27.8.0",
38
+ "@wordpress/scripts": "^27.9.0",
37
39
  "autoprefixer": "^10.4.19",
38
40
  "browser-sync": "^3.0.2",
39
41
  "clean-webpack-plugin": "^4.0.0",
@@ -42,7 +44,7 @@
42
44
  "eslint": "^8.57.0",
43
45
  "eslint-plugin-jsdoc": "^48.2.3",
44
46
  "fork-ts-checker-webpack-plugin": "^9.0.2",
45
- "http-proxy-middleware": "^3.0.0-beta.1",
47
+ "http-proxy-middleware": "^3.0.0-beta.1",
46
48
  "postcss": "^8.4.38",
47
49
  "postcss-calc": "^9.0.1",
48
50
  "postcss-discard-comments": "^6.0.2",