@plaudit/webpack-extensions 2.56.3 → 2.56.4

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.
@@ -267,6 +267,7 @@ function commonMakeWebpackConfig(config, commonConfig, webpackConfig, srcIsDirec
267
267
  : (srcIsDirectory
268
268
  ? plugins.filter(plugin => plugin.constructor.name !== 'CopyPlugin' && plugin.constructor.name !== 'CleanWebpackPlugin')
269
269
  : plugins.filter(plugin => plugin.constructor.name !== 'CopyPlugin'));
270
+ const extensions = processingModules ? ['.mjsx', '.mjs', '.mtsx', '.mts', '...'] : ['.jsx', '.tsx', '.ts', '...'];
270
271
  return {
271
272
  ...webpackConfig,
272
273
  devtool: 'source-map',
@@ -307,7 +308,7 @@ function commonMakeWebpackConfig(config, commonConfig, webpackConfig, srcIsDirec
307
308
  resolve: {
308
309
  ...webpackConfig.resolve,
309
310
  roots: viableRoots,
310
- extensions: ['.mjsx', '.mjs', '.mtsx', '.mts', '.jsx', '.tsx', '.ts', '...']
311
+ extensions
311
312
  },
312
313
  stats: config.stats,
313
314
  plugins: config.outputDir ? possiblePlugins : possiblePlugins.filter(plugin => plugin.constructor.name !== 'CleanWebpackPlugin'),
@@ -442,12 +442,17 @@ function processIndividualWebpackConfig(config, webpackConfig, sources) {
442
442
  return makeExtensionsWebpackConfig(config, commonConfig, webpackConfig, dest, src, srcRoot, plugins);
443
443
  }
444
444
  case "plain" /* SourceType.plain */:
445
- if (config.plainEntrypointsVersion > 1) {
446
- // plainEntrypoints.push({dest, src, srcRoot});
447
- // return undefined;
448
- return makePlainV2WebpackConfig(config, commonConfig, webpackConfig, dest, src, srcRoot, srcIsDirectory);
445
+ if (!srcIsDirectory) {
446
+ //TODO: We need to filter this when in directory mode as well
447
+ const primarySrcRoot = typeof srcRoot === 'string' ? srcRoot : srcRoot[0];
448
+ if (!scriptExtension.test(primarySrcRoot) && !shared_1.styleExtension.test(primarySrcRoot)) {
449
+ return undefined;
450
+ }
449
451
  }
450
452
  const { plugins } = buildCommonPluginConfig(srcRoot, scriptExtension, webpackConfig, dest, config, "plain" /* SourceType.plain */);
453
+ if (config.plainEntrypointsVersion > 1) {
454
+ return makePlainV2WebpackConfig(config, commonConfig, webpackConfig, dest, src, srcRoot, plugins, srcIsDirectory);
455
+ }
451
456
  return makePlainV1WebpackConfig(config, commonConfig, webpackConfig, dest, src, srcRoot, plugins, srcIsDirectory);
452
457
  }
453
458
  }).filter(cfg => cfg !== undefined);
@@ -484,8 +489,7 @@ function makePlainV1WebpackConfig(config, commonConfig, webpackConfig, dest, src
484
489
  : () => ({ [baseDest]: srcRoot });
485
490
  return (0, common_config_helpers_1.commonMakeWebpackConfig)(config, commonConfig, webpackConfig, srcIsDirectory, dest, src, srcRoot, entry, plugins);
486
491
  }
487
- function makePlainV2WebpackConfig(config, commonConfig, webpackConfig, dest, src, srcRoot, srcIsDirectory) {
488
- const { plugins } = buildCommonPluginConfig(srcRoot, commonConfig.scriptExtension, webpackConfig, dest, config, "extensions" /* SourceType.extensions */);
492
+ function makePlainV2WebpackConfig(config, commonConfig, webpackConfig, dest, src, srcRoot, plugins, srcIsDirectory) {
489
493
  plugins.push(new PlainEntrypointsConfigFileGeneratorPlugin_1.PlainEntrypointsConfigFileGeneratorPlugin(process.cwd(), config.outputDir, dest.locations ?? {}, config.plainEntrypointsHandlePrefix));
490
494
  const baseDest = stripExtension(dest.destination);
491
495
  const entry = srcIsDirectory // This being true implies that srcRoot is not an array
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.56.3",
3
+ "version": "2.56.4",
4
4
  "license": "UNLICENSED",
5
5
  "files": [
6
6
  "/build"
@@ -18,7 +18,7 @@
18
18
  "devDependencies": {
19
19
  "@plaudit/gutenberg-api-extensions": "^2.75.0",
20
20
  "@types/browser-sync-webpack-plugin": "^2.2.5",
21
- "@types/node": "^22.17.0",
21
+ "@types/node": "^22.17.1",
22
22
  "@types/postcss-functions": "^4.0.4",
23
23
  "@types/tapable": "^2.2.7",
24
24
  "@types/webpack": "^5.28.5",