@plaudit/webpack-extensions 3.21.1 → 4.0.0-rc.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/USER-GUIDE.md +2 -1
  3. package/package.json +39 -62
  4. package/dist/plugins/AbstractBiPhasicGroupAndEntryPlugin.d.ts +0 -25
  5. package/dist/plugins/AbstractBiPhasicGroupAndEntryPlugin.js +0 -86
  6. package/dist/plugins/AbstractBiPhasicGroupPlugin.d.ts +0 -31
  7. package/dist/plugins/AbstractBiPhasicGroupPlugin.js +0 -91
  8. package/dist/plugins/AdditionalDependencyInjectorPlugin.d.ts +0 -11
  9. package/dist/plugins/AdditionalDependencyInjectorPlugin.js +0 -58
  10. package/dist/plugins/EnhancedBlockJSONPlugin.d.ts +0 -47
  11. package/dist/plugins/EnhancedBlockJSONPlugin.js +0 -657
  12. package/dist/plugins/EnhancedDynamicEntryPlugin.d.ts +0 -8
  13. package/dist/plugins/EnhancedDynamicEntryPlugin.js +0 -14
  14. package/dist/plugins/ExtensionsConfigFileGeneratorPlugin.d.ts +0 -20
  15. package/dist/plugins/ExtensionsConfigFileGeneratorPlugin.js +0 -191
  16. package/dist/plugins/ExtensionsConfigFileGeneratorPluginV1.d.ts +0 -9
  17. package/dist/plugins/ExtensionsConfigFileGeneratorPluginV1.js +0 -45
  18. package/dist/plugins/MiniCSSExtractPluginErrorCleaner.d.ts +0 -4
  19. package/dist/plugins/MiniCSSExtractPluginErrorCleaner.js +0 -15
  20. package/dist/plugins/MixableBiPhasicGroupAndEntryPlugin.d.ts +0 -6
  21. package/dist/plugins/MixableBiPhasicGroupAndEntryPlugin.js +0 -13
  22. package/dist/plugins/MixableBiPhasicGroupPlugin.d.ts +0 -6
  23. package/dist/plugins/MixableBiPhasicGroupPlugin.js +0 -13
  24. package/dist/plugins/PackageConfigSanityChecker.d.ts +0 -4
  25. package/dist/plugins/PackageConfigSanityChecker.js +0 -30
  26. package/dist/plugins/PlainEntrypointsConfigFileGeneratorPlugin.d.ts +0 -26
  27. package/dist/plugins/PlainEntrypointsConfigFileGeneratorPlugin.js +0 -392
  28. package/dist/plugins/SpecialAssetHandlingPlugin.d.ts +0 -12
  29. package/dist/plugins/SpecialAssetHandlingPlugin.js +0 -134
  30. package/dist/plugins/UnifiedLoaderGenerator.d.ts +0 -21
  31. package/dist/plugins/UnifiedLoaderGenerator.js +0 -144
  32. package/dist/plugins/VariablesJSMonitorPlugin.d.ts +0 -7
  33. package/dist/plugins/VariablesJSMonitorPlugin.js +0 -20
  34. package/dist/plugins/WPMLConfigBuilder.d.ts +0 -17
  35. package/dist/plugins/WPMLConfigBuilder.js +0 -472
  36. package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts +0 -4
  37. package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.js +0 -147
  38. package/dist/plugins/index.d.ts +0 -8
  39. package/dist/plugins/index.js +0 -24
  40. package/dist/plugins/static-configs.d.ts +0 -3
  41. package/dist/plugins/static-configs.js +0 -44
  42. package/dist/shared.d.ts +0 -311
  43. package/dist/shared.js +0 -536
  44. package/dist/utils/common-config-helpers.d.ts +0 -28
  45. package/dist/utils/common-config-helpers.js +0 -489
  46. package/dist/utils/css-writer.d.ts +0 -4
  47. package/dist/utils/css-writer.js +0 -46
  48. package/dist/utils/entrypoint-resolution-logic.d.ts +0 -13
  49. package/dist/utils/entrypoint-resolution-logic.js +0 -82
  50. package/dist/utils/location-encoding-filename-parser.d.ts +0 -30
  51. package/dist/utils/location-encoding-filename-parser.js +0 -120
  52. package/dist/utils/path-query-and-related-helpers.d.ts +0 -64
  53. package/dist/utils/path-query-and-related-helpers.js +0 -269
  54. package/dist/utils/pseudo-semaphore.d.ts +0 -14
  55. package/dist/utils/pseudo-semaphore.js +0 -79
  56. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.d.ts +0 -72
  57. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.js +0 -518
  58. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.d.ts +0 -56
  59. package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.js +0 -151
  60. package/dist/wordpress-scripts-wrapper.d.ts +0 -4
  61. package/dist/wordpress-scripts-wrapper.js +0 -698
