@plaudit/webpack-extensions 4.0.0-rc.1 → 4.0.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 +5 -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/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 +3 -3
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IndividualBatchProcessor = exports.WrapperManager = void 0;
|
|
4
|
+
exports.isAutoRegisteringPlugin = isAutoRegisteringPlugin;
|
|
5
|
+
const tapable_1 = require("tapable");
|
|
6
|
+
function isAutoRegisteringPlugin(thing) {
|
|
7
|
+
return !!thing && typeof thing === 'object' &&
|
|
8
|
+
'plauditWebpackExtensionsPlugin' in thing && thing.plauditWebpackExtensionsPlugin === true &&
|
|
9
|
+
'register' in thing && typeof thing.register === 'function';
|
|
10
|
+
}
|
|
11
|
+
class WrapperManager {
|
|
12
|
+
coordinator;
|
|
13
|
+
config;
|
|
14
|
+
hooks = {
|
|
15
|
+
webpackConfig: {
|
|
16
|
+
/**
|
|
17
|
+
* This is used to modify the module rules for Webpack.
|
|
18
|
+
* It is intended to allow plugins to fix up issues that can come from how WordPress configures the rules by default and to patch in additional file handling.
|
|
19
|
+
* It uses immer to ensure that the changes cannot be leaked to other {@link Configuration} instances.
|
|
20
|
+
* It fires once per Webpack {@link Configuration}.
|
|
21
|
+
*/
|
|
22
|
+
rules: new tapable_1.AsyncSeriesHook(["rules", "rulesTimeConfig"], "webpackConfigRules"),
|
|
23
|
+
/**
|
|
24
|
+
* This is used to allow for modifying the Webpack {@link Configuration} after everything else is done.
|
|
25
|
+
* It uses immer to ensure that the changes cannot be leaked to other {@link Configuration} instances.
|
|
26
|
+
* It fires once per Webpack {@link Configuration}.
|
|
27
|
+
*/
|
|
28
|
+
finalize: new tapable_1.AsyncSeriesHook(["webpackConfig", "props"], "webpackConfigFinalize"),
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* This is used to set up the taps for each batch. It fires once per {@link IndividualBatchProcessor}
|
|
32
|
+
*/
|
|
33
|
+
batch: new tapable_1.AsyncSeriesHook(["batch", "props"]),
|
|
34
|
+
};
|
|
35
|
+
emitterPlugins = [];
|
|
36
|
+
supportedSourceTypes = new Set();
|
|
37
|
+
constructor(coordinator, config) {
|
|
38
|
+
this.coordinator = coordinator;
|
|
39
|
+
this.config = config;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.WrapperManager = WrapperManager;
|
|
43
|
+
class IndividualBatchProcessor {
|
|
44
|
+
plugins;
|
|
45
|
+
canClean;
|
|
46
|
+
hasAnyNonModuleBuilds;
|
|
47
|
+
entrypointFields;
|
|
48
|
+
scriptExtension;
|
|
49
|
+
hooks = {
|
|
50
|
+
/**
|
|
51
|
+
* This fires before the batch has been processed to allow logic that should be executed in parallel to be used without making the batch hook parallel
|
|
52
|
+
*/
|
|
53
|
+
beforeBatch: new tapable_1.AsyncParallelHook([], "beforeBatch"),
|
|
54
|
+
/**
|
|
55
|
+
* Fires before the destination handler has been resolved. This fires regardless of whether the resolution is successful.
|
|
56
|
+
*/
|
|
57
|
+
beforeDestinationHandler: new tapable_1.AsyncParallelHook(["item"], "beforeDestinationHandler"),
|
|
58
|
+
/**
|
|
59
|
+
* Used to determine the logic that will handle the ResolvedDestination. If none of the taps returns anything, the destination is skipped.
|
|
60
|
+
*/
|
|
61
|
+
destinationHandler: new tapable_1.SyncBailHook(["item"], "destinationHandler"),
|
|
62
|
+
/**
|
|
63
|
+
* Fires after the destination handler has been resolved. This DOES NOT fire if the resolution was unsuccessful.
|
|
64
|
+
* This is intended for use in adding plugins that do additional processing work like {@link CopyPlugin}
|
|
65
|
+
*/
|
|
66
|
+
afterDestinationHandler: new tapable_1.AsyncSeriesHook(["item", "destinationHandler"], "afterDestinationHandler"),
|
|
67
|
+
/**
|
|
68
|
+
* Fires after the batch has been processed, but before it is finalized into a single config object.
|
|
69
|
+
* This is intended to allow logic that collects data over the course of the batch being processed to use it
|
|
70
|
+
*/
|
|
71
|
+
afterBatch: new tapable_1.AsyncSeriesHook(["plugins"], "afterBatch"),
|
|
72
|
+
};
|
|
73
|
+
metadata = new Map();
|
|
74
|
+
constructor(plugins, canClean, hasAnyNonModuleBuilds, entrypointFields, scriptExtension) {
|
|
75
|
+
this.plugins = plugins;
|
|
76
|
+
this.canClean = canClean;
|
|
77
|
+
this.hasAnyNonModuleBuilds = hasAnyNonModuleBuilds;
|
|
78
|
+
this.entrypointFields = entrypointFields;
|
|
79
|
+
this.scriptExtension = scriptExtension;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.IndividualBatchProcessor = IndividualBatchProcessor;
|
|
83
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/api/configuration.ts"],"names":[],"mappings":";;;;AACA,qCAAyE;AAWzE,iCAAwC,KAAc;IACrD,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC1C,gCAAgC,IAAI,KAAK,IAAI,KAAK,CAAC,8BAA8B,KAAK,IAAI;QAC1F,UAAU,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,QAAQ,KAAK,UAAU,CAAC;AAC9D,CAAC;AAgBD;IA2BkB,WAAW;IACX,MAAM;IA3BP,KAAK,GAAG;QACvB,aAAa,EAAE;YACd;;;;;eAKG;YACH,KAAK,EAAE,IAAI,yBAAe,C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+
import type { Compilation, Compiler, Configuration, WebpackPluginInstance } from "webpack";
|
|
2
|
+
import type { UnifiedAssetsCacheEntry } from "./asset-information-emission";
|
|
3
|
+
import { makeEntryManager } from "./entries";
|
|
4
|
+
export type CoordinatedEmissionTargetBuilder = Readonly<[string, (baseConfig: Configuration, coordinator: RootCoordinatorPlugin) => Configuration]>;
|
|
5
|
+
/**
|
|
6
|
+
* NOTE: Each instance of a given plugin MUST be restricted to a single compiler
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class CoordinatableEmitter implements WebpackPluginInstance {
|
|
9
|
+
abstract getCoordinatedEmissionTargets(): CoordinatedEmissionTargetBuilder[];
|
|
10
|
+
protected abstract readonly coordinator: RootCoordinatorPlugin;
|
|
11
|
+
abstract readonly provides: ReadonlyArray<string>;
|
|
12
|
+
abstract readonly requires: ReadonlyArray<string>;
|
|
13
|
+
abstract readonly defaultCompilationName: string | undefined;
|
|
14
|
+
apply(compiler: Compiler): void;
|
|
15
|
+
makeEntryManager(compiler: Compiler, compilation: Compilation, context: string, coordinatedLoaderName?: string | undefined): ReturnType<typeof makeEntryManager>;
|
|
16
|
+
}
|
|
17
|
+
export interface RootCoordinatorPlugin extends WebpackPluginInstance {
|
|
18
|
+
enableAssetPhpFileEmission(coordinatedLoaderName: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* This is called automatically from within {@link CoordinatableEmitter#apply()}
|
|
21
|
+
*/
|
|
22
|
+
registerDataEmitter(compiler: Compiler, emitter: CoordinatableEmitter, ...emissionTargets: string[]): void;
|
|
23
|
+
reportData(compilation: Compilation, emitter: CoordinatableEmitter, emissionTarget: string, data: Record<string, unknown> | unknown[]): void;
|
|
24
|
+
getHandles(compilation: Compilation): Promise<Record<string, UnifiedAssetsCacheEntry>>;
|
|
25
|
+
getData<T extends Record<string, unknown> | unknown[]>(emissionTarget: string): T[];
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=coordinatable-emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
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AAG,IAAI,CAAC;IAE3G,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAE3I,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC;IAEvF,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAC,OAAO,EAAE,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;CAClF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoordinatableEmitter = void 0;
|
|
4
|
+
const entries_1 = require("./entries");
|
|
5
|
+
/**
|
|
6
|
+
* NOTE: Each instance of a given plugin MUST be restricted to a single compiler
|
|
7
|
+
*/
|
|
8
|
+
class CoordinatableEmitter {
|
|
9
|
+
apply(compiler) {
|
|
10
|
+
this.coordinator.registerDataEmitter(compiler, this, ...this.provides);
|
|
11
|
+
}
|
|
12
|
+
makeEntryManager(compiler, compilation, context, coordinatedLoaderName = this.provides[0]) {
|
|
13
|
+
if (coordinatedLoaderName === undefined) {
|
|
14
|
+
throw new Error("A coordinated emitter name was somehow not provided. Please report this to Josh immediately");
|
|
15
|
+
}
|
|
16
|
+
return (0, entries_1.makeEntryManager)(compiler, compilation, context, coordinatedLoaderName);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.CoordinatableEmitter = CoordinatableEmitter;
|
|
20
|
+
//# sourceMappingURL=coordinatable-emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinatable-emitter.js","sourceRoot":"","sources":["../../src/api/coordinatable-emitter.ts"],"names":[],"mappings":";;;AAGA,uCAA2C;AAI3C;;GAEG;AACH;IASC,KAAK,CAAC,QAAkB;QACvB,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC;IAED,gBAAgB,CAAC,QAAkB,EAAE,WAAwB,EAAE,OAAe,EAAE,qBAAqB,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvH,IAAI,qBAAqB,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,6FAA6F,CAAC,CAAC;QAChH,CAAC;QACD,OAAO,IAAA,0BAAgB,EAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAChF,CAAC;CACD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { EntryOptionPlugin, Entrypoint } from "webpack";
|
|
2
|
+
import type { BaseHandleData, UnifiedAssetsCacheEntry } from "../asset-information-emission";
|
|
3
|
+
import { type HandleAndDerivationMechanism, type HandleDerivationMechanism } from "../handle-derivation";
|
|
4
|
+
import type { NormalizedEnqueuingControlFlags } from "./flag-logic";
|
|
5
|
+
import { type EnqueuedAssetType, type EntrypointField, type NormalizedUsageLocations } from "./locations";
|
|
6
|
+
export type MinEntryInfo = {
|
|
7
|
+
absoluteSrc: string;
|
|
8
|
+
name: string;
|
|
9
|
+
type: EnqueuedAssetType;
|
|
10
|
+
};
|
|
11
|
+
export type EntryOptions = ReturnType<typeof EntryOptionPlugin.entryDescriptionToOptions>;
|
|
12
|
+
type PlauditEntryExtras = MinEntryInfo & {
|
|
13
|
+
flags: NormalizedEnqueuingControlFlags;
|
|
14
|
+
locations: NormalizedUsageLocations;
|
|
15
|
+
additionalDependencies: string[];
|
|
16
|
+
initialHandleName: HandleAndDerivationMechanism | false;
|
|
17
|
+
additionalSrcs?: string[];
|
|
18
|
+
baseDestination: string;
|
|
19
|
+
coordinatedLoaderName?: string;
|
|
20
|
+
staticallyLoaded?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Defaults to false; note: this function returning true DOES NOT mean that the asset WILL be inlined - it just means that it MAY be inlined
|
|
23
|
+
*/
|
|
24
|
+
mayInline?: (file: string, options: PlauditEntryOptions) => boolean;
|
|
25
|
+
/**
|
|
26
|
+
* This defaults to true if the asset is not going to be inlined and false otherwise
|
|
27
|
+
*/
|
|
28
|
+
writeToDisk?: (file: string, options: PlauditEntryOptions) => boolean;
|
|
29
|
+
shouldOmitRegistration?: boolean;
|
|
30
|
+
computedHandleName?: string;
|
|
31
|
+
computedHandleArguments?: BaseHandleData['rest'];
|
|
32
|
+
intermediateInlineConfig?: {
|
|
33
|
+
deleteWhenDone: boolean;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export type NoOverrides<T extends object, Reserved> = Extract<keyof T, keyof Reserved> extends never ? T : never;
|
|
37
|
+
export type PlauditEntryOptions<T extends object = object> = PlauditEntryExtras & EntryOptions & NoOverrides<T, PlauditEntryExtras | EntryOptions | 'handleConfig'>;
|
|
38
|
+
export type HandleConfig<T extends PlauditEntryOptions = PlauditEntryOptions> = string | ((generatedHandle: string, options: Omit<T, 'initialHandleName'>) => string | undefined | HandleAndDerivationMechanism) | {
|
|
39
|
+
niceName: string;
|
|
40
|
+
fallbackNiceName?: string;
|
|
41
|
+
derivation?: HandleDerivationMechanism;
|
|
42
|
+
};
|
|
43
|
+
export type MinPlauditEntryOptions<T extends PlauditEntryOptions = PlauditEntryOptions> = Omit<T, Exclude<keyof EntryOptions, 'name'> | 'initialHandleName'>;
|
|
44
|
+
export declare function makePlauditEntryOptions<T extends PlauditEntryOptions>(handleConfig: HandleConfig<T> | undefined, handlePrefix: string, handleSuffix: string, options: Omit<T, 'initialHandleName'>): Omit<T, 'initialHandleName'> & {
|
|
45
|
+
initialHandleName: HandleAndDerivationMechanism;
|
|
46
|
+
};
|
|
47
|
+
export declare function isPlauditEntryOptions(options: object | undefined): options is PlauditEntryOptions;
|
|
48
|
+
export declare function getPlauditEntryOptions(entrypoint: Entrypoint): PlauditEntryOptions | undefined;
|
|
49
|
+
export type BlockEntryOptions = PlauditEntryOptions<{
|
|
50
|
+
blockJsonAssetAbsoluteSrc: string;
|
|
51
|
+
originalEntrypointFieldValue?: string;
|
|
52
|
+
entrypointField: EntrypointField;
|
|
53
|
+
}>;
|
|
54
|
+
export declare function isBlockEntryOptions(options: PlauditEntryOptions): options is BlockEntryOptions;
|
|
55
|
+
export declare function isBlockEntryOptionsHolder(entry: UnifiedAssetsCacheEntry): entry is UnifiedAssetsCacheEntry<BlockEntryOptions>;
|
|
56
|
+
export type ExtensionEntryOptions = PlauditEntryOptions<{
|
|
57
|
+
blockSlug: string;
|
|
58
|
+
entrypointField: EntrypointField;
|
|
59
|
+
}>;
|
|
60
|
+
export declare function isExtensionEntryOptions(options: PlauditEntryOptions): options is ExtensionEntryOptions;
|
|
61
|
+
export declare function isExtensionEntryOptionsHolder(entry: UnifiedAssetsCacheEntry): entry is UnifiedAssetsCacheEntry<ExtensionEntryOptions>;
|
|
62
|
+
export type ObjectEntrypointJsonParseResult = {
|
|
63
|
+
entrypointName: string;
|
|
64
|
+
filename: string;
|
|
65
|
+
additionalSrcFilenames?: string[];
|
|
66
|
+
};
|
|
67
|
+
export declare function parseEntrypointsJson(entrypointsJsonPath: string): Promise<(string | ObjectEntrypointJsonParseResult)[]>;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../src/api/entries/dependencies.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,iBAAiB,EAAE,UAAU,EAAC,MAAM,SAAS,CAAC;AAG3D,OAAO,KAAK,EAAC,cAAc,EAAE,uBAAuB,EAAC,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EAAuC,KAAK,4BAA4B,E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AU,GAAG,mBAAmB,GAAC,SAAS,CAE5F;AAMD,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;IAAC,yBAAyB,EAAE,MAAM,CAAC;IAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,eAAe,CAAA;CAAC,CAAC,CAAC;AAClK,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,IAAI,iBAAiB,CAG9F;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,uBAAuB,GAAG,KAAK,IAAI,uBAAuB,CAAC,iBAAiB,CAAC,CAE7H;AAMD,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,eAAe,CAAA;CAAC,CAAC,CAAC;AAC/G,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,IAAI,qBAAqB,CAEtG;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,uBAAuB,GAAG,KAAK,IAAI,uBAAuB,CAAC,qBAAqB,CAAC,CAErI;AAED,MAAM,MAAM,+BAA+B,GAAG;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC;AAC5H,wBAAsB,oBAAoB,CAAC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,MAAM,GAAC,+BAA+B,CAAC,EAAE,CAAC,CAmB3H"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makePlauditEntryOptions = makePlauditEntryOptions;
|
|
4
|
+
exports.isPlauditEntryOptions = isPlauditEntryOptions;
|
|
5
|
+
exports.getPlauditEntryOptions = getPlauditEntryOptions;
|
|
6
|
+
exports.isBlockEntryOptions = isBlockEntryOptions;
|
|
7
|
+
exports.isBlockEntryOptionsHolder = isBlockEntryOptionsHolder;
|
|
8
|
+
exports.isExtensionEntryOptions = isExtensionEntryOptions;
|
|
9
|
+
exports.isExtensionEntryOptionsHolder = isExtensionEntryOptionsHolder;
|
|
10
|
+
exports.parseEntrypointsJson = parseEntrypointsJson;
|
|
11
|
+
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const utils_1 = require("../../utils");
|
|
13
|
+
const handle_derivation_1 = require("../handle-derivation");
|
|
14
|
+
const locations_1 = require("./locations");
|
|
15
|
+
function makePlauditEntryOptions(handleConfig, handlePrefix, handleSuffix, options) {
|
|
16
|
+
return { ...options, initialHandleName: (0, handle_derivation_1.convertHandleConfigToEmittableHandle)(handleConfig, handlePrefix, handleSuffix, options) };
|
|
17
|
+
}
|
|
18
|
+
function isPlauditEntryOptions(options) {
|
|
19
|
+
return !!options &&
|
|
20
|
+
('type' in options && (0, locations_1.isEnqueuedAssetType)(options.type)) &&
|
|
21
|
+
('flags' in options && typeof options.flags === 'object' && !!options.flags) &&
|
|
22
|
+
('locations' in options && typeof options.locations === 'object' && !!options.locations) &&
|
|
23
|
+
('baseDestination' in options && typeof options.baseDestination === 'string');
|
|
24
|
+
}
|
|
25
|
+
function getPlauditEntryOptions(entrypoint) {
|
|
26
|
+
return isPlauditEntryOptions(entrypoint.options) ? entrypoint.options : undefined;
|
|
27
|
+
}
|
|
28
|
+
function isBlockEntryOptions(options) {
|
|
29
|
+
return ('blockJsonAssetAbsoluteSrc' in options && typeof options.blockJsonAssetAbsoluteSrc === 'string') &&
|
|
30
|
+
('entrypointField' in options && (0, locations_1.isEntrypointField)(options.entrypointField));
|
|
31
|
+
}
|
|
32
|
+
function isBlockEntryOptionsHolder(entry) {
|
|
33
|
+
return isBlockEntryOptions(entry.options);
|
|
34
|
+
}
|
|
35
|
+
function isExtensionEntryOptions(options) {
|
|
36
|
+
return ('blockSlug' in options && typeof options.blockSlug === 'string') && ('entrypointField' in options && (0, locations_1.isEntrypointField)(options.entrypointField));
|
|
37
|
+
}
|
|
38
|
+
function isExtensionEntryOptionsHolder(entry) {
|
|
39
|
+
return isExtensionEntryOptions(entry.options);
|
|
40
|
+
}
|
|
41
|
+
async function parseEntrypointsJson(entrypointsJsonPath) {
|
|
42
|
+
const entrypointsJson = JSON.parse(await (0, promises_1.readFile)(entrypointsJsonPath, 'utf-8'));
|
|
43
|
+
if (Array.isArray(entrypointsJson)) {
|
|
44
|
+
return entrypointsJson;
|
|
45
|
+
}
|
|
46
|
+
//TODO: CONSIDER: While this is more correct than the prior behavior (which was ignoring the key), it could cause errors
|
|
47
|
+
return Object.entries(entrypointsJson)
|
|
48
|
+
.map(([key, value]) => {
|
|
49
|
+
if (!Array.isArray(value)) {
|
|
50
|
+
if (value.import !== undefined) {
|
|
51
|
+
value = value.import;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return (0, utils_1.hasAtLeastOneItem)(value) ? { entrypointName: key, filename: value[0], additionalSrcFilenames: value.slice(1) } : undefined;
|
|
58
|
+
})
|
|
59
|
+
.filter(v => v !== undefined);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/api/entries/dependencies.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,+CAA0C;AAI1C,uCAA8C;AAE9C,4DAA6I;AAG7I,2CAAgJ;AA4ChJ,iCAAuE,YAAuC,EAAE,YAAoB,EAAE,YAAoB,EAAE,OAAqC;IAChM,OAAO,EAAC,GAAG,OAAO,EAAE,iBAAiB,EAAE,IAAA,wDAAoC,EAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,CAAC,EAAC,CAAC;AACjI,CAAC;AAED,+BAAsC,OAAyB;IAC9D,OAAO,CAAC,CAAC,OAAO;QACf,CAAC,MA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,CAAC,KAAK,CAAC,MAAM,IAAA,mBAAQ,EAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC;IAClK,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QACpC,OAAO,eAAe,CAAC;IACxB,CAAC;IAED,wHAAwH;IACxH,OAAO,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;SACpC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAA6C,EAAE;QAChE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAChC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;YACtB,CAAC;iBAAM,CAAC;gBACP,OAAO,SAAS,CAAC;YAClB,CAAC;QACF,CAAC;QACD,OAAO,IAAA,yBAAiB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAE,EAAC,cAAc,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,sBAAsB,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5I,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
declare const wordPressLoadingStrategies: readonly ['defer', 'async'];
|
|
2
|
+
declare const namedStrategies: readonly ["defer", "async", "eager", "lazy"];
|
|
3
|
+
export type LoadingStrategy = typeof namedStrategies[number];
|
|
4
|
+
export type WordPressSupportedLoadingStrategy = typeof wordPressLoadingStrategies[number];
|
|
5
|
+
export type ShorthandLoadingStrategy = Exclude<LoadingStrategy, WordPressSupportedLoadingStrategy>;
|
|
6
|
+
export declare function isValidNamedStrategy(strategy: unknown): strategy is LoadingStrategy;
|
|
7
|
+
export declare function isWordPressSupportedLoadingStrategy(strategy: unknown): strategy is WordPressSupportedLoadingStrategy;
|
|
8
|
+
export declare function newInvalidLoadingStrategyError(strategy: unknown, file?: string): import("webpack").WebpackError;
|
|
9
|
+
export declare function isDeferringLoadingStrategy(strategy: unknown): strategy is "async" | "defer";
|
|
10
|
+
export type InFooter = boolean;
|
|
11
|
+
export declare function isValidInFooter(in_footer: unknown): in_footer is InFooter;
|
|
12
|
+
export declare function invalidInFooterError(in_footer: unknown, file?: string): import("webpack").WebpackError;
|
|
13
|
+
declare const validFetchPriorities: readonly ["auto", "low", "high"];
|
|
14
|
+
export type FetchPriority = typeof validFetchPriorities[number];
|
|
15
|
+
export declare function isValidFetchPriority(fetchpriority: unknown): fetchpriority is FetchPriority;
|
|
16
|
+
export declare function newInvalidFetchPriorityError(fetchpriority: unknown, file?: string): import("webpack").WebpackError;
|
|
17
|
+
declare const validInliningPositionValues: readonly ['before', 'after'];
|
|
18
|
+
export type InliningPosition = typeof validInliningPositionValues[number];
|
|
19
|
+
export declare const defaultInliningPosition = "after";
|
|
20
|
+
export declare function isValidInliningPositionValue(position: unknown): position is InliningPosition;
|
|
21
|
+
export declare function newInvalidInliningPositionValueError(position: unknown, file?: string, useDefaultValueValue?: string): import("webpack").WebpackError;
|
|
22
|
+
export declare function isEnqueuingControlFlag(prop: string): prop is keyof NormalizedEnqueuingControlFlags;
|
|
23
|
+
export type NormalizedEnqueuingControlFlags = {
|
|
24
|
+
strategy?: WordPressSupportedLoadingStrategy;
|
|
25
|
+
in_footer?: InFooter;
|
|
26
|
+
inline?: InliningPosition;
|
|
27
|
+
fetchpriority?: FetchPriority;
|
|
28
|
+
};
|
|
29
|
+
export type EnqueuingControlFlags = {
|
|
30
|
+
[key in Exclude<keyof NormalizedEnqueuingControlFlags, 'strategy' | 'inline'>]?: NormalizedEnqueuingControlFlags[key] | false;
|
|
31
|
+
} & {
|
|
32
|
+
strategy?: LoadingStrategy | false;
|
|
33
|
+
inline?: boolean | InliningPosition;
|
|
34
|
+
};
|
|
35
|
+
export declare function normalizeAndMergeEnqueuingControlFlags(rawFlags: EnqueuingControlFlags | undefined, computedFlags: NormalizedEnqueuingControlFlags | undefined, file?: string): NormalizedEnqueuingControlFlags;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=flag-logic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flag-logic.d.ts","sourceRoot":"","sources":["../../../src/api/entries/flag-logic.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,0BAA0B,YAAI,OAAO,EAAE,OAAO,CAAU,CAAC;AAC/D,QAAA,MAAM,eAAe,8CAA4D,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAC7D,MAAM,MAAM,iCAAiC,GAAG,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAC1F,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,eAAe,EAAE,iCAAiC,CAAC,CAAC;AACnG,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,eAAe,CAEnF;AACD,wBAAgB,mCAAmC,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,iCAAiC,CAEpH;AACD,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,kCAI9E;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,OAAO,iCAE3D;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC;AAC/B,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,IAAI,QAAQ,CAEzE;AACD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,kCAErE;AAED,QAAA,MAAM,oBAAoB,YAAI,MAAM,EAAE,KAAK,EAAE,MAAM,CAAU,CAAC;AAC9D,MA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,EAAE,+BAA+B,GAAC,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,+BAA+B,CA4C1M"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultInliningPosition = void 0;
|
|
4
|
+
exports.isValidNamedStrategy = isValidNamedStrategy;
|
|
5
|
+
exports.isWordPressSupportedLoadingStrategy = isWordPressSupportedLoadingStrategy;
|
|
6
|
+
exports.newInvalidLoadingStrategyError = newInvalidLoadingStrategyError;
|
|
7
|
+
exports.isDeferringLoadingStrategy = isDeferringLoadingStrategy;
|
|
8
|
+
exports.isValidInFooter = isValidInFooter;
|
|
9
|
+
exports.invalidInFooterError = invalidInFooterError;
|
|
10
|
+
exports.isValidFetchPriority = isValidFetchPriority;
|
|
11
|
+
exports.newInvalidFetchPriorityError = newInvalidFetchPriorityError;
|
|
12
|
+
exports.isValidInliningPositionValue = isValidInliningPositionValue;
|
|
13
|
+
exports.newInvalidInliningPositionValueError = newInvalidInliningPositionValueError;
|
|
14
|
+
exports.isEnqueuingControlFlag = isEnqueuingControlFlag;
|
|
15
|
+
exports.normalizeAndMergeEnqueuingControlFlags = normalizeAndMergeEnqueuingControlFlags;
|
|
16
|
+
const utils_1 = require("../../utils");
|
|
17
|
+
const wordPressLoadingStrategies = ['defer', 'async'];
|
|
18
|
+
const namedStrategies = [...wordPressLoadingStrategies, 'eager', 'lazy'];
|
|
19
|
+
function isValidNamedStrategy(strategy) {
|
|
20
|
+
return namedStrategies.includes(strategy);
|
|
21
|
+
}
|
|
22
|
+
function isWordPressSupportedLoadingStrategy(strategy) {
|
|
23
|
+
return wordPressLoadingStrategies.includes(strategy);
|
|
24
|
+
}
|
|
25
|
+
function newInvalidLoadingStrategyError(strategy, file) {
|
|
26
|
+
return (0, utils_1.newWebpackErrorForFile)({
|
|
27
|
+
text: "The strategy value is invalid", received: strategy, expected: `boolean|'${namedStrategies.join("'|'")}'|undefined`, display: 'type'
|
|
28
|
+
}, file);
|
|
29
|
+
}
|
|
30
|
+
function isDeferringLoadingStrategy(strategy) {
|
|
31
|
+
return strategy === 'async' || strategy === 'defer';
|
|
32
|
+
}
|
|
33
|
+
function isValidInFooter(in_footer) {
|
|
34
|
+
return typeof in_footer === 'boolean';
|
|
35
|
+
}
|
|
36
|
+
function invalidInFooterError(in_footer, file) {
|
|
37
|
+
return (0, utils_1.newWebpackErrorForFile)({ text: "The in_footer value is invalid", received: in_footer, expected: "boolean|undefined", display: 'type' }, file);
|
|
38
|
+
}
|
|
39
|
+
const validFetchPriorities = ["auto", "low", "high"];
|
|
40
|
+
function isValidFetchPriority(fetchpriority) {
|
|
41
|
+
return validFetchPriorities.includes(fetchpriority);
|
|
42
|
+
}
|
|
43
|
+
function newInvalidFetchPriorityError(fetchpriority, file) {
|
|
44
|
+
return (0, utils_1.newWebpackErrorForFile)({ text: "The fetchpriority value is invalid", received: fetchpriority, expected: "'auto'|'low'|'high'|undefined", display: 'type' }, file);
|
|
45
|
+
}
|
|
46
|
+
const validInliningPositionValues = ['before', 'after'];
|
|
47
|
+
exports.defaultInliningPosition = 'after';
|
|
48
|
+
function isValidInliningPositionValue(position) {
|
|
49
|
+
return validInliningPositionValues.includes(position);
|
|
50
|
+
}
|
|
51
|
+
function newInvalidInliningPositionValueError(position, file, useDefaultValueValue = 'undefined') {
|
|
52
|
+
return (0, utils_1.newWebpackErrorForFile)({
|
|
53
|
+
text: "The inlining position value is invalid", received: position,
|
|
54
|
+
expected: `'${validInliningPositionValues.join("'|'")}'|${useDefaultValueValue}`, display: 'type'
|
|
55
|
+
}, file);
|
|
56
|
+
}
|
|
57
|
+
function isEnqueuingControlFlag(prop) {
|
|
58
|
+
return ['strategy', 'in_footer', 'inline', 'fetchpriority', 'lazyLoader'].includes(prop);
|
|
59
|
+
}
|
|
60
|
+
function normalizeAndMergeEnqueuingControlFlags(rawFlags, computedFlags, file) {
|
|
61
|
+
if (rawFlags === undefined || !Object.values(rawFlags).some(v => v !== undefined)) {
|
|
62
|
+
return computedFlags ?? {};
|
|
63
|
+
}
|
|
64
|
+
const res = computedFlags ? { ...computedFlags } : {};
|
|
65
|
+
if (rawFlags.strategy === 'eager') {
|
|
66
|
+
res.in_footer = false;
|
|
67
|
+
}
|
|
68
|
+
else if (rawFlags.strategy === 'lazy') {
|
|
69
|
+
res.strategy = 'defer';
|
|
70
|
+
res.in_footer = true;
|
|
71
|
+
}
|
|
72
|
+
else if (isWordPressSupportedLoadingStrategy(rawFlags.strategy)) {
|
|
73
|
+
res.strategy = rawFlags.strategy;
|
|
74
|
+
}
|
|
75
|
+
else if (rawFlags.strategy === false) {
|
|
76
|
+
delete res.strategy;
|
|
77
|
+
}
|
|
78
|
+
else if (rawFlags.strategy !== undefined) {
|
|
79
|
+
throw (0, utils_1.newWebpackErrorForFile)(`Encountered an unsupported strategy value: '${rawFlags.strategy}'. Please resolve the issue or report it immediately if you believe that this message is in incorrect`, file);
|
|
80
|
+
}
|
|
81
|
+
if (rawFlags.in_footer !== undefined) {
|
|
82
|
+
if (typeof rawFlags.in_footer !== 'boolean') {
|
|
83
|
+
throw (0, utils_1.newWebpackErrorForFile)(`Encountered an unsupported in_footer value: '${rawFlags.strategy}'. Please resolve the issue or report it immediately if you believe that this message is in incorrect`, file);
|
|
84
|
+
}
|
|
85
|
+
res.in_footer = rawFlags.in_footer;
|
|
86
|
+
}
|
|
87
|
+
if (rawFlags.inline === true) {
|
|
88
|
+
res.inline ??= exports.defaultInliningPosition;
|
|
89
|
+
}
|
|
90
|
+
else if (rawFlags.inline === false) {
|
|
91
|
+
delete res.inline;
|
|
92
|
+
}
|
|
93
|
+
else if (isValidInliningPositionValue(rawFlags.inline)) {
|
|
94
|
+
res.inline = rawFlags.inline;
|
|
95
|
+
}
|
|
96
|
+
else if (rawFlags.inline !== undefined) {
|
|
97
|
+
throw newInvalidInliningPositionValueError(rawFlags.inline, file, 'boolean|undefined');
|
|
98
|
+
}
|
|
99
|
+
if (rawFlags.fetchpriority === false) {
|
|
100
|
+
delete res.fetchpriority;
|
|
101
|
+
}
|
|
102
|
+
else if (isValidFetchPriority(rawFlags.fetchpriority)) {
|
|
103
|
+
res.fetchpriority = rawFlags.fetchpriority;
|
|
104
|
+
}
|
|
105
|
+
else if (rawFlags.fetchpriority !== undefined) {
|
|
106
|
+
throw newInvalidFetchPriorityError(rawFlags.fetchpriority, file);
|
|
107
|
+
}
|
|
108
|
+
return res;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=flag-logic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flag-logic.js","sourceRoot":"","sources":["../../../src/api/entries/flag-logic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAAmD;AAEnD,MAAM,0BAA0B,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU,CAAC;AAC/D,MAAM,eAAe,GAAG,CAAC,GAAG,0BAA0B,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AAIlF,8BAAqC,QAAiB;IACrD,OAAQ,eAAsC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACnE,CAAC;AACD,6CAAoD,QAAiB;IACpE,OAAQ,0BAAiD,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AACD,wCAA+C,QAAiB,EAAE,IAAa;IAC9E,OAAO,IAAA,8BAAsB,EAAC;QAC7B,IAAI,EAAE,+BAA+B,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM;KAC1I,EAAE,IAAI,CAAC,CAAC;AACV,CAAC;AAED,oCAA2C,QAAiB;IAC3D,OAAO,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,OAAO,CAAC;AACrD,CAAC;AAGD,yBAAgC,SAAkB;IACjD,OAAO,OAAO,SAAS,KAAK,SAAS,CAA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AAE,IAAI,CAAC,CAAC;QAC9M,CAAC;QACD,GAAG,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;IACpC,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QAC9B,GAAG,CAAC,MAAM,KAAK,QAAA,uBAAuB,CAAC;IACxC,CAAC;SAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;QACtC,OAAO,GAAG,CAAC,MAAM,CAAC;IACnB,CAAC;SAAM,IAAI,4BAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1D,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;SAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1C,MAAM,oCAAoC,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,mBAAmB,CAAC,CAAC;IACxF,CAAC;IAED,IAAI,QAAQ,CAAC,aAAa,KAAK,KAAK,EAAE,CAAC;QACtC,OAAO,GAAG,CAAC,aAAa,CAAC;IAC1B,CAAC;SAAM,IAAI,oBAAoB,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QACzD,GAAG,CAAC,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC;IAC5C,CAAC;SAAM,IAAI,QAAQ,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QACjD,MAAM,4BAA4B,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { DelegateContext, VerifiedAdvancedDestinationConfig } from "../shared-types";
|
|
2
|
+
import type { HandleConfig } from "./dependencies";
|
|
3
|
+
import { type NormalizedEnqueuingControlFlags } from "./flag-logic";
|
|
4
|
+
import { type EnqueuedAssetType, type NormalizedUsageLocations, type UsageLocations } from "./locations";
|
|
5
|
+
export declare const DEFAULT_WP_HOOK_PRIORITY = 10;
|
|
6
|
+
export type ProcessedEntrypointIdentifier = Readonly<{
|
|
7
|
+
filePath: string;
|
|
8
|
+
flags: NormalizedEnqueuingControlFlags;
|
|
9
|
+
handleConfig?: HandleConfig;
|
|
10
|
+
locations: NormalizedUsageLocations;
|
|
11
|
+
/**
|
|
12
|
+
* This is only used to communicate what the niceName *could have been* to allow for nicer default handleSuffix values
|
|
13
|
+
*/
|
|
14
|
+
niceName?: string;
|
|
15
|
+
type: EnqueuedAssetType;
|
|
16
|
+
/**
|
|
17
|
+
* TODO: Maybe remove - we can probably get away with just signalling that there wasn't an explicitly-set niceName
|
|
18
|
+
* These are used later on in the process to allow us to have nicer deduplicated handles
|
|
19
|
+
*/
|
|
20
|
+
orderedLocationSpecifiers: string[];
|
|
21
|
+
orderedLocationNameAndFlagSpecifiers: string[];
|
|
22
|
+
}>;
|
|
23
|
+
type PEIDirVersion = Omit<ProcessedEntrypointIdentifier, 'type'> & {
|
|
24
|
+
type: false;
|
|
25
|
+
};
|
|
26
|
+
type ConfigFlags = {
|
|
27
|
+
/**
|
|
28
|
+
* Tells the function to return the parsed entrypoint even if there aren't any location-encoding parts
|
|
29
|
+
*/
|
|
30
|
+
assumePreEncodedLocations?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* This is provided to allow parsing of config directories. It skips tokenizing the identifier name and only concerns itself with a potential query
|
|
33
|
+
*/
|
|
34
|
+
allowDirectories?: boolean;
|
|
35
|
+
};
|
|
36
|
+
type ExistingConfig = Partial<Pick<VerifiedAdvancedDestinationConfig, 'locations' | 'flags' | 'handle'>>;
|
|
37
|
+
/**
|
|
38
|
+
* Parses the given filename according to the following spec:
|
|
39
|
+
* <ul>
|
|
40
|
+
* <li>The filename is a dot-separated series of segments</li>
|
|
41
|
+
* <li>
|
|
42
|
+
* The first and last segments are treated specially
|
|
43
|
+
* <ul>
|
|
44
|
+
* <li>The last segment is the extension, and is used to determine the type of the file ('script', 'style', or 'script-module')</li>
|
|
45
|
+
* <li>The first segment can be suffixed with or be equal to a specific type name ('script'|'style'|'script-module'), in which case, the type detected from the extension will be overridden with it and the "override" will be removed from the name segment in further processing</li>
|
|
46
|
+
* </ul>
|
|
47
|
+
* </li>
|
|
48
|
+
* <li>
|
|
49
|
+
* Segments can be either flags, locations, or modifiers
|
|
50
|
+
* <ul>
|
|
51
|
+
* <li>Flags are: 'in-footer', 'in-header', "strategy=('eager'|'lazy'|'defer'|'async')", 'lazy', 'eager', and "inline[=('before'|'after')]"</li>
|
|
52
|
+
* <li>Locations are: the standard locations and their alternate names, 'both', and 'register'</li>
|
|
53
|
+
* <li>Modifiers are: 'priority' and 'hook_name' (only available in the global and hook-name-supporting location name contexts respectively)</li>
|
|
54
|
+
* </ul>
|
|
55
|
+
* </li>
|
|
56
|
+
* <li>Modifiers are always applied to the preceding location. If a location has not yet been specified in the name, the modifier's value is used as the default for any location that does not specify that modifier</li>
|
|
57
|
+
* </ul>
|
|
58
|
+
*
|
|
59
|
+
* @param rawIdentifier a string that identifies a file on disk. It may be prefixed with "file:" and may include a URL-style query
|
|
60
|
+
* @param existingConfig if there is a pre-existing config (i.e. from a webpack.config.js file) it should be passed here
|
|
61
|
+
* @param delegateContext contextual information used to communicate things that are determined by the current context within the webpack pipeline like error handling mechanisms
|
|
62
|
+
* @param configFlags any config flags
|
|
63
|
+
*/
|
|
64
|
+
export declare function parseEntrypointIdentifier(rawIdentifier: string, existingConfig: ExistingConfig | undefined, delegateContext?: DelegateContext, configFlags?: ConfigFlags): ProcessedEntrypointIdentifier | PEIDirVersion | undefined;
|
|
65
|
+
type BlockEntrypointLocations = Pick<ProcessedEntrypointIdentifier['locations'], 'clientEditor' | 'clientView'>;
|
|
66
|
+
export type ParseResultForBlock = Readonly<{
|
|
67
|
+
[K in keyof ProcessedEntrypointIdentifier]: K extends 'locations' ? BlockEntrypointLocations : ProcessedEntrypointIdentifier[K];
|
|
68
|
+
}>;
|
|
69
|
+
export declare function parseEntrypointIdentifierForBlock(filename: string, assumePreEncodedLocations: boolean, delegateContext?: DelegateContext, existingConfig?: ExistingConfig): ParseResultForBlock | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* This handles detecting all keys of standardLocationNamesMeta as well as the values listed in their associated alternate_names properties
|
|
72
|
+
* It MUST be kept in sync with standardLocationNamesMeta
|
|
73
|
+
* @param segment
|
|
74
|
+
*/
|
|
75
|
+
export declare function extractLocationFromPropertyEncodingFilenameSegment(segment: string): {
|
|
76
|
+
readonly locationName: false;
|
|
77
|
+
readonly priority?: undefined;
|
|
78
|
+
} | {
|
|
79
|
+
readonly locationName: "admin" | "analytics" | "blockAssets" | "clientEditor" | "clientView" | "customizer" | "lazyLoader" | "login" | "register" | undefined;
|
|
80
|
+
readonly priority: number | true;
|
|
81
|
+
};
|
|
82
|
+
export declare function normalizeAndMergeUsageLocations(rawLocations: UsageLocations | undefined, computedLocations: NormalizedUsageLocations | undefined, file?: string): NormalizedUsageLocations;
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=identifiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../../../src/api/entries/identifiers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,eAAe,EAAE,iCAAiC,EAAC,MAAM,iBAAiB,CAAC;AAExF,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAEN,KAAK,+BAA+B,EAEpC,MAAM,cAAc,CAAC;AACtB,OAAO,EACoC,KAAK,iBAAiB,EACM,KAAK,wBAAwB,EACxE,KAAK,cAAc,EAC9C,MAAM,aAAa,CAAC;AAIrB,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAAC;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,+BAA+B,CAAC;IACvC,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