@plaudit/webpack-extensions 4.0.0-rc.1 → 4.1.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.
- package/CHANGELOG.md +9 -1
- package/dist/api/asset-information-emission.d.ts +74 -0
- package/dist/api/asset-information-emission.d.ts.map +1 -0
- package/dist/api/asset-information-emission.js +398 -0
- package/dist/api/asset-information-emission.js.map +1 -0
- package/dist/api/configuration.d.ts +102 -0
- package/dist/api/configuration.d.ts.map +1 -0
- package/dist/api/configuration.js +83 -0
- package/dist/api/configuration.js.map +1 -0
- package/dist/api/coordinatable-emitter.d.ts +27 -0
- package/dist/api/coordinatable-emitter.d.ts.map +1 -0
- package/dist/api/coordinatable-emitter.js +20 -0
- package/dist/api/coordinatable-emitter.js.map +1 -0
- package/dist/api/entries/dependencies.d.ts +69 -0
- package/dist/api/entries/dependencies.d.ts.map +1 -0
- package/dist/api/entries/dependencies.js +61 -0
- package/dist/api/entries/dependencies.js.map +1 -0
- package/dist/api/entries/flag-logic.d.ts +37 -0
- package/dist/api/entries/flag-logic.d.ts.map +1 -0
- package/dist/api/entries/flag-logic.js +110 -0
- package/dist/api/entries/flag-logic.js.map +1 -0
- package/dist/api/entries/identifiers.d.ts +84 -0
- package/dist/api/entries/identifiers.d.ts.map +1 -0
- package/dist/api/entries/identifiers.js +590 -0
- package/dist/api/entries/identifiers.js.map +1 -0
- package/dist/api/entries/index.d.ts +6 -0
- package/dist/api/entries/index.d.ts.map +1 -0
- package/dist/api/entries/index.js +22 -0
- package/dist/api/entries/index.js.map +1 -0
- package/dist/api/entries/locations.d.ts +135 -0
- package/dist/api/entries/locations.d.ts.map +1 -0
- package/dist/api/entries/locations.js +174 -0
- package/dist/api/entries/locations.js.map +1 -0
- package/dist/api/entries/manager.d.ts +12 -0
- package/dist/api/entries/manager.d.ts.map +1 -0
- package/dist/api/entries/manager.js +35 -0
- package/dist/api/entries/manager.js.map +1 -0
- package/dist/api/handle-derivation.d.ts +32 -0
- package/dist/api/handle-derivation.d.ts.map +1 -0
- package/dist/api/handle-derivation.js +77 -0
- package/dist/api/handle-derivation.js.map +1 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +23 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/shared-types.d.ts +86 -0
- package/dist/api/shared-types.d.ts.map +1 -0
- package/dist/api/shared-types.js +3 -0
- package/dist/api/shared-types.js.map +1 -0
- package/dist/internal-utils/auto-registering-plugins-loader.d.ts +3 -0
- package/dist/internal-utils/auto-registering-plugins-loader.d.ts.map +1 -0
- package/dist/internal-utils/auto-registering-plugins-loader.js +42 -0
- package/dist/internal-utils/auto-registering-plugins-loader.js.map +1 -0
- package/dist/internal-utils/common-config-helpers.d.ts +14 -0
- package/dist/internal-utils/common-config-helpers.d.ts.map +1 -0
- package/dist/internal-utils/common-config-helpers.js +140 -0
- package/dist/internal-utils/common-config-helpers.js.map +1 -0
- package/dist/internal-utils/entrypoint-resolution-logic.d.ts +14 -0
- package/dist/internal-utils/entrypoint-resolution-logic.d.ts.map +1 -0
- package/dist/internal-utils/entrypoint-resolution-logic.js +223 -0
- package/dist/internal-utils/entrypoint-resolution-logic.js.map +1 -0
- package/dist/internal-utils/internal-pseudo-plugin.d.ts +6 -0
- package/dist/internal-utils/internal-pseudo-plugin.d.ts.map +1 -0
- package/dist/internal-utils/internal-pseudo-plugin.js +46 -0
- package/dist/internal-utils/internal-pseudo-plugin.js.map +1 -0
- package/dist/mocks/blocks.d.ts +32 -0
- package/dist/mocks/blocks.d.ts.map +1 -0
- package/dist/mocks/blocks.js +3 -0
- package/dist/mocks/blocks.js.map +1 -0
- package/dist/mocks/index.d.ts +2 -0
- package/dist/mocks/index.d.ts.map +1 -0
- package/dist/mocks/index.js +18 -0
- package/dist/mocks/index.js.map +1 -0
- package/dist/plugins/AdditionalDependencyInjectorPlugin.d.ts +5 -0
- package/dist/plugins/AdditionalDependencyInjectorPlugin.d.ts.map +1 -0
- package/dist/plugins/AdditionalDependencyInjectorPlugin.js +59 -0
- package/dist/plugins/AdditionalDependencyInjectorPlugin.js.map +1 -0
- package/dist/plugins/MiniCSSExtractPluginErrorCleaner.d.ts +5 -0
- package/dist/plugins/MiniCSSExtractPluginErrorCleaner.d.ts.map +1 -0
- package/dist/plugins/MiniCSSExtractPluginErrorCleaner.js +16 -0
- package/dist/plugins/MiniCSSExtractPluginErrorCleaner.js.map +1 -0
- package/dist/plugins/PackageConfigSanityChecker.d.ts +5 -0
- package/dist/plugins/PackageConfigSanityChecker.d.ts.map +1 -0
- package/dist/plugins/PackageConfigSanityChecker.js +31 -0
- package/dist/plugins/PackageConfigSanityChecker.js.map +1 -0
- package/dist/plugins/RootCoordinatorPluginImpl.d.ts +56 -0
- package/dist/plugins/RootCoordinatorPluginImpl.d.ts.map +1 -0
- package/dist/plugins/RootCoordinatorPluginImpl.js +767 -0
- package/dist/plugins/RootCoordinatorPluginImpl.js.map +1 -0
- package/dist/plugins/VariablesJSMonitorPlugin.d.ts +8 -0
- package/dist/plugins/VariablesJSMonitorPlugin.d.ts.map +1 -0
- package/dist/plugins/VariablesJSMonitorPlugin.js +21 -0
- package/dist/plugins/VariablesJSMonitorPlugin.js.map +1 -0
- package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.d.ts +25 -0
- package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.d.ts.map +1 -0
- package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.js +458 -0
- package/dist/plugins/blocks/BlocksDirectoryLoaderEmitterPlugin.js.map +1 -0
- package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.d.ts +29 -0
- package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.d.ts.map +1 -0
- package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.js +290 -0
- package/dist/plugins/blocks/BlocksDirectoryProcessingPlugin.js.map +1 -0
- package/dist/plugins/blocks/register.d.ts +6 -0
- package/dist/plugins/blocks/register.d.ts.map +1 -0
- package/dist/plugins/blocks/register.js +14 -0
- package/dist/plugins/blocks/register.js.map +1 -0
- package/dist/plugins/blocks/registerEmitter.d.ts +4 -0
- package/dist/plugins/blocks/registerEmitter.d.ts.map +1 -0
- package/dist/plugins/blocks/registerEmitter.js +13 -0
- package/dist/plugins/blocks/registerEmitter.js.map +1 -0
- package/dist/plugins/blocks/registerProcessor.d.ts +4 -0
- package/dist/plugins/blocks/registerProcessor.d.ts.map +1 -0
- package/dist/plugins/blocks/registerProcessor.js +46 -0
- package/dist/plugins/blocks/registerProcessor.js.map +1 -0
- package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts +5 -0
- package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.d.ts.map +1 -0
- package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.js +148 -0
- package/dist/plugins/dependency-extraction-webpack-plugin-config-builder.js.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.d.ts +14 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.d.ts.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.js +191 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPlugin.js.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.d.ts +14 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.d.ts.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.js +102 -0
- package/dist/plugins/extensions/ExtensionsDirectoryLoaderEmitterPluginV1.js.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.d.ts +25 -0
- package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.d.ts.map +1 -0
- package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.js +229 -0
- package/dist/plugins/extensions/ExtensionsDirectoryProcessingPlugin.js.map +1 -0
- package/dist/plugins/extensions/register.d.ts +6 -0
- package/dist/plugins/extensions/register.d.ts.map +1 -0
- package/dist/plugins/extensions/register.js +14 -0
- package/dist/plugins/extensions/register.js.map +1 -0
- package/dist/plugins/extensions/registerEmitter.d.ts +4 -0
- package/dist/plugins/extensions/registerEmitter.d.ts.map +1 -0
- package/dist/plugins/extensions/registerEmitter.js +18 -0
- package/dist/plugins/extensions/registerEmitter.js.map +1 -0
- package/dist/plugins/extensions/registerProcessor.d.ts +4 -0
- package/dist/plugins/extensions/registerProcessor.d.ts.map +1 -0
- package/dist/plugins/extensions/registerProcessor.js +42 -0
- package/dist/plugins/extensions/registerProcessor.js.map +1 -0
- package/dist/plugins/index.d.ts +11 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +27 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/plain/PlainEntrypointProcessingPlugin.d.ts +18 -0
- package/dist/plugins/plain/PlainEntrypointProcessingPlugin.d.ts.map +1 -0
- package/dist/plugins/plain/PlainEntrypointProcessingPlugin.js +203 -0
- package/dist/plugins/plain/PlainEntrypointProcessingPlugin.js.map +1 -0
- package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.d.ts +13 -0
- package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.d.ts.map +1 -0
- package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.js +51 -0
- package/dist/plugins/plain/PlainEntrypointsConfigEmitterPlugin.js.map +1 -0
- package/dist/plugins/plain/register.d.ts +6 -0
- package/dist/plugins/plain/register.d.ts.map +1 -0
- package/dist/plugins/plain/register.js +14 -0
- package/dist/plugins/plain/register.js.map +1 -0
- package/dist/plugins/plain/registerEmitter.d.ts +4 -0
- package/dist/plugins/plain/registerEmitter.d.ts.map +1 -0
- package/dist/plugins/plain/registerEmitter.js +21 -0
- package/dist/plugins/plain/registerEmitter.js.map +1 -0
- package/dist/plugins/plain/registerProcessor.d.ts +4 -0
- package/dist/plugins/plain/registerProcessor.d.ts.map +1 -0
- package/dist/plugins/plain/registerProcessor.js +34 -0
- package/dist/plugins/plain/registerProcessor.js.map +1 -0
- package/dist/plugins/register.d.ts +3 -0
- package/dist/plugins/register.d.ts.map +1 -0
- package/dist/plugins/register.js +17 -0
- package/dist/plugins/register.js.map +1 -0
- package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.d.ts +20 -0
- package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.d.ts.map +1 -0
- package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.js +56 -0
- package/dist/plugins/special-assets/SpecialAssetsCollectorPlugin.js.map +1 -0
- package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.d.ts +13 -0
- package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.d.ts.map +1 -0
- package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.js +105 -0
- package/dist/plugins/special-assets/SpecialAssetsLoaderEmitterPlugin.js.map +1 -0
- package/dist/plugins/special-assets/register.d.ts +6 -0
- package/dist/plugins/special-assets/register.d.ts.map +1 -0
- package/dist/plugins/special-assets/register.js +14 -0
- package/dist/plugins/special-assets/register.js.map +1 -0
- package/dist/plugins/special-assets/registerEmitter.d.ts +4 -0
- package/dist/plugins/special-assets/registerEmitter.d.ts.map +1 -0
- package/dist/plugins/special-assets/registerEmitter.js +15 -0
- package/dist/plugins/special-assets/registerEmitter.js.map +1 -0
- package/dist/plugins/special-assets/registerProcessor.d.ts +4 -0
- package/dist/plugins/special-assets/registerProcessor.d.ts.map +1 -0
- package/dist/plugins/special-assets/registerProcessor.js +15 -0
- package/dist/plugins/special-assets/registerProcessor.js.map +1 -0
- package/dist/plugins/unified-loader/UnifiedLoaderGenerator.d.ts +22 -0
- package/dist/plugins/unified-loader/UnifiedLoaderGenerator.d.ts.map +1 -0
- package/dist/plugins/unified-loader/UnifiedLoaderGenerator.js +95 -0
- package/dist/plugins/unified-loader/UnifiedLoaderGenerator.js.map +1 -0
- package/dist/plugins/wpml-config/WPMLConfigBuilder.d.ts +24 -0
- package/dist/plugins/wpml-config/WPMLConfigBuilder.d.ts.map +1 -0
- package/dist/plugins/wpml-config/WPMLConfigBuilder.js +542 -0
- package/dist/plugins/wpml-config/WPMLConfigBuilder.js.map +1 -0
- package/dist/plugins/wpml-config/register.d.ts +6 -0
- package/dist/plugins/wpml-config/register.d.ts.map +1 -0
- package/dist/plugins/wpml-config/register.js +25 -0
- package/dist/plugins/wpml-config/register.js.map +1 -0
- package/dist/shared.d.ts +38 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +163 -0
- package/dist/shared.js.map +1 -0
- package/dist/utils/error-helpers.d.ts +7 -0
- package/dist/utils/error-helpers.d.ts.map +1 -0
- package/dist/utils/error-helpers.js +73 -0
- package/dist/utils/error-helpers.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +22 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/misc.d.ts +4 -0
- package/dist/utils/misc.d.ts.map +1 -0
- package/dist/utils/misc.js +18 -0
- package/dist/utils/misc.js.map +1 -0
- package/dist/utils/path-helpers.d.ts +16 -0
- package/dist/utils/path-helpers.d.ts.map +1 -0
- package/dist/utils/path-helpers.js +115 -0
- package/dist/utils/path-helpers.js.map +1 -0
- package/dist/utils/pseudo-semaphore.d.ts +15 -0
- package/dist/utils/pseudo-semaphore.d.ts.map +1 -0
- package/dist/utils/pseudo-semaphore.js +77 -0
- package/dist/utils/pseudo-semaphore.js.map +1 -0
- package/dist/utils/type-helpers.d.ts +27 -0
- package/dist/utils/type-helpers.d.ts.map +1 -0
- package/dist/utils/type-helpers.js +33 -0
- package/dist/utils/type-helpers.js.map +1 -0
- package/dist/utils/writer-utils.d.ts +8 -0
- package/dist/utils/writer-utils.d.ts.map +1 -0
- package/dist/utils/writer-utils.js +35 -0
- package/dist/utils/writer-utils.js.map +1 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.d.ts +73 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.d.ts.map +1 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.js +516 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/index.js.map +1 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.d.ts +57 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.d.ts.map +1 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.js +156 -0
- package/dist/wordpress-ports/dependency-extraction-webpack-plugin/util.js.map +1 -0
- package/dist/wordpress-scripts-wrapper.d.ts +5 -0
- package/dist/wordpress-scripts-wrapper.d.ts.map +1 -0
- package/dist/wordpress-scripts-wrapper.js +444 -0
- package/dist/wordpress-scripts-wrapper.js.map +1 -0
- package/package.json +7 -3
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnhancedDependencyExtractionWebpackPlugin = void 0;
|
|
4
|
+
const webpack_1 = require("webpack");
|
|
5
|
+
const util_1 = require("./util");
|
|
6
|
+
const defaultExternalizedReportFileName = 'externalized-dependencies.json';
|
|
7
|
+
class EnhancedDependencyExtractionWebpackPlugin {
|
|
8
|
+
/**
|
|
9
|
+
* Track requests that are externalized.
|
|
10
|
+
*
|
|
11
|
+
* Because we don't have a closed set of dependencies, we need to track what has
|
|
12
|
+
* been externalized so we can recognize them in a later phase when the dependency
|
|
13
|
+
* lists are generated.
|
|
14
|
+
*/
|
|
15
|
+
externalizedDeps = new Set();
|
|
16
|
+
options;
|
|
17
|
+
/**
|
|
18
|
+
* Track requests that a script build externalizes as script modules.
|
|
19
|
+
*
|
|
20
|
+
* These can only be reached through a runtime `import()`, which requires
|
|
21
|
+
* support for dynamic import in the output environment. The set is used
|
|
22
|
+
* to report an actionable error when that support is missing.
|
|
23
|
+
*/
|
|
24
|
+
scriptModuleDepsInScript = new Set();
|
|
25
|
+
/**
|
|
26
|
+
* Whether we should use modules. This will be set later to match webpack's `output.module` option.
|
|
27
|
+
*/
|
|
28
|
+
useModules = false;
|
|
29
|
+
constructor(options) {
|
|
30
|
+
if (typeof options === 'object' && options?.constructor?.name === 'DependencyExtractionWebpackPlugin' && 'options' in options) {
|
|
31
|
+
options = options.options;
|
|
32
|
+
}
|
|
33
|
+
if (options instanceof EnhancedDependencyExtractionWebpackPlugin) {
|
|
34
|
+
options = options.options;
|
|
35
|
+
}
|
|
36
|
+
this.options = {
|
|
37
|
+
externalizedReport: false,
|
|
38
|
+
injectPolyfill: false,
|
|
39
|
+
outputFilename: undefined,
|
|
40
|
+
useDefaults: true,
|
|
41
|
+
...options
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Convert a script module request to an external suitable for a script
|
|
46
|
+
* build.
|
|
47
|
+
*
|
|
48
|
+
* A classic script cannot contain a static `import`, so the `module`
|
|
49
|
+
* external type is not usable here: the script module has to be reached
|
|
50
|
+
* through a runtime `import()`, which is the `import` external type. The
|
|
51
|
+
* bare specifier is resolved by the import map that WordPress prints for
|
|
52
|
+
* enqueued script modules.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} request Original module request.
|
|
55
|
+
* @param {string|boolean|Error=} external Result of a script module external resolution.
|
|
56
|
+
* @return {string|undefined} The resulting external definition.
|
|
57
|
+
*/
|
|
58
|
+
static toScriptModuleExternalInScript(request, external) {
|
|
59
|
+
if (!external) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
if (external instanceof Error) {
|
|
63
|
+
throw external;
|
|
64
|
+
}
|
|
65
|
+
// The script module resolvers allow a boolean shorthand.
|
|
66
|
+
const target = external === true ? request : String(external);
|
|
67
|
+
return target.replace(/^module\s+/, 'import ');
|
|
68
|
+
}
|
|
69
|
+
externalizeWpDeps = ({ request }, callback) => {
|
|
70
|
+
let externalRequest;
|
|
71
|
+
let isScriptModule = false;
|
|
72
|
+
try {
|
|
73
|
+
// Handle via options.requestToExternal(Module) first.
|
|
74
|
+
if (this.useModules) {
|
|
75
|
+
if (typeof this.options.requestToExternalModule === 'function') {
|
|
76
|
+
const rawExternalRequest = this.options.requestToExternalModule(request);
|
|
77
|
+
// requestToExternalModule allows a boolean shorthand
|
|
78
|
+
if (rawExternalRequest === false) {
|
|
79
|
+
externalRequest = undefined;
|
|
80
|
+
}
|
|
81
|
+
else if (rawExternalRequest === true) {
|
|
82
|
+
externalRequest = request;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
externalRequest = rawExternalRequest;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
if (typeof this.options.requestToExternal === 'function') {
|
|
91
|
+
externalRequest = this.options.requestToExternal(request);
|
|
92
|
+
}
|
|
93
|
+
/*
|
|
94
|
+
* A script can depend on a script module, so fall back to
|
|
95
|
+
* `requestToScriptModule`. An explicit `requestToExternal`
|
|
96
|
+
* mapping wins: it describes a global that is known to exist.
|
|
97
|
+
*
|
|
98
|
+
* This deliberately does not consult `requestToExternalModule`:
|
|
99
|
+
* that option describes a module build, and the same options
|
|
100
|
+
* object is commonly shared by both builds.
|
|
101
|
+
*/
|
|
102
|
+
if (typeof externalRequest === 'undefined' &&
|
|
103
|
+
typeof this.options.requestToScriptModule === 'function') {
|
|
104
|
+
externalRequest =
|
|
105
|
+
EnhancedDependencyExtractionWebpackPlugin.toScriptModuleExternalInScript(request, this.options.requestToScriptModule(request));
|
|
106
|
+
isScriptModule = Boolean(externalRequest);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Cascade to default if unhandled and enabled.
|
|
110
|
+
if (typeof externalRequest === 'undefined' &&
|
|
111
|
+
this.options.useDefaults) {
|
|
112
|
+
if (this.useModules) {
|
|
113
|
+
externalRequest = (0, util_1.defaultRequestToExternalModule)(request);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
/*
|
|
117
|
+
* Prefer the script module: a request that is available as
|
|
118
|
+
* a script module is used as one, even when it is also
|
|
119
|
+
* registered as a script.
|
|
120
|
+
*/
|
|
121
|
+
try {
|
|
122
|
+
externalRequest =
|
|
123
|
+
EnhancedDependencyExtractionWebpackPlugin.toScriptModuleExternalInScript(request, (0, util_1.defaultRequestToExternalModule)(request));
|
|
124
|
+
isScriptModule = Boolean(externalRequest);
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
/*
|
|
128
|
+
* `defaultRequestToExternalModule` throws for WordPress
|
|
129
|
+
* scripts, which is exactly what we want to fall back
|
|
130
|
+
* to here.
|
|
131
|
+
*/
|
|
132
|
+
}
|
|
133
|
+
if (typeof externalRequest === 'undefined') {
|
|
134
|
+
externalRequest = (0, util_1.defaultRequestToExternal)(request);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
if (err instanceof Error) {
|
|
141
|
+
return callback(err);
|
|
142
|
+
}
|
|
143
|
+
throw err;
|
|
144
|
+
}
|
|
145
|
+
if (externalRequest) {
|
|
146
|
+
this.externalizedDeps.add(request);
|
|
147
|
+
if (isScriptModule) {
|
|
148
|
+
this.scriptModuleDepsInScript.add(request);
|
|
149
|
+
}
|
|
150
|
+
return callback(null, externalRequest);
|
|
151
|
+
}
|
|
152
|
+
return callback();
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* @param {string} request
|
|
156
|
+
* @return {string} Mapped dependency name
|
|
157
|
+
*/
|
|
158
|
+
mapRequestToDependency(request) {
|
|
159
|
+
// Handle via options.requestToHandle first.
|
|
160
|
+
if (typeof this.options.requestToHandle === 'function') {
|
|
161
|
+
const scriptDependency = this.options.requestToHandle(request);
|
|
162
|
+
if (scriptDependency) {
|
|
163
|
+
return scriptDependency;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Cascade to default if enabled.
|
|
167
|
+
if (this.options.useDefaults) {
|
|
168
|
+
const scriptDependency = (0, util_1.defaultRequestToHandle)(request);
|
|
169
|
+
if (scriptDependency) {
|
|
170
|
+
return scriptDependency;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// Fall back to the request name.
|
|
174
|
+
return request;
|
|
175
|
+
}
|
|
176
|
+
// noinspection JSUnusedGlobalSymbols
|
|
177
|
+
apply(compiler) {
|
|
178
|
+
this.useModules = Boolean(compiler.options.output?.module);
|
|
179
|
+
/**
|
|
180
|
+
* Offload externalization work to the ExternalsPlugin.
|
|
181
|
+
*/
|
|
182
|
+
new webpack_1.ExternalsPlugin(this.useModules ? 'import' : 'window', this.externalizeWpDeps).apply(compiler);
|
|
183
|
+
compiler.hooks.thisCompilation.tap(this.constructor.name, (compilation) => {
|
|
184
|
+
compilation.hooks.processAssets.tap({
|
|
185
|
+
name: this.constructor.name,
|
|
186
|
+
stage: compiler.webpack.Compilation
|
|
187
|
+
.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY,
|
|
188
|
+
}, () => this.checkForMagicComments(compilation));
|
|
189
|
+
compilation.hooks.processAssets.tap({
|
|
190
|
+
name: this.constructor.name,
|
|
191
|
+
stage: compiler.webpack.Compilation
|
|
192
|
+
.PROCESS_ASSETS_STAGE_SUMMARIZE,
|
|
193
|
+
}, () => this.addAssets(compilation));
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Check for magic comments before minification, so minification doesn't have to preserve them.
|
|
198
|
+
*/
|
|
199
|
+
checkForMagicComments(compilation) {
|
|
200
|
+
// Accumulate all entrypoint chunks, some of them shared
|
|
201
|
+
const entrypointChunks = new Set();
|
|
202
|
+
for (const entrypoint of compilation.entrypoints.values()) {
|
|
203
|
+
for (const chunk of entrypoint.chunks) {
|
|
204
|
+
entrypointChunks.add(chunk);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Process each entrypoint chunk independently
|
|
208
|
+
for (const chunk of entrypointChunks) {
|
|
209
|
+
const chunkFiles = Array.from(chunk.files);
|
|
210
|
+
const jsExtensionRegExp = this.useModules ? /\.m?js$/i : /\.js$/i;
|
|
211
|
+
const chunkJSFile = chunkFiles.find((f) => jsExtensionRegExp.test(f));
|
|
212
|
+
if (!chunkJSFile) {
|
|
213
|
+
// There's no JS file in this chunk, no work for us. This is typically a `style.css` from cache group.
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
// Prepare to look for magic comments, in order to decide whether
|
|
217
|
+
// `wp-polyfill` is needed.
|
|
218
|
+
const processContentsForMagicComments = (content) => {
|
|
219
|
+
const magicComments = [];
|
|
220
|
+
if (content.includes('/* wp:polyfill */')) {
|
|
221
|
+
magicComments.push('wp-polyfill');
|
|
222
|
+
}
|
|
223
|
+
return magicComments;
|
|
224
|
+
};
|
|
225
|
+
// Go through the assets to process the sources.
|
|
226
|
+
// This allows us to look for magic comments.
|
|
227
|
+
for (const filename of chunkFiles.sort()) {
|
|
228
|
+
const asset = compilation.getAsset(filename);
|
|
229
|
+
const content = asset?.source.buffer();
|
|
230
|
+
const wpMagicComments = content ? processContentsForMagicComments(content) : [];
|
|
231
|
+
compilation.updateAsset(filename, (v) => v, {
|
|
232
|
+
wpMagicComments,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
addAssets(compilation) {
|
|
238
|
+
const { externalizedReport, injectPolyfill, } = this.options;
|
|
239
|
+
/*
|
|
240
|
+
* A script reaches a script module through a runtime `import()`, so the
|
|
241
|
+
* output environment has to support it. Report this directly: webpack's
|
|
242
|
+
* own error for the underlying external does not explain the cause.
|
|
243
|
+
*/
|
|
244
|
+
if (!this.useModules &&
|
|
245
|
+
this.scriptModuleDepsInScript.size &&
|
|
246
|
+
compilation.outputOptions.environment?.dynamicImport === false) {
|
|
247
|
+
compilation.errors.push(new webpack_1.WebpackError(`${this.constructor.name}: ${Array.from(this.scriptModuleDepsInScript)
|
|
248
|
+
.sort()
|
|
249
|
+
.join(', ')} can only be loaded from a script through a dynamic \`import()\`, but the output environment does not support it. ` +
|
|
250
|
+
"Set `target: 'browserslist'` with a browserslist configuration whose browsers support dynamic import (as @wordpress/scripts does), or set `output.environment.dynamicImport: true`."));
|
|
251
|
+
}
|
|
252
|
+
// Dump actually externalized dependencies to a report file.
|
|
253
|
+
if (externalizedReport) {
|
|
254
|
+
const externalizedReportFile = typeof externalizedReport === 'string' ? externalizedReport : defaultExternalizedReportFileName;
|
|
255
|
+
compilation.emitAsset(externalizedReportFile, new webpack_1.sources.RawSource(JSON.stringify(Array.from(this.externalizedDeps).sort())));
|
|
256
|
+
}
|
|
257
|
+
const combinedAssetsData = {};
|
|
258
|
+
const jsExtensionRegExp = this.useModules ? /\.m?js$/i : /\.js$/i;
|
|
259
|
+
// Accumulate all entrypoint chunks, some of them shared
|
|
260
|
+
const entrypointChunks = new Set();
|
|
261
|
+
/**
|
|
262
|
+
* Track the files of each entrypoint's JS-less chunks, typically styles
|
|
263
|
+
* extracted by a `style.css` cache group. Those chunks don't get an
|
|
264
|
+
* asset file of their own, but their content must contribute to the
|
|
265
|
+
* version hash of the entrypoint's entry chunk so that style-only
|
|
266
|
+
* changes still produce a new version.
|
|
267
|
+
*/
|
|
268
|
+
const styleFilesByEntryChunk = new Map();
|
|
269
|
+
for (const entrypoint of compilation.entrypoints.values()) {
|
|
270
|
+
const entryChunk = entrypoint.getEntrypointChunk();
|
|
271
|
+
for (const chunk of entrypoint.chunks) {
|
|
272
|
+
entrypointChunks.add(chunk);
|
|
273
|
+
if (chunk === entryChunk ||
|
|
274
|
+
Array.from(chunk.files).some((f) => jsExtensionRegExp.test(f))) {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
const styleFiles = styleFilesByEntryChunk.get(entryChunk) ?? new Set();
|
|
278
|
+
for (const file of chunk.files) {
|
|
279
|
+
styleFiles.add(file);
|
|
280
|
+
}
|
|
281
|
+
styleFilesByEntryChunk.set(entryChunk, styleFiles);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
// Process each entrypoint chunk independently
|
|
285
|
+
for (const chunk of entrypointChunks) {
|
|
286
|
+
const chunkFiles = Array.from(chunk.files);
|
|
287
|
+
const chunkJSFile = chunkFiles.find((f) => jsExtensionRegExp.test(f));
|
|
288
|
+
if (!chunkJSFile) {
|
|
289
|
+
// There's no JS file in this chunk, no work for us. This is typically a `style.css` from cache group.
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
const chunkStaticDeps = new Set();
|
|
293
|
+
const chunkDynamicDeps = new Set();
|
|
294
|
+
const chunkScriptModuleStaticDeps = new Set();
|
|
295
|
+
const chunkScriptModuleDynamicDeps = new Set();
|
|
296
|
+
if (injectPolyfill) {
|
|
297
|
+
chunkStaticDeps.add('wp-polyfill');
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* @param {webpack.Module} m
|
|
301
|
+
* @param {boolean} [fromAsyncChunk] Module was found in an async chunk of the entry.
|
|
302
|
+
*/
|
|
303
|
+
const processModule = (m, fromAsyncChunk) => {
|
|
304
|
+
let viableRequest = typeof m.request === 'string' && m.request !== '__REMOVE_ME__' ? m.request : m.userRequest;
|
|
305
|
+
if (viableRequest !== undefined && !this.externalizedDeps.has(viableRequest) && viableRequest !== m.userRequest) {
|
|
306
|
+
viableRequest = m.userRequest;
|
|
307
|
+
}
|
|
308
|
+
if (viableRequest !== undefined && this.externalizedDeps.has(viableRequest)) {
|
|
309
|
+
if (this.useModules) {
|
|
310
|
+
// A static occurrence (in the entry chunk) wins.
|
|
311
|
+
if (fromAsyncChunk && chunkStaticDeps.has(viableRequest)) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
// Externals in an async chunk are reached via a dynamic
|
|
315
|
+
// import by definition.
|
|
316
|
+
const isStatic = !fromAsyncChunk &&
|
|
317
|
+
EnhancedDependencyExtractionWebpackPlugin.hasStaticDependencyPathToRoot(compilation, m);
|
|
318
|
+
(isStatic ? chunkStaticDeps : chunkDynamicDeps).add(viableRequest);
|
|
319
|
+
}
|
|
320
|
+
else if (m instanceof webpack_1.ExternalModule && (m.externalType === 'import' || m.externalType === 'module')) {
|
|
321
|
+
// A static occurrence (in the entry chunk) wins.
|
|
322
|
+
if (fromAsyncChunk && chunkScriptModuleStaticDeps.has(viableRequest)) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
// Externals in an async chunk are reached via a dynamic
|
|
326
|
+
// import by definition.
|
|
327
|
+
const isStatic = !fromAsyncChunk &&
|
|
328
|
+
EnhancedDependencyExtractionWebpackPlugin.hasStaticDependencyPathToRoot(compilation, m);
|
|
329
|
+
(isStatic ? chunkScriptModuleStaticDeps : chunkScriptModuleDynamicDeps).add(viableRequest);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
chunkStaticDeps.add(this.mapRequestToDependency(viableRequest));
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
const processChunkModules = (searchChunk, fromAsyncChunk) => {
|
|
337
|
+
for (const chunkModule of compilation.chunkGraph.getChunkModulesIterable(searchChunk)) {
|
|
338
|
+
if (chunkModule instanceof webpack_1.NormalModule || chunkModule instanceof webpack_1.ExternalModule) {
|
|
339
|
+
processModule(chunkModule, fromAsyncChunk);
|
|
340
|
+
}
|
|
341
|
+
if ((0, util_1.isConcatenatedModule)(chunkModule) && chunkModule.modules) {
|
|
342
|
+
// Loop through submodules of ConcatenatedModule.
|
|
343
|
+
for (const concatModule of chunkModule.modules) {
|
|
344
|
+
if (concatModule instanceof webpack_1.NormalModule || concatModule instanceof webpack_1.ExternalModule) {
|
|
345
|
+
processModule(concatModule, fromAsyncChunk);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
processChunkModules(chunk);
|
|
352
|
+
/*
|
|
353
|
+
* Also search the entry's async chunks: webpack can code-split a
|
|
354
|
+
* dynamically imported external into its own chunk.
|
|
355
|
+
*/
|
|
356
|
+
for (const group of chunk.groupsIterable) {
|
|
357
|
+
if (!(0, util_1.isEntrypoint)(group) || group.getEntrypointChunk() !== chunk) {
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
const seenGroups = new Set();
|
|
361
|
+
const groupQueue = [...group.getChildren()];
|
|
362
|
+
for (let childGroup = groupQueue.pop(); childGroup !== undefined; childGroup = groupQueue.pop()) {
|
|
363
|
+
if (!seenGroups.has(childGroup)) {
|
|
364
|
+
seenGroups.add(childGroup);
|
|
365
|
+
for (const asyncChunk of childGroup.chunks) {
|
|
366
|
+
processChunkModules(asyncChunk, true);
|
|
367
|
+
}
|
|
368
|
+
groupQueue.push(...childGroup.getChildren());
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
// Prepare to hash the sources. We can't just use
|
|
373
|
+
// `chunk.contentHash` because that's not updated when
|
|
374
|
+
// assets are minified. In practice the hash is updated by
|
|
375
|
+
// `RealContentHashPlugin` after minification, but it only modifies
|
|
376
|
+
// already-produced asset filenames and the updated hash is not
|
|
377
|
+
// available to plugins.
|
|
378
|
+
const { hashFunction, hashDigest, hashDigestLength } = compilation.outputOptions;
|
|
379
|
+
const hashBuilder = webpack_1.util.createHash(hashFunction);
|
|
380
|
+
// Prepare to look for magic comments in order to decide whether `wp-polyfill` is needed.
|
|
381
|
+
const handleMagicComments = (info) => {
|
|
382
|
+
if (info?.includes('wp-polyfill')) {
|
|
383
|
+
chunkStaticDeps.add('wp-polyfill');
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
// Include the files of the entrypoint's JS-less sibling chunks,
|
|
387
|
+
// typically extracted styles, in the version hash so that
|
|
388
|
+
// style-only changes still produce a new version.
|
|
389
|
+
const filesToHash = [
|
|
390
|
+
...new Set([
|
|
391
|
+
...chunkFiles,
|
|
392
|
+
...(styleFilesByEntryChunk.get(chunk) ?? []),
|
|
393
|
+
]),
|
|
394
|
+
];
|
|
395
|
+
// Go through the assets to process the sources.
|
|
396
|
+
// This allows us to generate hashes, as well as look for magic comments.
|
|
397
|
+
for (const filename of filesToHash.sort()) {
|
|
398
|
+
const asset = compilation.getAsset(filename);
|
|
399
|
+
if (asset) {
|
|
400
|
+
const content = asset.source.buffer();
|
|
401
|
+
hashBuilder.update(content);
|
|
402
|
+
handleMagicComments(asset.info.wpMagicComments);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
// Finalise hash.
|
|
406
|
+
const contentHash = hashBuilder
|
|
407
|
+
.digest(hashDigest)
|
|
408
|
+
.slice(0, hashDigestLength);
|
|
409
|
+
const assetData = {
|
|
410
|
+
dependencies: [
|
|
411
|
+
// Sort these so we can produce a stable, stringified representation.
|
|
412
|
+
...Array.from(chunkStaticDeps).sort(),
|
|
413
|
+
...Array.from(chunkDynamicDeps)
|
|
414
|
+
.sort()
|
|
415
|
+
.map((id) => ({ id, import: 'dynamic' })),
|
|
416
|
+
],
|
|
417
|
+
};
|
|
418
|
+
/*
|
|
419
|
+
* Merge the script module dependencies into a single list, keyed by
|
|
420
|
+
* script module ID, with an explicit import kind for each. This is
|
|
421
|
+
* the shape WordPress writes for its own assets.
|
|
422
|
+
*/
|
|
423
|
+
const scriptModuleDeps = new Map();
|
|
424
|
+
for (const id of chunkScriptModuleDynamicDeps) {
|
|
425
|
+
scriptModuleDeps.set(id, 'dynamic');
|
|
426
|
+
}
|
|
427
|
+
// A static occurrence wins: the script cannot start without it.
|
|
428
|
+
for (const id of chunkScriptModuleStaticDeps) {
|
|
429
|
+
scriptModuleDeps.set(id, 'static');
|
|
430
|
+
}
|
|
431
|
+
if (scriptModuleDeps.size) {
|
|
432
|
+
assetData.module_dependencies = Array.from(scriptModuleDeps.keys())
|
|
433
|
+
// Sort these so we can produce a stable, stringified representation.
|
|
434
|
+
.sort()
|
|
435
|
+
.map((id) => ({
|
|
436
|
+
id,
|
|
437
|
+
import: scriptModuleDeps.get(id),
|
|
438
|
+
}));
|
|
439
|
+
}
|
|
440
|
+
assetData.version = contentHash;
|
|
441
|
+
if (this.useModules) {
|
|
442
|
+
assetData.type = 'module';
|
|
443
|
+
}
|
|
444
|
+
if (compilation.options?.optimization?.runtimeChunk !== false) {
|
|
445
|
+
// Sets the script handle for the shared runtime file so WordPress registers it only once when using the asset file.
|
|
446
|
+
assetData.handle =
|
|
447
|
+
compilation.name +
|
|
448
|
+
'-' +
|
|
449
|
+
chunkJSFile
|
|
450
|
+
.replace(/\\/g, '/')
|
|
451
|
+
.replace(jsExtensionRegExp, '');
|
|
452
|
+
}
|
|
453
|
+
combinedAssetsData[chunkJSFile] = assetData;
|
|
454
|
+
}
|
|
455
|
+
// Add source into compilation for webpack to trigger a phase re-run
|
|
456
|
+
compilation.emitAsset("assets.json", new webpack_1.sources.RawSource(JSON.stringify(combinedAssetsData, undefined, " ")), { "parsed-assets-json": combinedAssetsData });
|
|
457
|
+
}
|
|
458
|
+
static staticDepsCurrent = new WeakSet();
|
|
459
|
+
static staticDepsCache = new WeakMap();
|
|
460
|
+
/**
|
|
461
|
+
* Can we trace a line of static dependencies from an entry to a module
|
|
462
|
+
*
|
|
463
|
+
* @return {boolean} True if there is a static import path to the root
|
|
464
|
+
*/
|
|
465
|
+
static hasStaticDependencyPathToRoot(compilation, block) {
|
|
466
|
+
const existingDepsCacheValue = EnhancedDependencyExtractionWebpackPlugin.staticDepsCache.get(block);
|
|
467
|
+
if (existingDepsCacheValue !== undefined) {
|
|
468
|
+
return existingDepsCacheValue;
|
|
469
|
+
}
|
|
470
|
+
if (EnhancedDependencyExtractionWebpackPlugin.staticDepsCurrent.has(block)) {
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
473
|
+
EnhancedDependencyExtractionWebpackPlugin.staticDepsCurrent.add(block);
|
|
474
|
+
const incomingConnections = [
|
|
475
|
+
...compilation.moduleGraph.getIncomingConnections(block),
|
|
476
|
+
].filter((connection) => {
|
|
477
|
+
// Library connections don't have a dependency, this is a root
|
|
478
|
+
return connection.dependency &&
|
|
479
|
+
// Entry dependencies are another root
|
|
480
|
+
connection.dependency.type !== 'entry';
|
|
481
|
+
});
|
|
482
|
+
// If we don't have non-entry, non-library incoming connections,
|
|
483
|
+
// we've reached a root of
|
|
484
|
+
if (!incomingConnections.length) {
|
|
485
|
+
EnhancedDependencyExtractionWebpackPlugin.staticDepsCache.set(block, true);
|
|
486
|
+
EnhancedDependencyExtractionWebpackPlugin.staticDepsCurrent.delete(block);
|
|
487
|
+
return true;
|
|
488
|
+
}
|
|
489
|
+
const staticDependentModules = incomingConnections.flatMap((connection) => {
|
|
490
|
+
const { dependency } = connection;
|
|
491
|
+
if (!dependency) {
|
|
492
|
+
return [];
|
|
493
|
+
}
|
|
494
|
+
const parentBlock = compilation.moduleGraph.getParentBlock(dependency);
|
|
495
|
+
return parentBlock && parentBlock.constructor.name !== webpack_1.AsyncDependenciesBlock.name
|
|
496
|
+
? [compilation.moduleGraph.getParentModule(dependency)]
|
|
497
|
+
: [];
|
|
498
|
+
});
|
|
499
|
+
// All the dependencies were Async, the module was reached via a dynamic import
|
|
500
|
+
if (!staticDependentModules.length) {
|
|
501
|
+
EnhancedDependencyExtractionWebpackPlugin.staticDepsCache.set(block, false);
|
|
502
|
+
EnhancedDependencyExtractionWebpackPlugin.staticDepsCurrent.delete(block);
|
|
503
|
+
return false;
|
|
504
|
+
}
|
|
505
|
+
// Continue to explore any static dependencies
|
|
506
|
+
const result = staticDependentModules.some((parentStaticDependentModule) => {
|
|
507
|
+
return !!parentStaticDependentModule && EnhancedDependencyExtractionWebpackPlugin.hasStaticDependencyPathToRoot(compilation, parentStaticDependentModule);
|
|
508
|
+
});
|
|
509
|
+
EnhancedDependencyExtractionWebpackPlugin.staticDepsCache.set(block, result);
|
|
510
|
+
EnhancedDependencyExtractionWebpackPlugin.staticDepsCurrent.delete(block);
|
|
511
|
+
return result;
|
|
512
|
+
}
|
|
513
|
+
addExternalizedDep = this.externalizedDeps.add.bind(this.externalizedDeps);
|
|
514
|
+
}
|
|
515
|
+
exports.EnhancedDependencyExtractionWebpackPlugin = EnhancedDependencyExtractionWebpackPlugin;
|
|
516
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wordpress-ports/dependency-extraction-webpack-plugin/index.ts"],"names":[],"mappings":";;;AAEA,qCAeiB;AAOjB,iCAA4I;AAE5I,MAAM,iCAAiC,GAAG,gCAAgC,CAAC;AAa3E;IACC;;;;;;OAMG;IACc,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAErC,OAAO,CAAmD;IAE3E;;;;;;OAMG;IACc,wBAAwB,GAAG,IAAI,GAAG,EAAU,CAAC;IAE9D;;OAEG;IACK,UAAU,GAAG,KAAK,CAAC;IAE3B,YAAY,OAA2I;QACtJ,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,EAAE,WAAW,EAAE,IAAI,KAAK,mCAAmC,IAAI,SAAS,IAAI,OAAO,EAAE,CAAC;YAC/H,OAAO,GAAG,OAAO,CAAC,OAA2D,CAAC;QAC/E,CAAC;QACD,IAAI,OAAO,YAAY,yCAAyC,EAAE,CAAC;YAClE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC3B,CAAC;QACD,IAAI,CAAC,OAAO,GAAG;YACd,kBAAkB,EAAE,KAAK;YACzB,cAAc,EAAE,KAAK;YACrB,cAAc,EAAE,SAAS;YACzB,WAAW,EAAE,IAAI;YACjB,GAAG,OAAO;SACV,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,8BAA8B,CAAC,OAAe,EAAE,QAAmC;QACzF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,IAAI,QAAQ,YAAY,KAAK,EAAE,CAAC;YAC/B,MAAM,QAAQ,CAAC;QAChB,CAAC;QAED,yDAAyD;QACzD,MAAM,MAAM,GAAG,QAA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,2BAA2B,CAC3B,CAAC;QACH,CAAC,CACD,CAAC;QAEF,yCAAyC,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC7E,yCAAyC,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1E,OAAO,MAAM,CAAC;IACf,CAAC;IAEe,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;CAC3F"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ChunkGroup, Entrypoint, Module } from "webpack";
|
|
2
|
+
/**
|
|
3
|
+
* Default request to global transformation
|
|
4
|
+
*
|
|
5
|
+
* Transform @wordpress dependencies:
|
|
6
|
+
* - request `@wordpress/api-fetch` becomes `[ 'wp', 'apiFetch' ]`
|
|
7
|
+
* - request `@wordpress/i18n` becomes `[ 'wp', 'i18n' ]`
|
|
8
|
+
*
|
|
9
|
+
* @param {string} request Module request (the module name in `import from`) to be transformed
|
|
10
|
+
* @return {string|string[]|undefined} The resulting external definition. Return `undefined`
|
|
11
|
+
* to ignore the request. Return `string|string[]` to map the request to an external.
|
|
12
|
+
*/
|
|
13
|
+
export declare function defaultRequestToExternal(request: string): string | string[] | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Default request to external module transformation
|
|
16
|
+
*
|
|
17
|
+
* Currently only @wordpress/interactivity and `@wordpress/interactivity-router`
|
|
18
|
+
* are supported.
|
|
19
|
+
*
|
|
20
|
+
* Do not use the boolean shorthand here, it's only handled for the
|
|
21
|
+
* `requestToExternalModule` option.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} request Module request (the module name in `import from`) to be transformed
|
|
24
|
+
* @return {string|undefined} The resulting external definition.
|
|
25
|
+
* - Return `undefined` to ignore the request (do not externalize).
|
|
26
|
+
* - Return `string` to map the request to an external.
|
|
27
|
+
* - Return `Error` to emit an error.
|
|
28
|
+
*/
|
|
29
|
+
export declare function defaultRequestToExternalModule(request: string): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Default request to WordPress script handle transformation
|
|
32
|
+
*
|
|
33
|
+
* Transform @wordpress dependencies:
|
|
34
|
+
* - request `@wordpress/i18n` becomes `wp-i18n`
|
|
35
|
+
* - request `@wordpress/escape-html` becomes `wp-escape-html`
|
|
36
|
+
*
|
|
37
|
+
* @param {string} request Module request (the module name in `import from`) to be transformed
|
|
38
|
+
* @return {string|undefined} WordPress script handle to map the request to. Return `undefined`
|
|
39
|
+
* to use the same name as the module.
|
|
40
|
+
*/
|
|
41
|
+
export declare function defaultRequestToHandle(request: string): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Given a string, returns a new string with dash separators converted to
|
|
44
|
+
* camelCase equivalent. This is not as aggressive as `_.camelCase` in
|
|
45
|
+
* converting to uppercase, where Lodash will also capitalize letters
|
|
46
|
+
* following numbers.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} string Input dash-delimited string.
|
|
49
|
+
* @return {string} Camel-cased string.
|
|
50
|
+
*/
|
|
51
|
+
export declare function camelCaseDash(string: string): string;
|
|
52
|
+
export interface ConcatenatedModule extends Module {
|
|
53
|
+
get modules(): Module[];
|
|
54
|
+
}
|
|
55
|
+
export declare function isConcatenatedModule(module: Module): module is ConcatenatedModule;
|
|
56
|
+
export declare function isEntrypoint(group: ChunkGroup | undefined | null): group is Entrypoint;
|
|
57
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/wordpress-ports/dependency-extraction-webpack-plugin/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAC,MAAM,SAAS,CAAC;AAsB5D;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CA2CvF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,8BAA8B,CAAE,OAAO,EAAE,MAAM,GAAI,MAAM,GAAC,SAAS,CAyBlF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAwB1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,MAAM,WAAW,kBAAmB,SAAQ,MAAM;IACjD,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;CACxB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,kBAAkB,CAEjF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAC,SAAS,GAAC,IAAI,GAAG,KAAK,IAAI,UAAU,CAElF"}
|