@@ -1,151 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultRequestToExternal = defaultRequestToExternal;
4
- exports.defaultRequestToExternalModule = defaultRequestToExternalModule;
5
- exports.defaultRequestToHandle = defaultRequestToHandle;
6
- exports.camelCaseDash = camelCaseDash;
7
- exports.isConcatenatedModule = isConcatenatedModule;
8
- exports.isEntrypoint = isEntrypoint;
9
- const WORDPRESS_NAMESPACE = '@wordpress/';
10
- const BUNDLED_PACKAGES = [
11
- '@wordpress/admin-ui',
12
- '@wordpress/dataviews',
13
- '@wordpress/dataviews/wp',
14
- '@wordpress/fields',
15
- '@wordpress/grid',
16
- '@wordpress/icons',
17
- '@wordpress/interface',
18
- '@wordpress/kebab-case',
19
- '@wordpress/style-runtime',
20
- '@wordpress/ui',
21
- '@wordpress/undo-manager',
22
- '@wordpress/views',
23
- ];
24
- /**
25
- * Default request to global transformation
26
- *
27
- * Transform @wordpress dependencies:
28
- * - request `@wordpress/api-fetch` becomes `[ 'wp', 'apiFetch' ]`
29
- * - request `@wordpress/i18n` becomes `[ 'wp', 'i18n' ]`
30
- *
31
- * @param {string} request Module request (the module name in `import from`) to be transformed
32
- * @return {string|string[]|undefined} The resulting external definition. Return `undefined`
33
- * to ignore the request. Return `string|string[]` to map the request to an external.
34
- */
35
- function defaultRequestToExternal(request) {
36
- switch (request) {
37
- case 'moment':
38
- return request;
39
- case '@babel/runtime/regenerator':
40
- return 'regeneratorRuntime';
41
- case 'lodash':
42
- case 'lodash-es':
43
- return 'lodash';
44
- case 'jquery':
45
- return 'jQuery';
46
- case 'react':
47
- return 'React';
48
- case 'react-dom':
49
- case 'react-dom/client':
50
- return 'ReactDOM';
51
- case 'react/jsx-runtime':
52
- case 'react/jsx-dev-runtime':
53
- return 'ReactJSXRuntime';
54
- }
55
- if (request.includes('react-refresh/runtime')) {
56
- return 'ReactRefreshRuntime';
57
- }
58
- if (BUNDLED_PACKAGES.includes(request)) {
59
- return undefined;
60
- }
61
- if (request.startsWith(WORDPRESS_NAMESPACE)) {
62
- return [
63
- 'wp',
64
- camelCaseDash(request.substring(WORDPRESS_NAMESPACE.length)),
65
- ];
66
- }
67
- return undefined;
68
- }
69
- /**
70
- * Default request to external module transformation
71
- *
72
- * Currently only @wordpress/interactivity and `@wordpress/interactivity-router`
73
- * are supported.
74
- *
75
- * Do not use the boolean shorthand here, it's only handled for the
76
- * `requestToExternalModule` option.
77
- *
78
- * @param {string} request Module request (the module name in `import from`) to be transformed
79
- * @return {string|undefined} The resulting external definition.
80
- * - Return `undefined` to ignore the request (do not externalize).
81
- * - Return `string` to map the request to an external.
82
- * - Return `Error` to emit an error.
83
- */
84
- function defaultRequestToExternalModule(request) {
85
- if (request === '@wordpress/interactivity') {
86
- // This is a special case. Interactivity does not support dynamic imports at
87
- // this time. We add the external "module" type to indicate that webpack
88
- // should externalize this as a module (instead of our default `import()`
89
- // external type) which forces @wordpress/interactivity imports to be
90
- // hoisted to static imports.
91
- return `module ${request}`;
92
- }
93
- switch (request) {
94
- case '@wordpress/interactivity-router':
95
- case '@wordpress/a11y':
96
- return `import ${request}`;
97
- }
98
- const isWordPressScript = Boolean(defaultRequestToExternal(request));
99
- if (isWordPressScript) {
100
- throw new Error(`Attempted to use WordPress script in a module: ${request}, which is not supported yet.`);
101
- }
102
- return undefined;
103
- }
104
- /**
105
- * Default request to WordPress script handle transformation
106
- *
107
- * Transform @wordpress dependencies:
108
- * - request `@wordpress/i18n` becomes `wp-i18n`
109
- * - request `@wordpress/escape-html` becomes `wp-escape-html`
110
- *
111
- * @param {string} request Module request (the module name in `import from`) to be transformed
112
- * @return {string|undefined} WordPress script handle to map the request to. Return `undefined`
113
- * to use the same name as the module.
114
- */
115
- function defaultRequestToHandle(request) {
116
- switch (request) {
117
- case '@babel/runtime/regenerator':
118
- return 'regenerator-runtime';
119
- case 'lodash-es':
120
- return 'lodash';
121
- case 'react-dom/client':
122
- return 'react-dom';
123
- case 'react/jsx-runtime':
124
- return 'react-jsx-runtime';
125
- }
126
- if (request.includes('react-refresh/runtime')) {
127
- return 'wp-react-refresh-runtime';
128
- }
129
- if (request.startsWith(WORDPRESS_NAMESPACE)) {
130
- return 'wp-' + request.substring(WORDPRESS_NAMESPACE.length);
131
- }
132
- return undefined;
133
- }
134
- /**
135
- * Given a string, returns a new string with dash separators converted to
136
- * camelCase equivalent. This is not as aggressive as `_.camelCase` in
137
- * converting to uppercase, where Lodash will also capitalize letters
138
- * following numbers.
139
- *
140
- * @param {string} string Input dash-delimited string.
141
- * @return {string} Camel-cased string.
142
- */
143
- function camelCaseDash(string) {
144
- return string.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
145
- }
146
- function isConcatenatedModule(module) {
147
- return 'modules' in module && Array.isArray(module.modules);
148
- }
149
- function isEntrypoint(group) {
150
- return !!group && group.constructor.name === 'Entrypoint';
151
- }
@@ -1,4 +0,0 @@
1
- import { PlauditWordpressWebpackConfig } from "./shared";
2
- import type { Configuration } from "webpack";
3
- export = _default;
4
- declare function _default(config: PlauditWordpressWebpackConfig, webpackConfig?: Configuration[] | Configuration): Configuration[];