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